#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 */

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ destroy_store();
int exists(int /*<<< orphan*/);
int get(int /*<<< orphan*/);
int /*<<< orphan*/ init_store();
int /*<<< orphan*/ set(int /*<<< orphan*/, int, int, int /*<<< orphan*/);
void test_getset_simple() {
  init_store();
  assert(!exists(0));
  assert(get(0) == 0);
  set(0, 999, -1, 0);
  assert(exists(0));
  assert(get(0) == 999);
  destroy_store();
}


x86 assembly (clang, -O0):
<test_getset_simple>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <init_store@plt>
xor    %edi,%edi
call   1060 <exists@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1050 <get@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %ecx,%ecx
mov    $0x3e7,%esi
mov    $0xffffffff,%edx
mov    %ecx,%edi
call   1080 <set@plt>
xor    %edi,%edi
call   1060 <exists@plt>
mov    %eax,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1050 <get@plt>
cmp    $0x3e7,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x0,%al
call   1040 <destroy_store@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_getset_simple>:
push   %rax
xor    %eax,%eax
call   1070 <init_store@plt>
xor    %edi,%edi
call   1060 <exists@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
call   1050 <get@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
xor    %edi,%edi
mov    $0x3e7,%esi
mov    $0xffffffff,%edx
xor    %ecx,%ecx
call   1080 <set@plt>
xor    %edi,%edi
call   1060 <exists@plt>
mov    %eax,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1050 <get@plt>
xor    %edi,%edi
cmp    $0x3e7,%eax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <destroy_store@plt>

LLVM IR (-O0):
define void @test_getset_simple() {
%1 = call i32 (...) @init_store()
%2 = call i32 @exists(i32 0)
%3 = icmp ne i32 %2, 0
%4 = xor i1 %3, true
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call i32 @get(i32 0)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i32 @set(i32 0, i32 999, i32 -1, i32 0)
%12 = call i32 @exists(i32 0)
%13 = call i32 @assert(i32 %12)
%14 = call i32 @get(i32 0)
%15 = icmp eq i32 %14, 999
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = call i32 (...) @destroy_store()
ret void
}

LLVM IR (-O2):
define void @test_getset_simple() {
%1 = tail call i32 (...) @init_store()
%2 = tail call i32 @exists(i32 0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @get(i32 0)
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 @set(i32 0, i32 999, i32 -1, i32 0)
%11 = tail call i32 @exists(i32 0)
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @get(i32 0)
%14 = icmp eq i32 %13, 999
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
%17 = tail call i32 (...) @destroy_store()
ret void
}