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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ object_delete(struct varstore *);
struct varstore *varstore_create();
int varstore_insert(struct varstore *, char *, int);
scalar_t__ varstore_offset(struct varstore *, char *, int, size_t *);
int varstore_offset_create(struct varstore *, char *, int);
int main() {
  struct varstore *varstore = varstore_create();
  assert(varstore_insert(varstore, "test1", 1) == 0);
  assert(varstore_insert(varstore, "test8", 8) == 4);
  assert(varstore_insert(varstore, "test16", 16) == 8);
  assert(varstore_insert(varstore, "test32", 32) == 12);
  assert(varstore_insert(varstore, "test64", 64) == 16);
  assert(varstore_insert(varstore, "test64_2", 64) == 24);
  assert(varstore_offset_create(varstore, "test64", 64) == 16);
  size_t offset;
  assert(varstore_offset(varstore, "test16", 16, &offset) == 0);
  assert(offset == 8);
  object_delete(varstore);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <varstore_create@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe7b(%rip),%rsi
mov    $0x1,%edx
call   1060 <varstore_insert@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x8,%edx
call   1060 <varstore_insert@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xe3d(%rip),%rsi
mov    $0x10,%edx
call   1060 <varstore_insert@plt>
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xe1f(%rip),%rsi
mov    $0x20,%edx
call   1060 <varstore_insert@plt>
cmp    $0xc,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xe01(%rip),%rsi
mov    $0x40,%edx
call   1060 <varstore_insert@plt>
cmp    $0x10,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xde3(%rip),%rsi
mov    $0x40,%edx
call   1060 <varstore_insert@plt>
cmp    $0x18,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xdb7(%rip),%rsi
mov    $0x40,%edx
call   1030 <varstore_offset_create@plt>
cmp    $0x10,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
lea    0xd84(%rip),%rsi
mov    $0x10,%edx
lea    -0x18(%rbp),%rcx
call   1050 <varstore_offset@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
cmpq   $0x8,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1080 <object_delete@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <varstore_create@plt>
mov    %rax,%rbx
lea    0xe86(%rip),%rsi
mov    %rax,%rdi
mov    $0x1,%edx
call   1060 <varstore_insert@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1060 <varstore_insert@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xe4f(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
call   1060 <varstore_insert@plt>
xor    %edi,%edi
cmp    $0x8,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xe31(%rip),%rsi
mov    %rbx,%rdi
mov    $0x20,%edx
call   1060 <varstore_insert@plt>
xor    %edi,%edi
cmp    $0xc,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xe16(%rip),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x40,%edx
call   1060 <varstore_insert@plt>
xor    %edi,%edi
cmp    $0x10,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xdf8(%rip),%rsi
mov    %rbx,%rdi
mov    $0x40,%edx
call   1060 <varstore_insert@plt>
xor    %edi,%edi
cmp    $0x18,%eax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x40,%edx
call   1030 <varstore_offset_create@plt>
xor    %edi,%edi
cmp    $0x10,%eax
sete   %dil
call   1070 <assert@plt>
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
call   1050 <varstore_offset@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
xor    %edi,%edi
cmpq   $0x8,0x8(%rsp)
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1080 <object_delete@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.varstore = type { i32 }
@.str = [6 x i8] c"test1\00"
@.str.1 = [6 x i8] c"test8\00"
@.str.2 = [7 x i8] c"test16\00"
@.str.3 = [7 x i8] c"test32\00"
@.str.4 = [7 x i8] c"test64\00"
@.str.5 = [9 x i8] c"test64_2\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.varstore*
%3 = alloca i64
store i32 0, i32* %1
%4 = call %struct.varstore* (...) @varstore_create()
store %struct.varstore* %4, %struct.varstore** %2
%5 = load %struct.varstore*, %struct.varstore** %2
%6 = call i32 @varstore_insert(%struct.varstore* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load %struct.varstore*, %struct.varstore** %2
%11 = call i32 @varstore_insert(%struct.varstore* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 8)
%12 = icmp eq i32 %11, 4
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load %struct.varstore*, %struct.varstore** %2
%16 = call i32 @varstore_insert(%struct.varstore* %15, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 16)
%17 = icmp eq i32 %16, 8
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load %struct.varstore*, %struct.varstore** %2
%21 = call i32 @varstore_insert(%struct.varstore* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 32)
%22 = icmp eq i32 %21, 12
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = load %struct.varstore*, %struct.varstore** %2
%26 = call i32 @varstore_insert(%struct.varstore* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 64)
%27 = icmp eq i32 %26, 16
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = load %struct.varstore*, %struct.varstore** %2
%31 = call i32 @varstore_insert(%struct.varstore* %30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 64)
%32 = icmp eq i32 %31, 24
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = load %struct.varstore*, %struct.varstore** %2
%36 = call i32 @varstore_offset_create(%struct.varstore* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 64)
%37 = icmp eq i32 %36, 16
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = load %struct.varstore*, %struct.varstore** %2
%41 = call i64 @varstore_offset(%struct.varstore* %40, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 16, i64* %3)
%42 = icmp eq i64 %41, 0
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
%45 = load i64, i64* %3
%46 = icmp eq i64 %45, 8
%47 = zext i1 %46 to i32
%48 = call i32 @assert(i32 %47)
%49 = load %struct.varstore*, %struct.varstore** %2
%50 = call i32 @object_delete(%struct.varstore* %49)
ret i32 0
}

LLVM IR (-O2):
%struct.varstore = type { i32 }
@.str = [6 x i8] c"test1\00"
@.str.1 = [6 x i8] c"test8\00"
@.str.2 = [7 x i8] c"test16\00"
@.str.3 = [7 x i8] c"test32\00"
@.str.4 = [7 x i8] c"test64\00"
@.str.5 = [9 x i8] c"test64_2\00"
define i32 @main() {
%1 = alloca i64
%2 = tail call %struct.varstore* (...) @varstore_create()
%3 = tail call i32 @varstore_insert(%struct.varstore* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @varstore_insert(%struct.varstore* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 8)
%8 = icmp eq i32 %7, 4
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @varstore_insert(%struct.varstore* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 16)
%12 = icmp eq i32 %11, 8
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @varstore_insert(%struct.varstore* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 32)
%16 = icmp eq i32 %15, 12
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = tail call i32 @varstore_insert(%struct.varstore* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 64)
%20 = icmp eq i32 %19, 16
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 @varstore_insert(%struct.varstore* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 64)
%24 = icmp eq i32 %23, 24
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call i32 @varstore_offset_create(%struct.varstore* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 64)
%28 = icmp eq i32 %27, 16
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = bitcast i64* %1 to i8*
%32 = call i64 @varstore_offset(%struct.varstore* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 16, i64* %1)
%33 = icmp eq i64 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = load i64, i64* %1
%37 = icmp eq i64 %36, 8
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = call i32 @object_delete(%struct.varstore* %2)
ret i32 0
}