xunge/DecIR huggingface dataset:
/* Forward declarations */
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ (*xdrproc_t)(TYPE_1__ *, char *);
struct TYPE_5__ {
  int /*<<< orphan*/ x_op;
};
typedef TYPE_1__ XDR;

/* Variables and functions */
int /*<<< orphan*/ XDR_FREE;
int /*<<< orphan*/ stub1(TYPE_1__ *, char *);
void xdr_free(xdrproc_t proc, char *objp) {
  XDR x;
  x.x_op = XDR_FREE;
  (*proc)(&x, objp);
}


x86 assembly (clang, -O0):
<xdr_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdi
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_free>:
push   %rax
mov    %rdi,%rax
mov    0x2ed5(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rsp)
mov    %rsp,%rdi
call   *%rax
pop    %rax
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32 }
@XDR_FREE = global i32 0
define void @xdr_free(i32 (%struct.TYPE_5__*, i8*)* %0, i8* %1) {
%3 = alloca i32 (%struct.TYPE_5__*, i8*)*
%4 = alloca i8*
%5 = alloca %struct.TYPE_5__
store i32 (%struct.TYPE_5__*, i8*)* %0, i32 (%struct.TYPE_5__*, i8*)** %3
store i8* %1, i8** %4
%6 = load i32, i32* @XDR_FREE
%7 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 0
store i32 %6, i32* %7
%8 = load i32 (%struct.TYPE_5__*, i8*)*, i32 (%struct.TYPE_5__*, i8*)** %3
%9 = load i8*, i8** %4
%10 = call i32 %8(%struct.TYPE_5__* %5, i8* %9)
ret void
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32 }
@XDR_FREE = global i32 0
define void @xdr_free(i32 (%struct.TYPE_5__*, i8*)* nocapture %0, i8* %1) {
%3 = alloca %struct.TYPE_5__
%4 = bitcast %struct.TYPE_5__* %3 to i8*
%5 = load i32, i32* @XDR_FREE
%6 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %3, i64 0, i32 0
store i32 %5, i32* %6
%7 = call i32 %0(%struct.TYPE_5__* %3, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: %s [-ps] [-k keys] [-l level]\n",
                getprogname());
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"usage: %s [-ps] [-k keys] [-l level]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"usage: %s [-ps] [-k keys] [-l level]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
void gdk_gc_offset() {}


x86 assembly (clang, -O0):
<gdk_gc_offset>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdk_gc_offset>:
ret

LLVM IR (-O0):
define void @gdk_gc_offset() {
ret void
}

LLVM IR (-O2):
define void @gdk_gc_offset() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void MMX_ADDSB(int dst_reg, int src_reg) {
  addbyte(0x66);
  addbyte(0x0f);
  addbyte(0xec);
  addbyte(0xc0 | (dst_reg << 3) | src_reg);
}


x86 assembly (clang, -O0):
<MMX_ADDSB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xec,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
shl    $0x3,%edi
or     $0xc0,%edi
or     -0x8(%rbp),%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMX_ADDSB>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0xec,%edi
call   1030 <addbyte@plt>
shl    $0x3,%ebp
or     %ebx,%ebp
or     $0xc0,%ebp
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @MMX_ADDSB(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 102)
%6 = call i32 @addbyte(i32 15)
%7 = call i32 @addbyte(i32 236)
%8 = load i32, i32* %3
%9 = shl i32 %8, 3
%10 = or i32 192, %9
%11 = load i32, i32* %4
%12 = or i32 %10, %11
%13 = call i32 @addbyte(i32 %12)
ret void
}

LLVM IR (-O2):
define void @MMX_ADDSB(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 102)
%4 = tail call i32 @addbyte(i32 15)
%5 = tail call i32 @addbyte(i32 236)
%6 = shl i32 %0, 3
%7 = or i32 %6, %1
%8 = or i32 %7, 192
%9 = tail call i32 @addbyte(i32 %8)
ret void
}
/* Variables and functions */
void *calloc(int, size_t);
void *ss_malloc(size_t);
void *default_alloc(size_t size, int zero, void *user_data) {
  return zero ? calloc(1, size) : ss_malloc(size);
}


x86 assembly (clang, -O0):
<default_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1154 <default_alloc+0x34>
mov    -0x8(%rbp),%rsi
mov    $0x1,%edi
call   1040 <calloc@plt>
mov    %rax,-0x20(%rbp)
jmp    1161 <default_alloc+0x41>
mov    -0x8(%rbp),%rdi
call   1030 <ss_malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_alloc>:
mov    %rdi,%rax
test   %esi,%esi
je     1134 <default_alloc+0x14>
mov    $0x1,%edi
mov    %rax,%rsi
jmp    1040 <calloc@plt>
mov    %rax,%rdi
jmp    1030 <ss_malloc@plt>

LLVM IR (-O0):
define i8* @default_alloc(i64 %0, i32 %1, i8* %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i8*
store i64 %0, i64* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i64, i64* %4
%11 = call i8* @calloc(i32 1, i64 %10)
br label %15
12: ; preds = %3
%13 = load i64, i64* %4
%14 = call i8* @ss_malloc(i64 %13)
br label %15
15: ; preds = %12, %9
%16 = phi i8* [ %11, %9 ], [ %14, %12 ]
ret i8* %16
}

LLVM IR (-O2):
define i8* @default_alloc(i64 %0, i32 %1, i8* nocapture readnone %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i8* @calloc(i32 1, i64 %0)
br label %9
7: ; preds = %3
%8 = tail call i8* @ss_malloc(i64 %0)
br label %9
9: ; preds = %7, %5
%10 = phi i8* [ %6, %5 ], [ %8, %7 ]
ret i8* %10
}
/* Type definitions */
typedef int wchar_t;

/* Variables and functions */
wchar_t test18(void) { return L'\t'; }


x86 assembly (clang, -O0):
<test18>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test18>:
mov    $0x9,%eax
ret

LLVM IR (-O0):
define i32 @test18() {
ret i32 9
}

LLVM IR (-O2):
define i32 @test18() {
ret i32 9
}
void av_seek_frame() {}


x86 assembly (clang, -O0):
<av_seek_frame>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_seek_frame>:
ret

LLVM IR (-O0):
define void @av_seek_frame() {
ret void
}

LLVM IR (-O2):
define void @av_seek_frame() {
ret void
}
long long jc(long long m) {
  if (m > 1)
    return m = m * jc(m - 1);
  else
    return 1;
}


x86 assembly (clang, -O0):
<jc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x1,-0x10(%rbp)
jle    1154 <jc+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <jc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    %rax,-0x8(%rbp)
jmp    115c <jc+0x4c>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jc>:
mov    $0x1,%eax
cmp    $0x2,%rdi
jl     1121 <jc+0x21>
mov    $0x1,%eax
imul   %rdi,%rax
lea    -0x1(%rdi),%rcx
cmp    $0x2,%rdi
mov    %rcx,%rdi
ja     1110 <jc+0x10>
ret

LLVM IR (-O0):
define i64 @jc(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp sgt i64 %4, 1
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i64, i64* %3
%8 = load i64, i64* %3
%9 = sub nsw i64 %8, 1
%10 = call i64 @jc(i64 %9)
%11 = mul nsw i64 %7, %10
store i64 %11, i64* %3
store i64 %11, i64* %2
br label %13
12: ; preds = %1
store i64 1, i64* %2
br label %13
13: ; preds = %12, %6
%14 = load i64, i64* %2
ret i64 %14
}

LLVM IR (-O2):
define i64 @jc(i64 %0) {
%2 = icmp sgt i64 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i64 [ %6, %3 ], [ %0, %1 ]
%5 = phi i64 [ %7, %3 ], [ 1, %1 ]
%6 = add nsw i64 %4, -1
%7 = mul nsw i64 %4, %5
%8 = icmp ugt i64 %4, 2
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i64 [ 1, %1 ], [ %7, %3 ]
ret i64 %10
}
/* Variables and functions */
int i2c_smbus_read_word_data(int, int);
int odroidI2CReadReg16(int fd, int reg) {
  return i2c_smbus_read_word_data(fd, reg);
}


x86 assembly (clang, -O0):
<odroidI2CReadReg16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <i2c_smbus_read_word_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<odroidI2CReadReg16>:
jmp    1030 <i2c_smbus_read_word_data@plt>

LLVM IR (-O0):
define i32 @odroidI2CReadReg16(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @i2c_smbus_read_word_data(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @odroidI2CReadReg16(i32 %0, i32 %1) {
%3 = tail call i32 @i2c_smbus_read_word_data(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello(void) { printf("Bye World!\n"); }


x86 assembly (clang, -O0):
<hello>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"Bye World!\0A\00"
define void @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [11 x i8] c"Bye World!\00"
define void @hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int keyboard_read();
int console_getc(void) {
  int c;
  do {
    c = keyboard_read();
  } while (c == 0 || !(c == 0x0d || c == 0x08 || (c > 0x1f && c < 0x7f)));
  return c & 0xFF;
}


x86 assembly (clang, -O0):
<console_getc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <keyboard_read@plt>
mov    %eax,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1176 <console_getc+0x66>
mov    $0x1,%al
cmpl   $0xd,-0x4(%rbp)
mov    %al,-0x6(%rbp)
je     116e <console_getc+0x5e>
mov    $0x1,%al
cmpl   $0x8,-0x4(%rbp)
mov    %al,-0x6(%rbp)
je     116e <console_getc+0x5e>
xor    %eax,%eax
cmpl   $0x1f,-0x4(%rbp)
mov    %al,-0x7(%rbp)
jle    1168 <console_getc+0x58>
cmpl   $0x7f,-0x4(%rbp)
setl   %al
mov    %al,-0x7(%rbp)
mov    -0x7(%rbp),%al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
xor    $0xff,%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1118 <console_getc+0x8>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<console_getc>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <keyboard_read@plt>
test   %eax,%eax
je     1120 <console_getc+0x10>
cmp    $0x8,%eax
je     113d <console_getc+0x2d>
cmp    $0xd,%eax
je     113d <console_getc+0x2d>
lea    -0x20(%rax),%ecx
cmp    $0x5e,%ecx
ja     1120 <console_getc+0x10>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @console_getc() {
%1 = alloca i32
br label %2
2: ; preds = %24, %0
%3 = call i32 (...) @keyboard_read()
store i32 %3, i32* %1
br label %4
4: ; preds = %2
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %24, label %7
7: ; preds = %4
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 13
br i1 %9, label %21, label %10
10: ; preds = %7
%11 = load i32, i32* %1
%12 = icmp eq i32 %11, 8
br i1 %12, label %21, label %13
13: ; preds = %10
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, 31
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* %1
%18 = icmp slt i32 %17, 127
br label %19
19: ; preds = %16, %13
%20 = phi i1 [ false, %13 ], [ %18, %16 ]
br label %21
21: ; preds = %19, %10, %7
%22 = phi i1 [ true, %10 ], [ true, %7 ], [ %20, %19 ]
%23 = xor i1 %22, true
br label %24
24: ; preds = %21, %4
%25 = phi i1 [ true, %4 ], [ %23, %21 ]
br i1 %25, label %2, label %26
26: ; preds = %24
%27 = load i32, i32* %1
%28 = and i32 %27, 255
ret i32 %28
}

LLVM IR (-O2):
define i32 @console_getc() {
br label %1
1: ; preds = %6, %0
%2 = tail call i32 (...) @keyboard_read()
switch i32 %2, label %3 [
i32 0, label %6
i32 13, label %7
i32 8, label %7
]
3: ; preds = %1
%4 = add i32 %2, -32
%5 = icmp ult i32 %4, 95
br i1 %5, label %7, label %6
6: ; preds = %3, %1
br label %1
7: ; preds = %1, %1, %3
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ inter_guild_save();
int /*<<< orphan*/ inter_party_save();
int /*<<< orphan*/ inter_pet_save();
int /*<<< orphan*/ inter_storage_save();
int inter_save() {
  inter_storage_save();
  inter_party_save();
  inter_guild_save();
  inter_pet_save();
  return 0;
}


x86 assembly (clang, -O0):
<inter_save>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <inter_storage_save@plt>
mov    $0x0,%al
call   1060 <inter_party_save@plt>
mov    $0x0,%al
call   1050 <inter_guild_save@plt>
mov    $0x0,%al
call   1040 <inter_pet_save@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inter_save>:
push   %rax
xor    %eax,%eax
call   1030 <inter_storage_save@plt>
xor    %eax,%eax
call   1060 <inter_party_save@plt>
xor    %eax,%eax
call   1050 <inter_guild_save@plt>
xor    %eax,%eax
call   1040 <inter_pet_save@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @inter_save() {
%1 = call i32 (...) @inter_storage_save()
%2 = call i32 (...) @inter_party_save()
%3 = call i32 (...) @inter_guild_save()
%4 = call i32 (...) @inter_pet_save()
ret i32 0
}

LLVM IR (-O2):
define i32 @inter_save() {
%1 = tail call i32 (...) @inter_storage_save()
%2 = tail call i32 (...) @inter_party_save()
%3 = tail call i32 (...) @inter_guild_save()
%4 = tail call i32 (...) @inter_pet_save()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ BigEndianReadU64(int /*<<< orphan*/ const *);
int64_t BigEndianReadS64(const uint8_t *bytes) {
  union {
    int64_t s64;
    uint64_t u64;
  } u;
  u.u64 = BigEndianReadU64(bytes);
  return u.s64;
}


x86 assembly (clang, -O0):
<BigEndianReadS64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <BigEndianReadU64@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BigEndianReadS64>:
jmp    1030 <BigEndianReadU64@plt>

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @BigEndianReadS64(i32* %0) {
%2 = alloca i32*
%3 = alloca %union.anon
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @BigEndianReadU64(i32* %4)
%6 = bitcast %union.anon* %3 to i32*
store i32 %5, i32* %6
%7 = bitcast %union.anon* %3 to i32*
%8 = load i32, i32* %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @BigEndianReadS64(i32* %0) {
%2 = tail call i32 @BigEndianReadU64(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ rmdir(char *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
void viderDossierNiveauSauvegardeCaverne(const char *nomPartie) {
  char chemin[200];
  sprintf(chemin, "Sauvegarde/%s/Niveau/Caverne/info_caverne.txt", nomPartie);
  remove(chemin);
  sprintf(chemin, "Sauvegarde/%s/Niveau/Caverne", nomPartie);
  rmdir(chemin);
}


x86 assembly (clang, -O0):
<viderDossierNiveauSauvegardeCaverne>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xd0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeaf(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0xd0(%rbp),%rdi
call   1030 <remove@plt>
lea    -0xd0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeba(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0xd0(%rbp),%rdi
call   1040 <rmdir@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<viderDossierNiveauSauvegardeCaverne>:
push   %r14
push   %rbx
sub    $0xc8,%rsp
mov    %rdi,%rbx
lea    0xebc(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <remove@plt>
lea    0xecd(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1040 <rmdir@plt>
add    $0xc8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [46 x i8] c"Sauvegarde/%s/Niveau/Caverne/info_caverne.txt\00"
@.str.1 = [29 x i8] c"Sauvegarde/%s/Niveau/Caverne\00"
define void @viderDossierNiveauSauvegardeCaverne(i8* %0) {
%2 = alloca i8*
%3 = alloca [200 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%8 = call i32 @remove(i8* %7)
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%10 = load i8*, i8** %2
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%13 = call i32 @rmdir(i8* %12)
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"Sauvegarde/%s/Niveau/Caverne/info_caverne.txt\00"
@.str.1 = [29 x i8] c"Sauvegarde/%s/Niveau/Caverne\00"
define void @viderDossierNiveauSauvegardeCaverne(i8* %0) {
%2 = alloca [200 x i8]
%3 = getelementptr inbounds [200 x i8], [200 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @remove(i8* %3)
%6 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%7 = call i32 @rmdir(i8* %3)
ret void
}
/* Type definitions */
struct connstruct {
  int dummy;
};

/* Variables and functions */
int WEB_write_blk(struct connstruct *, char *, int /*<<< orphan*/, int);
int web__Test_html(struct connstruct *cn, char *datap) {
  int send_len = 0;
  int total_send_len = 0;
  send_len = WEB_write_blk(cn, datap, 0, 328);
  if (send_len != 328)
    return send_len;
  total_send_len += send_len;
  return total_send_len;
}


x86 assembly (clang, -O0):
<web__Test_html>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
xor    %edx,%edx
mov    $0x148,%ecx
call   1030 <WEB_write_blk@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x148,-0x1c(%rbp)
je     115d <web__Test_html+0x4d>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116c <web__Test_html+0x5c>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<web__Test_html>:
xor    %edx,%edx
mov    $0x148,%ecx
jmp    1030 <WEB_write_blk@plt>

LLVM IR (-O0):
%struct.connstruct = type { i32 }
define i32 @web__Test_html(%struct.connstruct* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.connstruct*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store %struct.connstruct* %0, %struct.connstruct** %4
store i8* %1, i8** %5
store i32 0, i32* %6
store i32 0, i32* %7
%8 = load %struct.connstruct*, %struct.connstruct** %4
%9 = load i8*, i8** %5
%10 = call i32 @WEB_write_blk(%struct.connstruct* %8, i8* %9, i32 0, i32 328)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 328
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* %6
store i32 %14, i32* %3
br label %20
15: ; preds = %2
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = add nsw i32 %17, %16
store i32 %18, i32* %7
%19 = load i32, i32* %7
store i32 %19, i32* %3
br label %20
20: ; preds = %15, %13
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
%struct.connstruct = type { i32 }
define i32 @web__Test_html(%struct.connstruct* %0, i8* %1) {
%3 = tail call i32 @WEB_write_blk(%struct.connstruct* %0, i8* %1, i32 0, i32 328)
ret i32 %3
}
void RTThreadUserWait(void) {}


x86 assembly (clang, -O0):
<RTThreadUserWait>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RTThreadUserWait>:
ret

LLVM IR (-O0):
define void @RTThreadUserWait() {
ret void
}

LLVM IR (-O2):
define void @RTThreadUserWait() {
ret void
}
/* Variables and functions */
int rename(char const *, char const *);
int UnixVfs_Rename(const char *zOld, const char *zNew) {
  int rc;
  rc = rename(zOld, zNew);
  return rc == 0 ? 0 : -1;
}


x86 assembly (clang, -O0):
<UnixVfs_Rename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <rename@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    $0xffffffff,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UnixVfs_Rename>:
push   %rax
call   1030 <rename@plt>
neg    %eax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @UnixVfs_Rename(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32 @rename(i8* %6, i8* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 0
%11 = zext i1 %10 to i64
%12 = select i1 %10, i32 0, i32 -1
ret i32 %12
}

LLVM IR (-O2):
define i32 @UnixVfs_Rename(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @rename(i8* %0, i8* %1)
%4 = icmp ne i32 %3, 0
%5 = sext i1 %4 to i32
ret i32 %5
}
int sumOfTwo() {
  extern int first, last;
  return first + last;
}


x86 assembly (clang, -O0):
<sumOfTwo>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eed(%rip),%rax
mov    (%rax),%eax
mov    0x2ec4(%rip),%rcx
add    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumOfTwo>:
mov    0x2ef1(%rip),%rcx
mov    0x2eca(%rip),%rax
mov    (%rax),%eax
add    (%rcx),%eax
ret

LLVM IR (-O0):
@first = external global i32
@last = external global i32
define i32 @sumOfTwo() {
%1 = load i32, i32* @first
%2 = load i32, i32* @last
%3 = add nsw i32 %1, %2
ret i32 %3
}

LLVM IR (-O2):
@first = external global i32
@last = external global i32
define i32 @sumOfTwo() {
%1 = load i32, i32* @first
%2 = load i32, i32* @last
%3 = add nsw i32 %2, %1
ret i32 %3
}
unsigned xrop3_101_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~T;
  stk2 = S | stk3;
  stk1 = D ^ stk2;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_101_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_101_0_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%eax
shl    $0x8,%eax
or     %esi,%eax
not    %eax
or     %ecx,%eax
xor    $0xff,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_101_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = xor i32 %23, -1
store i32 %24, i32* %10
%25 = load i32, i32* %6
%26 = load i32, i32* %10
%27 = or i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %5
%29 = load i32, i32* %9
%30 = xor i32 %28, %29
store i32 %30, i32* %8
%31 = load i32, i32* %8
ret i32 %31
}

LLVM IR (-O2):
define i32 @xrop3_101_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %6, -1
%8 = or i32 %4, %7
%9 = xor i32 %8, 255
ret i32 %9
}
void RTGetOptArgvFromString(void) {}


x86 assembly (clang, -O0):
<RTGetOptArgvFromString>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RTGetOptArgvFromString>:
ret

LLVM IR (-O0):
define void @RTGetOptArgvFromString() {
ret void
}

LLVM IR (-O2):
define void @RTGetOptArgvFromString() {
ret void
}
unsigned char get_nibble(unsigned char *buf, int *i, int *state) {
  unsigned char c;
  int n = *i;
  if (*state) {
    c = buf[n] & 0x0f;
    *i = n + 1;
    *state = 0;
  } else {
    c = buf[n] >> 4;
    *state = 1;
  }
  return c;
}


x86 assembly (clang, -O0):
<get_nibble>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
je     1153 <get_nibble+0x53>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
and    $0xf,%eax
mov    %al,-0x19(%rbp)
mov    -0x20(%rbp),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
jmp    116f <get_nibble+0x6f>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
sar    $0x4,%eax
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
movzbl -0x19(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_nibble>:
movslq (%rsi),%rcx
cmpl   $0x0,(%rdx)
mov    (%rdi,%rcx,1),%al
je     1117 <get_nibble+0x17>
and    $0xf,%al
add    $0x1,%ecx
mov    %ecx,(%rsi)
xor    %ecx,%ecx
mov    %ecx,(%rdx)
ret
shr    $0x4,%al
mov    $0x1,%ecx
mov    %ecx,(%rdx)
ret

LLVM IR (-O0):
define zeroext i8 @get_nibble(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
store i32 %10, i32* %8
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %27
14: ; preds = %3
%15 = load i8*, i8** %4
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = and i32 %20, 15
%22 = trunc i32 %21 to i8
store i8 %22, i8* %7
%23 = load i32, i32* %8
%24 = add nsw i32 %23, 1
%25 = load i32*, i32** %5
store i32 %24, i32* %25
%26 = load i32*, i32** %6
store i32 0, i32* %26
br label %37
27: ; preds = %3
%28 = load i8*, i8** %4
%29 = load i32, i32* %8
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %28, i64 %30
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = ashr i32 %33, 4
%35 = trunc i32 %34 to i8
store i8 %35, i8* %7
%36 = load i32*, i32** %6
store i32 1, i32* %36
br label %37
37: ; preds = %27, %14
%38 = load i8, i8* %7
ret i8 %38
}

LLVM IR (-O2):
define zeroext i8 @get_nibble(i8* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
br i1 %6, label %13, label %10
10: ; preds = %3
%11 = and i8 %9, 15
%12 = add nsw i32 %4, 1
store i32 %12, i32* %1
br label %15
13: ; preds = %3
%14 = lshr i8 %9, 4
br label %15
15: ; preds = %13, %10
%16 = phi i32 [ 1, %13 ], [ 0, %10 ]
%17 = phi i8 [ %14, %13 ], [ %11, %10 ]
store i32 %16, i32* %2
ret i8 %17
}
/* Variables and functions */
scalar_t__ a();
int atoi(char *);
int main(int argc, char *argv[]) {
  int ret = 0;
  if (argc > 1)
    ret = atoi(argv[1]);
  ret += a();
  return ret ? 0 : 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1157 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <a@plt>
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jl     1133 <main+0x13>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%ebx
jmp    1135 <main+0x15>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <a@plt>
xor    %ecx,%ecx
add    %ebx,%eax
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %6
br label %14
14: ; preds = %9, %2
%15 = call i64 (...) @a()
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = add nsw i64 %17, %15
%19 = trunc i64 %18 to i32
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i32 0, i32 1
ret i32 %23
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = zext i32 %7 to i64
br label %9
9: ; preds = %4, %2
%10 = phi i64 [ %8, %4 ], [ 0, %2 ]
%11 = tail call i64 (...) @a()
%12 = add i64 %11, %10
%13 = trunc i64 %12 to i32
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
ret i32 %15
}
/* Variables and functions */
int snoopy_genericregistry_getIdFromName(char **, char const *const);
int snoopy_genericregistry_doesNameExist(char *regArray[],
                                         char const *const itemName) {
  if (snoopy_genericregistry_getIdFromName(regArray, itemName) == -1) {
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<snoopy_genericregistry_doesNameExist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <snoopy_genericregistry_getIdFromName@plt>
cmp    $0xffffffff,%eax
jne    1142 <snoopy_genericregistry_doesNameExist+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1149 <snoopy_genericregistry_doesNameExist+0x39>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snoopy_genericregistry_doesNameExist>:
push   %rax
call   1030 <snoopy_genericregistry_getIdFromName@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @snoopy_genericregistry_doesNameExist(i8** %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %4
store i8* %1, i8** %5
%6 = load i8**, i8*** %4
%7 = load i8*, i8** %5
%8 = call i32 @snoopy_genericregistry_getIdFromName(i8** %6, i8* %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %12
11: ; preds = %2
store i32 1, i32* %3
br label %12
12: ; preds = %11, %10
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @snoopy_genericregistry_doesNameExist(i8** %0, i8* %1) {
%3 = tail call i32 @snoopy_genericregistry_getIdFromName(i8** %0, i8* %1)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
ret i32 %5
}
void arch_init() {}


x86 assembly (clang, -O0):
<arch_init>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arch_init>:
ret

LLVM IR (-O0):
define void @arch_init() {
ret void
}

LLVM IR (-O2):
define void @arch_init() {
ret void
}
/* Variables and functions */
char *agent_message(char const *);
const char *RL_agent_message(const char *message) {
  const char *theAgentResponse = 0;
  const char *messageToSend = 0;
  if (message != 0) {
    messageToSend = message;
  } else {
    messageToSend = "";
  }
  theAgentResponse = agent_message(messageToSend);
  if (theAgentResponse == 0) {
    return "";
  }
  return theAgentResponse;
}


x86 assembly (clang, -O0):
<RL_agent_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1144 <RL_agent_message+0x34>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    114f <RL_agent_message+0x3f>
lea    0xeb5(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <agent_message@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1177 <RL_agent_message+0x67>
lea    0xe92(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117f <RL_agent_message+0x6f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RL_agent_message>:
push   %rbx
test   %rdi,%rdi
lea    0xee5(%rip),%rbx
cmove  %rbx,%rdi
call   1030 <agent_message@plt>
test   %rax,%rax
cmove  %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @RL_agent_message(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* null, i8** %4
store i8* null, i8** %5
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %3
store i8* %9, i8** %5
br label %11
10: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %5
br label %11
11: ; preds = %10, %8
%12 = load i8*, i8** %5
%13 = call i8* @agent_message(i8* %12)
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %11
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %19
17: ; preds = %11
%18 = load i8*, i8** %4
store i8* %18, i8** %2
br label %19
19: ; preds = %17, %16
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @RL_agent_message(i8* %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %0
%4 = tail call i8* @agent_message(i8* %3)
%5 = icmp eq i8* %4, null
%6 = select i1 %5, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %4
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void print_usage(FILE *stream, char *name) {
  fprintf(stream,
          "Usage: %s [OPTIONS]\n\n"
          "Options:\n"
          "    -a --allow-anonymous\tAllow anonymous access\n"
          "    -b --basedn=\"dc=entente\"\tSet base distinguished name\n"
          "    -s --service=entente\tSet PAM service name\n"
          "    -i --bind=127.0.0.1\t\tSet bind address\n"
          "    -p --port=389\t\tSet server port\n"
          "    -w --workers=4\t\tSet number of workers\n"
          "    -d --daemonize\t\tRun as a daemon\n"
          "    -g --debug\t\t\tEnable debug mode\n"
          "    -h --help\t\t\tPrint this help\n",
          name);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [404 x i8] c"Usage: %s [OPTIONS]\0A\0AOptions:\0A -a --allow-anonymous\09Allow anonymous access\0A -b --basedn=\22dc=entente\22\09Set base distinguished name\0A -s --service=entente\09Set PAM service name\0A -i --bind=127.0.0.1\09\09Set bind address\0A -p --port=389\09\09Set server port\0A -w --workers=4\09\09Set number of workers\0A -d --daemonize\09\09Run as a daemon\0A -g --debug\09\09\09Enable debug mode\0A -h --help\09\09\09Print this help\0A\00"
define void @print_usage(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = load i8*, i8** %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([404 x i8], [404 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [404 x i8] c"Usage: %s [OPTIONS]\0A\0AOptions:\0A -a --allow-anonymous\09Allow anonymous access\0A -b --basedn=\22dc=entente\22\09Set base distinguished name\0A -s --service=entente\09Set PAM service name\0A -i --bind=127.0.0.1\09\09Set bind address\0A -p --port=389\09\09Set server port\0A -w --workers=4\09\09Set number of workers\0A -d --daemonize\09\09Run as a daemon\0A -g --debug\09\09\09Enable debug mode\0A -h --help\09\09\09Print this help\0A\00"
define void @print_usage(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([404 x i8], [404 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
double Sign(X)
double X;
{ return X >= 0. ? 1.0 : -1.0; }


x86 assembly (clang, -O0):
<Sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xeea(%rip),%xmm3
movsd  0xeea(%rip),%xmm2
xorps  %xmm0,%xmm0
cmplesd %xmm1,%xmm0
movaps %xmm0,%xmm1
andpd  %xmm3,%xmm1
andnpd %xmm2,%xmm0
orpd   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sign>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setae  %al
lea    0xeec(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
ret

LLVM IR (-O0):
define double @Sign(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp oge double %3, 0.000000e+00
%5 = zext i1 %4 to i64
%6 = select i1 %4, double 1.000000e+00, double -1.000000e+00
ret double %6
}

LLVM IR (-O2):
define double @Sign(double %0) {
%2 = fcmp oge double %0, 0.000000e+00
%3 = select i1 %2, double 1.000000e+00, double -1.000000e+00
ret double %3
}
void nand_write_address(unsigned long address) {
  unsigned long page_address = address >> 11;
  (*(volatile unsigned long *)(0x70200000 + 0x0c)) = 0;
  (*(volatile unsigned long *)(0x70200000 + 0x0c)) = 0;
  (*(volatile unsigned long *)(0x70200000 + 0x0c)) = (page_address)&0xff;
  (*(volatile unsigned long *)(0x70200000 + 0x0c)) = (page_address >> 8) & 0xff;
  (*(volatile unsigned long *)(0x70200000 + 0x0c)) =
      (page_address >> 16) & 0xff;
}


x86 assembly (clang, -O0):
<nand_write_address>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0xb,%rax
mov    %rax,-0x10(%rbp)
mov    $0x7020000c,%eax
movq   $0x0,(%rax)
mov    $0x7020000c,%eax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rcx
and    $0xff,%rcx
mov    $0x7020000c,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x8,%rcx
and    $0xff,%rcx
mov    $0x7020000c,%eax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x10,%rcx
and    $0xff,%rcx
mov    $0x7020000c,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nand_write_address>:
mov    %edi,%eax
shr    $0xb,%eax
movzbl %al,%eax
movq   $0x0,0x7020000c
movq   $0x0,0x7020000c
mov    %rax,0x7020000c
70
mov    %edi,%eax
shr    $0x13,%eax
movzbl %al,%eax
mov    %rax,0x7020000c
70
shr    $0x1b,%rdi
movzbl %dil,%eax
mov    %rax,0x7020000c
70
ret

LLVM IR (-O0):
define void @nand_write_address(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = lshr i64 %4, 11
store i64 %5, i64* %3
store volatile i64 0, i64* inttoptr (i64 1881145356 to i64*)
store volatile i64 0, i64* inttoptr (i64 1881145356 to i64*)
%6 = load i64, i64* %3
%7 = and i64 %6, 255
store volatile i64 %7, i64* inttoptr (i64 1881145356 to i64*)
%8 = load i64, i64* %3
%9 = lshr i64 %8, 8
%10 = and i64 %9, 255
store volatile i64 %10, i64* inttoptr (i64 1881145356 to i64*)
%11 = load i64, i64* %3
%12 = lshr i64 %11, 16
%13 = and i64 %12, 255
store volatile i64 %13, i64* inttoptr (i64 1881145356 to i64*)
ret void
}

LLVM IR (-O2):
define void @nand_write_address(i64 %0) {
%2 = lshr i64 %0, 11
store volatile i64 0, i64* inttoptr (i64 1881145356 to i64*)
store volatile i64 0, i64* inttoptr (i64 1881145356 to i64*)
%3 = and i64 %2, 255
store volatile i64 %3, i64* inttoptr (i64 1881145356 to i64*)
%4 = lshr i64 %0, 19
%5 = and i64 %4, 255
store volatile i64 %5, i64* inttoptr (i64 1881145356 to i64*)
%6 = lshr i64 %0, 27
%7 = and i64 %6, 255
store volatile i64 %7, i64* inttoptr (i64 1881145356 to i64*)
ret void
}
int printk(const char *format, ...) {
  int a;
  return a;
}


x86 assembly (clang, -O0):
<printk>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<printk>:
ret

LLVM IR (-O0):
define i32 @printk(i8* %0, ...) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i32, i32* %3
ret i32 %4
}

LLVM IR (-O2):
define i32 @printk(i8* nocapture readnone %0, ...) {
ret i32 undef
}
void insw(int port, void *addr, int cnt) {
  asm volatile("cld\n\trepne\n\tinsw"
               : "=D"(addr), "=c"(cnt)
               : "d"(port), "0"(addr), "1"(cnt)
               : "memory", "cc");
}


x86 assembly (clang, -O0):
<insw>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%ecx
cld
repnz insw (%dx),%es:(%rdi)
mov    %rdi,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<insw>:
mov    %edx,%ecx
mov    %edi,%edx
mov    %rsi,%rdi
cld
repnz insw (%dx),%es:(%rdi)
ret

LLVM IR (-O0):
define void @insw(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call { i8*, i32 } asm sideeffect "cld\0A\09repne\0A\09insw", "={di},={cx},{dx},0,1,~{memory},~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %7, i8* %8, i32 %9)
%11 = extractvalue { i8*, i32 } %10, 0
%12 = extractvalue { i8*, i32 } %10, 1
store i8* %11, i8** %5
store i32 %12, i32* %6
ret void
}

LLVM IR (-O2):
define void @insw(i32 %0, i8* %1, i32 %2) {
%4 = tail call { i8*, i32 } asm sideeffect "cld\0A\09repne\0A\09insw", "={di},={cx},{dx},0,1,~{memory},~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ initInterrupts();
int memsize();
int /*<<< orphan*/ printf(char *, ...);
void main(void) {
  int numberPages;
  initInterrupts();
  printf("\n");
  printf("Probing memory...\n");
  numberPages = memsize();
  printf("Memory size = %d pages * 4 Kbytes\n", numberPages);
  printf("Halting...\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <initInterrupts@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <memsize@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <initInterrupts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1070 <memsize@plt>
lea    0xe84(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea9(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [19 x i8] c"Probing memory...\0A\00"
@.str.2 = [35 x i8] c"Memory size = %d pages * 4 Kbytes\0A\00"
@.str.3 = [12 x i8] c"Halting...\0A\00"
define void @main() {
%1 = alloca i32
%2 = call i32 (...) @initInterrupts()
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (...) @memsize()
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [35 x i8] c"Memory size = %d pages * 4 Kbytes\0A\00"
@str = [18 x i8] c"Probing memory...\00"
@str.4 = [11 x i8] c"Halting...\00"
define void @main() {
%1 = tail call i32 (...) @initInterrupts()
%2 = tail call i32 @putchar(i32 10)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @memsize()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.4, i64 0, i64 0))
ret void
}