#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 sparse_dict {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sparse_dict_free(struct sparse_dict *);
struct sparse_dict *sparse_dict_init();
int /*<<< orphan*/ sparse_dict_set(struct sparse_dict *, char *,
                                   int /*<<< orphan*/, char *,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int test_dict_set() {
  struct sparse_dict *dict = NULL;
  dict = sparse_dict_init();
  if (!(dict)) {
    printf("%i: ", 185);
    return 0;
  };
  if (!(sparse_dict_set(dict, "key", strlen("key"), "value",
                        strlen("value")))) {
    printf("%i: ", 187);
    return 0;
  };
  if (!(sparse_dict_free(dict))) {
    printf("%i: ", 189);
    return 0;
  };
  return 1;
}


x86 assembly (clang, -O0):
<test_dict_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1050 <sparse_dict_init@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1193 <test_dict_set+0x43>
lea    0xe83(%rip),%rdi
mov    $0xb9,%esi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    122f <test_dict_set+0xdf>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe63(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
lea    0xe58(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    %eax,%r8d
lea    0xe3e(%rip),%rsi
lea    0xe3b(%rip),%rcx
call   1060 <sparse_dict_set@plt>
cmp    $0x0,%eax
jne    11f9 <test_dict_set+0xa9>
lea    0xe1d(%rip),%rdi
mov    $0xbb,%esi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    122f <test_dict_set+0xdf>
mov    -0x10(%rbp),%rdi
call   1070 <sparse_dict_free@plt>
cmp    $0x0,%eax
jne    1228 <test_dict_set+0xd8>
lea    0xdee(%rip),%rdi
mov    $0xbd,%esi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    122f <test_dict_set+0xdf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_dict_set>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <sparse_dict_init@plt>
test   %rax,%rax
je     11b7 <test_dict_set+0x67>
mov    %rax,%rbx
lea    0xe98(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
lea    0xe8b(%rip),%r15
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %r15,%rcx
mov    %eax,%r8d
call   1060 <sparse_dict_set@plt>
test   %eax,%eax
je     11be <test_dict_set+0x6e>
mov    %rbx,%rdi
call   1070 <sparse_dict_free@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %ecx,%ecx
jne    11d1 <test_dict_set+0x81>
mov    $0xbd,%esi
jmp    11c3 <test_dict_set+0x73>
mov    $0xb9,%esi
jmp    11c3 <test_dict_set+0x73>
mov    $0xbb,%esi
lea    0xe36(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sparse_dict = type { i32 }
@.str = [5 x i8] c"%i: \00"
@.str.1 = [4 x i8] c"key\00"
@.str.2 = [6 x i8] c"value\00"
define i32 @test_dict_set() {
%1 = alloca i32
%2 = alloca %struct.sparse_dict*
store %struct.sparse_dict* null, %struct.sparse_dict** %2
%3 = call %struct.sparse_dict* (...) @sparse_dict_init()
store %struct.sparse_dict* %3, %struct.sparse_dict** %2
%4 = load %struct.sparse_dict*, %struct.sparse_dict** %2
%5 = icmp ne %struct.sparse_dict* %4, null
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 185)
store i32 0, i32* %1
br label %23
8: ; preds = %0
%9 = load %struct.sparse_dict*, %struct.sparse_dict** %2
%10 = call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @sparse_dict_set(%struct.sparse_dict* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %8
%15 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 187)
store i32 0, i32* %1
br label %23
16: ; preds = %8
%17 = load %struct.sparse_dict*, %struct.sparse_dict** %2
%18 = call i32 @sparse_dict_free(%struct.sparse_dict* %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 189)
store i32 0, i32* %1
br label %23
22: ; preds = %16
store i32 1, i32* %1
br label %23
23: ; preds = %22, %20, %14, %6
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
%struct.sparse_dict = type { i32 }
@.str = [5 x i8] c"%i: \00"
@.str.1 = [4 x i8] c"key\00"
@.str.2 = [6 x i8] c"value\00"
define i32 @test_dict_set() {
%1 = tail call %struct.sparse_dict* (...) @sparse_dict_init()
%2 = icmp eq %struct.sparse_dict* %1, null
br i1 %2, label %11, label %3
3: ; preds = %0
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @sparse_dict_set(%struct.sparse_dict* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = tail call i32 @sparse_dict_free(%struct.sparse_dict* %1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8, %3, %0
%12 = phi i32 [ 185, %0 ], [ 187, %3 ], [ 189, %8 ]
%13 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11, %8
%15 = phi i32 [ 1, %8 ], [ 0, %11 ]
ret i32 %15
}