#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_as_list(struct szl_interp *, struct szl_obj *,
                               struct szl_obj ***, size_t *);
int /*<<< orphan*/ szl_set_last_str(struct szl_interp *, char *, int);
__attribute__((nonnull(1, 2, 3, 4))) int szl_as_dict(struct szl_interp *interp,
                                                     struct szl_obj *obj,
                                                     struct szl_obj ***items,
                                                     size_t *len) {
  if (!szl_as_list(interp, obj, items, len))
    return 0;
  if (*len % 2 == 1) {
    szl_set_last_str(interp, "bad dict", sizeof("bad dict") - 1);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<szl_as_dict>:
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
mov    -0x28(%rbp),%rcx
call   1030 <szl_as_list@plt>
cmp    $0x0,%eax
jne    1162 <szl_as_dict+0x42>
movl   $0x0,-0x4(%rbp)
jmp    119f <szl_as_dict+0x7f>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
and    $0x1,%rax
cmp    $0x1,%rax
jne    1198 <szl_as_dict+0x78>
mov    -0x10(%rbp),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x8,%edx
call   1040 <szl_set_last_str@plt>
movl   $0x0,-0x4(%rbp)
jmp    119f <szl_as_dict+0x7f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<szl_as_dict>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %rdi,%r14
call   1030 <szl_as_list@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1157 <szl_as_dict+0x37>
mov    $0x1,%eax
testb  $0x1,(%rbx)
je     1157 <szl_as_dict+0x37>
lea    0xeb8(%rip),%rsi
mov    %r14,%rdi
mov    $0x8,%edx
call   1040 <szl_set_last_str@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.szl_interp = type { i32 }
%struct.szl_obj = type { i32 }
@.str = [9 x i8] c"bad dict\00"
define i32 @szl_as_dict(%struct.szl_interp* %0, %struct.szl_obj* %1, %struct.szl_obj*** %2, i64* %3) {
%5 = alloca i32
%6 = alloca %struct.szl_interp*
%7 = alloca %struct.szl_obj*
%8 = alloca %struct.szl_obj***
%9 = alloca i64*
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 i64* %3, i64** %9
%10 = load %struct.szl_interp*, %struct.szl_interp** %6
%11 = load %struct.szl_obj*, %struct.szl_obj** %7
%12 = load %struct.szl_obj***, %struct.szl_obj**** %8
%13 = load i64*, i64** %9
%14 = call i32 @szl_as_list(%struct.szl_interp* %10, %struct.szl_obj* %11, %struct.szl_obj*** %12, i64* %13)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %4
store i32 0, i32* %5
br label %26
17: ; preds = %4
%18 = load i64*, i64** %9
%19 = load i64, i64* %18
%20 = urem i64 %19, 2
%21 = icmp eq i64 %20, 1
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load %struct.szl_interp*, %struct.szl_interp** %6
%24 = call i32 @szl_set_last_str(%struct.szl_interp* %23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
store i32 0, i32* %5
br label %26
25: ; preds = %17
store i32 1, i32* %5
br label %26
26: ; preds = %25, %22, %16
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
%struct.szl_interp = type { i32 }
%struct.szl_obj = type { i32 }
@.str = [9 x i8] c"bad dict\00"
define i32 @szl_as_dict(%struct.szl_interp* %0, %struct.szl_obj* %1, %struct.szl_obj*** %2, i64* %3) {
%5 = tail call i32 @szl_as_list(%struct.szl_interp* %0, %struct.szl_obj* %1, %struct.szl_obj*** %2, i64* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = load i64, i64* %3
%9 = and i64 %8, 1
%10 = icmp eq i64 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %7
%12 = tail call i32 @szl_set_last_str(%struct.szl_interp* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8)
br label %13
13: ; preds = %7, %4, %11
%14 = phi i32 [ 0, %11 ], [ 0, %4 ], [ 1, %7 ]
ret i32 %14
}