#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct szl_obj {
  int dummy;
};
struct szl_interp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ szl_dict_get_key(struct szl_interp *, struct szl_obj *,
                                    struct szl_obj *, struct szl_obj ***);
struct szl_obj *szl_ref(struct szl_obj *);
__attribute__((nonnull(1, 2, 3, 4))) int szl_dict_get(struct szl_interp *interp,
                                                      struct szl_obj *dict,
                                                      struct szl_obj *k,
                                                      struct szl_obj **v) {
  struct szl_obj **pos;
  if (!szl_dict_get_key(interp, dict, k, &pos))
    return 0;
  if (pos)
    *v = szl_ref(*(pos + 1));
  else
    *v = NULL;
  return 1;
}


x86 assembly (clang, -O0):
<szl_dict_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1040 <szl_dict_get_key@plt>
cmp    $0x0,%eax
jne    1162 <szl_dict_get+0x42>
movl   $0x0,-0x4(%rbp)
jmp    119b <szl_dict_get+0x7b>
cmpq   $0x0,-0x30(%rbp)
je     1189 <szl_dict_get+0x69>
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <szl_ref@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
jmp    1194 <szl_dict_get+0x74>
mov    -0x28(%rbp),%rax
movq   $0x0,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<szl_dict_get>:
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%rbx
lea    0x8(%rsp),%rcx
call   1040 <szl_dict_get_key@plt>
test   %eax,%eax
je     114b <szl_dict_get+0x2b>
mov    0x8(%rsp),%rax
test   %rax,%rax
je     114f <szl_dict_get+0x2f>
mov    0x8(%rax),%rdi
call   1030 <szl_ref@plt>
jmp    1151 <szl_dict_get+0x31>
xor    %eax,%eax
jmp    1159 <szl_dict_get+0x39>
xor    %eax,%eax
mov    %rax,(%rbx)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.szl_interp = type { i32 }
%struct.szl_obj = type { i32 }
define i32 @szl_dict_get(%struct.szl_interp* %0, %struct.szl_obj* %1, %struct.szl_obj* %2, %struct.szl_obj** %3) {
%5 = alloca i32
%6 = alloca %struct.szl_interp*
%7 = alloca %struct.szl_obj*
%8 = alloca %struct.szl_obj*
%9 = alloca %struct.szl_obj**
%10 = alloca %struct.szl_obj**
store %struct.szl_interp* %0, %struct.szl_interp** %6
store %struct.szl_obj* %1, %struct.szl_obj** %7
store %struct.szl_obj* %2, %struct.szl_obj** %8
store %struct.szl_obj** %3, %struct.szl_obj*** %9
%11 = load %struct.szl_interp*, %struct.szl_interp** %6
%12 = load %struct.szl_obj*, %struct.szl_obj** %7
%13 = load %struct.szl_obj*, %struct.szl_obj** %8
%14 = call i32 @szl_dict_get_key(%struct.szl_interp* %11, %struct.szl_obj* %12, %struct.szl_obj* %13, %struct.szl_obj*** %10)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %4
store i32 0, i32* %5
br label %29
17: ; preds = %4
%18 = load %struct.szl_obj**, %struct.szl_obj*** %10
%19 = icmp ne %struct.szl_obj** %18, null
br i1 %19, label %20, label %26
20: ; preds = %17
%21 = load %struct.szl_obj**, %struct.szl_obj*** %10
%22 = getelementptr inbounds %struct.szl_obj*, %struct.szl_obj** %21, i64 1
%23 = load %struct.szl_obj*, %struct.szl_obj** %22
%24 = call %struct.szl_obj* @szl_ref(%struct.szl_obj* %23)
%25 = load %struct.szl_obj**, %struct.szl_obj*** %9
store %struct.szl_obj* %24, %struct.szl_obj** %25
br label %28
26: ; preds = %17
%27 = load %struct.szl_obj**, %struct.szl_obj*** %9
store %struct.szl_obj* null, %struct.szl_obj** %27
br label %28
28: ; preds = %26, %20
store i32 1, i32* %5
br label %29
29: ; preds = %28, %16
%30 = load i32, i32* %5
ret i32 %30
}

LLVM IR (-O2):
%struct.szl_interp = type { i32 }
%struct.szl_obj = type { i32 }
define i32 @szl_dict_get(%struct.szl_interp* %0, %struct.szl_obj* %1, %struct.szl_obj* %2, %struct.szl_obj** nocapture writeonly %3) {
%5 = alloca %struct.szl_obj**
%6 = bitcast %struct.szl_obj*** %5 to i8*
%7 = call i32 @szl_dict_get_key(%struct.szl_interp* %0, %struct.szl_obj* %1, %struct.szl_obj* %2, %struct.szl_obj*** %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %4
%10 = load %struct.szl_obj**, %struct.szl_obj*** %5
%11 = icmp eq %struct.szl_obj** %10, null
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = getelementptr inbounds %struct.szl_obj*, %struct.szl_obj** %10, i64 1
%14 = load %struct.szl_obj*, %struct.szl_obj** %13
%15 = call %struct.szl_obj* @szl_ref(%struct.szl_obj* %14)
br label %16
16: ; preds = %9, %12
%17 = phi %struct.szl_obj* [ %15, %12 ], [ null, %9 ]
store %struct.szl_obj* %17, %struct.szl_obj** %3
br label %18
18: ; preds = %4, %16
%19 = phi i32 [ 1, %16 ], [ 0, %4 ]
ret i32 %19
}