[case testDictGet]
from typing import Dict
def f(d: Dict[int, bool]) -> bool:
    return d[0]
[out]
def f(d):
    d :: dict
    r0, r1 :: object
    r2 :: bool
L0:
    r0 = box(short_int, 0)
    r1 = CPyDict_GetItem(d, r0)
    r2 = unbox(bool, r1)
    return r2

[case testDictSet]
from typing import Dict
def f(d: Dict[int, bool]) -> None:
    d[0] = False
[out]
def f(d):
    d :: dict
    r0, r1 :: object
    r2 :: int32
    r3 :: bit
L0:
    r0 = box(short_int, 0)
    r1 = box(bool, 0)
    r2 = CPyDict_SetItem(d, r0, r1)
    r3 = r2 >= 0 :: signed
    return 1

[case testNewEmptyDict]
from typing import Dict
def f() -> None:
    d = {}  # type: Dict[bool, int]
[out]
def f():
    r0, d :: dict
L0:
    r0 = PyDict_New()
    d = r0
    return 1

[case testNewDictWithValues]
def f(x: object) -> None:
    d = {1: 2, '': x}
[out]
def f(x):
    x :: object
    r0 :: str
    r1, r2 :: object
    r3, d :: dict
L0:
    r0 = ''
    r1 = box(short_int, 2)
    r2 = box(short_int, 4)
    r3 = CPyDict_Build(2, r1, r2, r0, x)
    d = r3
    return 1

[case testInDict]
from typing import Dict
def f(d: Dict[int, int]) -> bool:
    if 4 in d:
        return True
    else:
        return False
[out]
def f(d):
    d :: dict
    r0 :: object
    r1 :: int32
    r2 :: bit
    r3 :: bool
L0:
    r0 = box(short_int, 8)
    r1 = PyDict_Contains(d, r0)
    r2 = r1 >= 0 :: signed
    r3 = truncate r1: int32 to builtins.bool
    if r3 goto L1 else goto L2 :: bool
L1:
    return 1
L2:
    return 0
L3:
    unreachable

[case testNotInDict]
from typing import Dict
def f(d: Dict[int, int]) -> bool:
    if 4 not in d:
        return True
    else:
        return False
[out]
def f(d):
    d :: dict
    r0 :: object
    r1 :: int32
    r2 :: bit
    r3, r4 :: bool
L0:
    r0 = box(short_int, 8)
    r1 = PyDict_Contains(d, r0)
    r2 = r1 >= 0 :: signed
    r3 = truncate r1: int32 to builtins.bool
    r4 = r3 ^ 1
    if r4 goto L1 else goto L2 :: bool
L1:
    return 1
L2:
    return 0
L3:
    unreachable

[case testDictUpdate]
from typing import Dict
def f(a: Dict[int, int], b: Dict[int, int]) -> None:
    a.update(b)
[out]
def f(a, b):
    a, b :: dict
    r0 :: int32
    r1 :: bit
L0:
    r0 = CPyDict_Update(a, b)
    r1 = r0 >= 0 :: signed
    return 1

[case testDictKeyLvalue]
from typing import Dict
def increment(d: Dict[str, int]) -> Dict[str, int]:
    for k in d:
        d[k] += 1
    return d
[out]
def increment(d):
    d :: dict
    r0 :: short_int
    r1 :: native_int
    r2 :: short_int
    r3 :: object
    r4 :: tuple[bool, int, object]
    r5 :: int
    r6 :: bool
    r7 :: object
    r8, k :: str
    r9, r10, r11 :: object
    r12 :: int32
    r13, r14, r15 :: bit
L0:
    r0 = 0
    r1 = PyDict_Size(d)
    r2 = r1 << 1
    r3 = CPyDict_GetKeysIter(d)
L1:
    r4 = CPyDict_NextKey(r3, r0)
    r5 = r4[1]
    r0 = r5
    r6 = r4[0]
    if r6 goto L2 else goto L4 :: bool
L2:
    r7 = r4[2]
    r8 = cast(str, r7)
    k = r8
    r9 = CPyDict_GetItem(d, k)
    r10 = box(short_int, 2)
    r11 = PyNumber_InPlaceAdd(r9, r10)
    r12 = CPyDict_SetItem(d, k, r11)
    r13 = r12 >= 0 :: signed
L3:
    r14 = CPyDict_CheckSize(d, r2)
    goto L1
L4:
    r15 = CPy_NoErrOccured()
L5:
    return d

[case testDictDisplay]
from typing import Dict
def f(x: str, y: Dict[str, int]) -> Dict[str, int]:
    return {x: 2, **y, 'z': 3}
[out]
def f(x, y):
    x :: str
    y :: dict
    r0 :: str
    r1 :: object
    r2 :: dict
    r3 :: int32
    r4 :: bit
    r5 :: object
    r6 :: int32
    r7 :: bit
L0:
    r0 = 'z'
    r1 = box(short_int, 4)
    r2 = CPyDict_Build(1, x, r1)
    r3 = CPyDict_UpdateInDisplay(r2, y)
    r4 = r3 >= 0 :: signed
    r5 = box(short_int, 6)
    r6 = CPyDict_SetItem(r2, r0, r5)
    r7 = r6 >= 0 :: signed
    return r2

[case testDictIterationMethods]
from typing import Dict
def print_dict_methods(d1: Dict[int, int], d2: Dict[int, int]) -> None:
    for v in d1.values():
        if v in d2:
            return
    for k, v in d2.items():
        d2[k] += v
[out]
def print_dict_methods(d1, d2):
    d1, d2 :: dict
    r0 :: short_int
    r1 :: native_int
    r2 :: short_int
    r3 :: object
    r4 :: tuple[bool, int, object]
    r5 :: int
    r6 :: bool
    r7 :: object
    r8, v :: int
    r9 :: object
    r10 :: int32
    r11 :: bit
    r12 :: bool
    r13, r14 :: bit
    r15 :: short_int
    r16 :: native_int
    r17 :: short_int
    r18 :: object
    r19 :: tuple[bool, int, object, object]
    r20 :: int
    r21 :: bool
    r22, r23 :: object
    r24, r25, k :: int
    r26, r27, r28, r29, r30 :: object
    r31 :: int32
    r32, r33, r34 :: bit
L0:
    r0 = 0
    r1 = PyDict_Size(d1)
    r2 = r1 << 1
    r3 = CPyDict_GetValuesIter(d1)
L1:
    r4 = CPyDict_NextValue(r3, r0)
    r5 = r4[1]
    r0 = r5
    r6 = r4[0]
    if r6 goto L2 else goto L6 :: bool
L2:
    r7 = r4[2]
    r8 = unbox(int, r7)
    v = r8
    r9 = box(int, v)
    r10 = PyDict_Contains(d2, r9)
    r11 = r10 >= 0 :: signed
    r12 = truncate r10: int32 to builtins.bool
    if r12 goto L3 else goto L4 :: bool
L3:
    return 1
L4:
L5:
    r13 = CPyDict_CheckSize(d1, r2)
    goto L1
L6:
    r14 = CPy_NoErrOccured()
L7:
    r15 = 0
    r16 = PyDict_Size(d2)
    r17 = r16 << 1
    r18 = CPyDict_GetItemsIter(d2)
L8:
    r19 = CPyDict_NextItem(r18, r15)
    r20 = r19[1]
    r15 = r20
    r21 = r19[0]
    if r21 goto L9 else goto L11 :: bool
L9:
    r22 = r19[2]
    r23 = r19[3]
    r24 = unbox(int, r22)
    r25 = unbox(int, r23)
    k = r24
    v = r25
    r26 = box(int, k)
    r27 = CPyDict_GetItem(d2, r26)
    r28 = box(int, v)
    r29 = PyNumber_InPlaceAdd(r27, r28)
    r30 = box(int, k)
    r31 = CPyDict_SetItem(d2, r30, r29)
    r32 = r31 >= 0 :: signed
L10:
    r33 = CPyDict_CheckSize(d2, r17)
    goto L8
L11:
    r34 = CPy_NoErrOccured()
L12:
    return 1

[case testDictLoadAddress]
def f() -> None:
    x = dict
[out]
def f():
    r0, x :: object
L0:
    r0 = load_address PyDict_Type
    x = r0
    return 1

[case testDictClear]
from typing import Dict
def f(d: Dict[int, int]) -> None:
    return d.clear()
[out]
def f(d):
    d :: dict
    r0 :: bit
L0:
    r0 = CPyDict_Clear(d)
    return 1

[case testDictCopy]
from typing import Dict
def f(d: Dict[int, int]) -> Dict[int, int]:
    return d.copy()
[out]
def f(d):
    d, r0 :: dict
L0:
    r0 = CPyDict_Copy(d)
    return r0

[case testDictSetdefault]
from typing import Dict
def f(d: Dict[object, object]) -> object:
    return d.setdefault('a', 'b')
[out]
def f(d):
    d :: dict
    r0, r1 :: str
    r2 :: object
L0:
    r0 = 'a'
    r1 = 'b'
    r2 = CPyDict_SetDefault(d, r0, r1)
    return r2
