xunge/DecIR huggingface dataset:
void marquer_sommet(int *marques, int sommet) { marques[sommet] = 1; }


x86 assembly (clang, -O0):
<marquer_sommet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<marquer_sommet>:
movslq %esi,%rax
movl   $0x1,(%rdi,%rax,4)
ret

LLVM IR (-O0):
define void @marquer_sommet(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 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
store i32 1, i32* %8
ret void
}

LLVM IR (-O2):
define void @marquer_sommet(i32* nocapture writeonly %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
store i32 1, i32* %4
ret void
}
void wstrace(char *fmt, ...) {}


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

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

LLVM IR (-O0):
define void @wstrace(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @wstrace(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ islower(int);
void t_islower_0x89() {
  Assert_real((islower(137) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_islower.c",
              690, ("islower should be 0 for 0x89"));
}


x86 assembly (clang, -O0):
<t_islower_0x89>:
push   %rbp
mov    %rsp,%rbp
mov    $0x89,%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x2b2,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_islower_0x89>:
push   %rax
mov    $0x89,%edi
call   1030 <islower@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x2b2,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0x89\00"
define void @t_islower_0x89() {
%1 = call i64 @islower(i32 137)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 690, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_islower.c\00"
@.str.1 = [29 x i8] c"islower should be 0 for 0x89\00"
define void @t_islower_0x89() {
%1 = tail call i64 @islower(i32 137)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 690, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HplAtm128InterruptPinP__4__IrqSignal__fired();
void HplAtm128InterruptSigP__IntSig4__fired(void) {
  HplAtm128InterruptPinP__4__IrqSignal__fired();
}


x86 assembly (clang, -O0):
<HplAtm128InterruptSigP__IntSig4__fired>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <HplAtm128InterruptPinP__4__IrqSignal__fired@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HplAtm128InterruptSigP__IntSig4__fired>:
xor    %eax,%eax
jmp    1030 <HplAtm128InterruptPinP__4__IrqSignal__fired@plt>

LLVM IR (-O0):
define void @HplAtm128InterruptSigP__IntSig4__fired() {
%1 = call i32 (...) @HplAtm128InterruptPinP__4__IrqSignal__fired()
ret void
}

LLVM IR (-O2):
define void @HplAtm128InterruptSigP__IntSig4__fired() {
%1 = tail call i32 (...) @HplAtm128InterruptPinP__4__IrqSignal__fired()
ret void
}
int ms_is_littleendian() {
  int x = 1;
  int result;
  if (*(char *)&x == 1)
    result = 1;
  else
    result = 0;
  return result;
}


x86 assembly (clang, -O0):
<ms_is_littleendian>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
movsbl -0x4(%rbp),%eax
cmp    $0x1,%eax
jne    1124 <ms_is_littleendian+0x24>
movl   $0x1,-0x8(%rbp)
jmp    112b <ms_is_littleendian+0x2b>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ms_is_littleendian() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
%3 = bitcast i32* %1 to i8*
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 1, i32* %2
br label %9
8: ; preds = %0
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @ms_is_littleendian() {
ret i32 1
}
void transform_coord(unsigned long i, unsigned long *cella,
                     unsigned int *mask) {
  *cella = i / (sizeof(unsigned int) * 8);
  *mask = 1L << (i % (sizeof(unsigned int) * 8));
}


x86 assembly (clang, -O0):
<transform_coord>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rcx
shr    $0x5,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rcx
and    $0x1f,%rcx
mov    $0x1,%eax
shl    %cl,%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<transform_coord>:
mov    %rdi,%rcx
mov    %rdi,%rax
shr    $0x5,%rax
mov    %rax,(%rsi)
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @transform_coord(i64 %0, i64* %1, i32* %2) {
%4 = alloca i64
%5 = alloca i64*
%6 = alloca i32*
store i64 %0, i64* %4
store i64* %1, i64** %5
store i32* %2, i32** %6
%7 = load i64, i64* %4
%8 = udiv i64 %7, 32
%9 = load i64*, i64** %5
store i64 %8, i64* %9
%10 = load i64, i64* %4
%11 = urem i64 %10, 32
%12 = shl i64 1, %11
%13 = trunc i64 %12 to i32
%14 = load i32*, i32** %6
store i32 %13, i32* %14
ret void
}

LLVM IR (-O2):
define void @transform_coord(i64 %0, i64* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = lshr i64 %0, 5
store i64 %4, i64* %1
%5 = and i64 %0, 31
%6 = shl nuw nsw i64 1, %5
%7 = trunc i64 %6 to i32
store i32 %7, i32* %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ add_job(int /*<<< orphan*/, int, char *, int);
int find_job(int /*<<< orphan*/);
int /*<<< orphan*/ update_job(int /*<<< orphan*/, int);
void move_to_background(pid_t pgid, int state, char *command, int len) {
  int jid = find_job(pgid);
  if (jid < 0)
    add_job(pgid, state, command, len);
  else
    update_job(pgid, state);
}


x86 assembly (clang, -O0):
<move_to_background>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <find_job@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1171 <move_to_background+0x41>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <add_job@plt>
jmp    117c <move_to_background+0x4c>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <update_job@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_to_background>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %esi,%ebp
mov    %edi,%ebx
call   1040 <find_job@plt>
mov    %ebx,%edi
mov    %ebp,%esi
test   %eax,%eax
js     115d <move_to_background+0x2d>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <update_job@plt>
mov    %r15,%rdx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <add_job@plt>

LLVM IR (-O0):
define void @move_to_background(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = call i32 @find_job(i32 %10)
store i32 %11, i32* %9
%12 = load i32, i32* %9
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %4
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = load i8*, i8** %7
%18 = load i32, i32* %8
%19 = call i32 @add_job(i32 %15, i32 %16, i8* %17, i32 %18)
br label %24
20: ; preds = %4
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = call i32 @update_job(i32 %21, i32 %22)
br label %24
24: ; preds = %20, %14
ret void
}

LLVM IR (-O2):
define void @move_to_background(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 @find_job(i32 %0)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @add_job(i32 %0, i32 %1, i8* %2, i32 %3)
br label %11
9: ; preds = %4
%10 = tail call i32 @update_job(i32 %0, i32 %1)
br label %11
11: ; preds = %9, %7
ret void
}
/* Variables and functions */
size_t strlen(char const *);
int /*<<< orphan*/ strncmp(char const *, char const *, size_t);
int strbeginswith(const char *string, const char *what) {
  size_t string_len = strlen(string), what_len = strlen(what);
  if (string_len < what_len) {
    return 0;
  }
  return !strncmp(string, what, what_len);
}


x86 assembly (clang, -O0):
<strbeginswith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1164 <strbeginswith+0x44>
movl   $0x0,-0x4(%rbp)
jmp    1185 <strbeginswith+0x65>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strbeginswith>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rax,%rdx
xor    %eax,%eax
cmp    %rdx,%rbx
jb     1159 <strbeginswith+0x39>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <strncmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @strbeginswith(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
store i64 %9, i64* %6
%10 = load i8*, i8** %5
%11 = call i64 @strlen(i8* %10)
store i64 %11, i64* %7
%12 = load i64, i64* %6
%13 = load i64, i64* %7
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 0, i32* %3
br label %24
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = load i8*, i8** %5
%19 = load i64, i64* %7
%20 = call i32 @strncmp(i8* %17, i8* %18, i64 %19)
%21 = icmp ne i32 %20, 0
%22 = xor i1 %21, true
%23 = zext i1 %22 to i32
store i32 %23, i32* %3
br label %24
24: ; preds = %16, %15
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @strbeginswith(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp ult i64 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i32 @strncmp(i8* %0, i8* %1, i64 %4)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %2, %6
%11 = phi i32 [ %9, %6 ], [ 0, %2 ]
ret i32 %11
}
/* Variables and functions */
char *if_indextoname(int, char *);
char *index_to_port_name(int index, char *name) {
  return if_indextoname(index, name);
}


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

x86 assembly (clang, -O2):
<index_to_port_name>:
jmp    1030 <if_indextoname@plt>

LLVM IR (-O0):
define i8* @index_to_port_name(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 i8* @if_indextoname(i32 %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @index_to_port_name(i32 %0, i8* %1) {
%3 = tail call i8* @if_indextoname(i32 %0, i8* %1)
ret i8* %3
}
/* Type definitions */
struct aFILE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _get_actual_fp(struct aFILE *);
int /*<<< orphan*/ setbuffer(int /*<<< orphan*/, char *, int);
void my_setbuffer(struct aFILE *fp, char *buf, int size) {
  setbuffer(_get_actual_fp(fp), buf, size);
}


x86 assembly (clang, -O0):
<my_setbuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <_get_actual_fp@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <setbuffer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_setbuffer>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <_get_actual_fp@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <setbuffer@plt>

LLVM IR (-O0):
%struct.aFILE = type { i32 }
define void @my_setbuffer(%struct.aFILE* %0, i8* %1, i32 %2) {
%4 = alloca %struct.aFILE*
%5 = alloca i8*
%6 = alloca i32
store %struct.aFILE* %0, %struct.aFILE** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.aFILE*, %struct.aFILE** %4
%8 = call i32 @_get_actual_fp(%struct.aFILE* %7)
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @setbuffer(i32 %8, i8* %9, i32 %10)
ret void
}

LLVM IR (-O2):
%struct.aFILE = type { i32 }
define void @my_setbuffer(%struct.aFILE* %0, i8* %1, i32 %2) {
%4 = tail call i32 @_get_actual_fp(%struct.aFILE* %0)
%5 = tail call i32 @setbuffer(i32 %4, i8* %1, i32 %2)
ret void
}
char *basename(char *fname) { return fname; }


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

x86 assembly (clang, -O2):
<basename>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @basename(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void do_exit(void) { exit(EXIT_FAILURE); }


x86 assembly (clang, -O0):
<do_exit>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<do_exit>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @do_exit() {
%1 = load i32, i32* @EXIT_FAILURE
%2 = call i32 @exit(i32 %1)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @do_exit() {
%1 = load i32, i32* @EXIT_FAILURE
%2 = tail call i32 @exit(i32 %1)
unreachable
}
void INT_Excep_LVD2_LVD2(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_LVD2_LVD2() {
ret void
}
int test9(void) {
  int i, sum = 0;
  char tab[10];
  for (i = 0; i < 11; i++) {
    sum += tab[i];
  }
  return sum;
}


x86 assembly (clang, -O0):
<test9>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0xb,-0x4(%rbp)
jge    1139 <test9+0x39>
movslq -0x4(%rbp),%rax
movsbl -0x12(%rbp,%rax,1),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <test9+0x12>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test9() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i8]
store i32 0, i32* %2
store i32 0, i32* %1
br label %4
4: ; preds = %15, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 11
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = load i32, i32* %1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = load i32, i32* %2
%14 = add nsw i32 %13, %12
store i32 %14, i32* %2
br label %15
15: ; preds = %7
%16 = load i32, i32* %1
%17 = add nsw i32 %16, 1
store i32 %17, i32* %1
br label %4
18: ; preds = %4
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @test9() {
ret i32 poison
}
int Hash(s, mod)
register char *s;
int mod;
{
  register int h = 0;
  while (*s)
    h += (unsigned)*s++;
  return h % mod;
}


x86 assembly (clang, -O0):
<Hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113c <Hash+0x3c>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <Hash+0x12>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1122 <Hash+0x22>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <Hash+0x10>
jmp    1124 <Hash+0x24>
xor    %eax,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @Hash(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %10, %2
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = sext i8 %13 to i32
%15 = load i32, i32* %5
%16 = add i32 %15, %14
store i32 %16, i32* %5
br label %6
17: ; preds = %6
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = srem i32 %18, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @Hash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %12, %5 ], [ %3, %2 ]
%7 = phi i32 [ %11, %5 ], [ 0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = sext i8 %6 to i32
%11 = add i32 %7, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %2
%15 = phi i32 [ 0, %2 ], [ %11, %5 ]
%16 = srem i32 %15, %1
ret i32 %16
}
int sign(int x) { return (x > 0) - (x < 0); }


x86 assembly (clang, -O0):
<sign>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
cmpl   $0x0,-0x4(%rbp)
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign>:
xor    %eax,%eax
test   %edi,%edi
setg   %al
sar    $0x1f,%edi
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @sign(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
%5 = zext i1 %4 to i32
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 0
%8 = zext i1 %7 to i32
%9 = sub nsw i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @sign(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = zext i1 %2 to i32
%4 = ashr i32 %0, 31
%5 = add nsw i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int numbers[10];
  for (int i = 0; 1; i++) {
    printf("%d\n", i);
    numbers[i] = i;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    113c <main+0x2c>
jmp    1164 <main+0x54>
mov    -0x44(%rbp),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x44(%rbp),%ecx
movslq -0x44(%rbp),%rax
mov    %ecx,-0x40(%rbp,%rax,4)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    112d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
br label %8
8: ; preds = %16, %2
br i1 true, label %9, label %19
9: ; preds = %8
%10 = load i32, i32* %7
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %7
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 %14
store i32 %12, i32* %15
br label %16
16: ; preds = %9
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
br label %8
19: ; preds = %8
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 0, %2 ], [ %6, %3 ]
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = add nuw nsw i32 %4, 1
br label %3
}
/* Variables and functions */
long long __builtin_wasm_trunc_s_i64_f32(float);
long long trunc_s_i64_f32(float f) { return __builtin_wasm_trunc_s_i64_f32(f); }


x86 assembly (clang, -O0):
<trunc_s_i64_f32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <__builtin_wasm_trunc_s_i64_f32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trunc_s_i64_f32>:
jmp    1030 <__builtin_wasm_trunc_s_i64_f32@plt>

LLVM IR (-O0):
define i64 @trunc_s_i64_f32(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @__builtin_wasm_trunc_s_i64_f32(float %3)
ret i64 %4
}

LLVM IR (-O2):
define i64 @trunc_s_i64_f32(float %0) {
%2 = tail call i64 @__builtin_wasm_trunc_s_i64_f32(float %0)
ret i64 %2
}
/* Variables and functions */
long labs(long);
int main() { return !(labs(-15L) == 15L); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xfffffffffffffff1,%rdi
call   1030 <labs@plt>
cmp    $0xf,%rax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @labs(i64 -15)
%3 = icmp eq i64 %2, 15
%4 = xor i1 %3, true
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ serial_putc(int /*<<< orphan*/);
void serial_puts(char *s) {
  while (*s)
    serial_putc(*s++);
}


x86 assembly (clang, -O0):
<serial_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <serial_puts+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <serial_putc@plt>
jmp    111c <serial_puts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <serial_puts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <serial_putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <serial_puts+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @serial_puts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = call i32 @serial_putc(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @serial_puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @serial_putc(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int main() {
  puts("Hello world.");
  int x = 5;
  int y = x + 1;
  printf("%i", y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
mov    $0x6,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world.\00"
@.str.1 = [3 x i8] c"%i\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32 5, i32* %1
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello world.\00"
@.str.1 = [3 x i8] c"%i\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 6)
ret i32 0
}
/* Variables and functions */
scalar_t__ RAND_MAX;
int myRand();
int randBool(void) { return myRand() < (int)RAND_MAX / 2; }


x86 assembly (clang, -O0):
<randBool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <myRand@plt>
mov    %eax,-0x4(%rbp)
mov    0x2ebf(%rip),%rax
mov    (%rax),%rax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
cmp    %ecx,%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randBool>:
push   %rax
xor    %eax,%eax
call   1030 <myRand@plt>
mov    0x2ec9(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %ecx,%edx
sar    %edx
xor    %ecx,%ecx
cmp    %edx,%eax
setl   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define i32 @randBool() {
%1 = call i32 (...) @myRand()
%2 = load i64, i64* @RAND_MAX
%3 = trunc i64 %2 to i32
%4 = sdiv i32 %3, 2
%5 = icmp slt i32 %1, %4
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define i32 @randBool() {
%1 = tail call i32 (...) @myRand()
%2 = load i64, i64* @RAND_MAX
%3 = trunc i64 %2 to i32
%4 = sdiv i32 %3, 2
%5 = icmp slt i32 %1, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
void INT_Excep_MTU0_TGIF0(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_MTU0_TGIF0() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ analyse_param_tracyWidom(int, char **, char *, char *);
int /*<<< orphan*/ tracyWidom(char *, char *);
int main(int argc, char *argv[]) {
  char input_file[512];
  char output_file[512] = "";
  analyse_param_tracyWidom(argc, argv, input_file, output_file);
  tracyWidom(input_file, output_file);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x210(%rbp),%rdx
lea    -0x410(%rbp),%rcx
call   1050 <analyse_param_tracyWidom@plt>
lea    -0x210(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <tracyWidom@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsp,%r14
mov    $0x200,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0x200(%rsp),%r15
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1050 <analyse_param_tracyWidom@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <tracyWidom@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [512 x i8]
%7 = alloca [512 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [512 x i8]* %7 to i8*
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%13 = call i32 @analyse_param_tracyWidom(i32 %9, i8** %10, i8* %11, i8* %12)
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%16 = call i32 @tracyWidom(i8* %14, i8* %15)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [512 x i8]
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%7 = call i32 @analyse_param_tracyWidom(i32 %0, i8** %1, i8* %5, i8* %6)
%8 = call i32 @tracyWidom(i8* %5, i8* %6)
ret i32 0
}
int test_nested2(int FOObarbaz) { return FOObarbaz; }


x86 assembly (clang, -O0):
<test_nested2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_nested2>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @test_nested2(i32 returned %0) {
ret i32 %0
}
unsigned long dsi_get_pll_hsdiv_dispc_rate(void) {
  WARN("%s: DSI not compiled in, returning rate as 0\n", __func__);
  return 0;
}


x86 assembly (clang, -O0):
<dsi_get_pll_hsdiv_dispc_rate>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xf0c(%rip),%rsi
mov    $0x0,%al
call   1030 <WARN@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dsi_get_pll_hsdiv_dispc_rate>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xf0f(%rip),%rsi
xor    %eax,%eax
call   1030 <WARN@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"%s: DSI not compiled in, returning rate as 0\0A\00"
@__func__.dsi_get_pll_hsdiv_dispc_rate = [29 x i8] c"dsi_get_pll_hsdiv_dispc_rate\00"
define i64 @dsi_get_pll_hsdiv_dispc_rate() {
%1 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @WARN to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @__func__.dsi_get_pll_hsdiv_dispc_rate, i64 0, i64 0))
ret i64 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"%s: DSI not compiled in, returning rate as 0\0A\00"
@__func__.dsi_get_pll_hsdiv_dispc_rate = [29 x i8] c"dsi_get_pll_hsdiv_dispc_rate\00"
define i64 @dsi_get_pll_hsdiv_dispc_rate() {
%1 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @WARN to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @__func__.dsi_get_pll_hsdiv_dispc_rate, i64 0, i64 0))
ret i64 0
}
/* Type definitions */
typedef size_t int32_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
size_t recv(int, char *, int, int /*<<< orphan*/);
int32_t receive_from_server(int sock, char *packet) {
  int32_t pktlen;
  if ((pktlen = recv(sock, packet, 65530 - 1, 0)) <= 0) {
    printf("receive_from_server(): failure");
    exit(1);
  }
  packet[pktlen] = 0;
  return pktlen;
}


x86 assembly (clang, -O0):
<receive_from_server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0xfff9,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
ja     1176 <receive_from_server+0x46>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<receive_from_server>:
push   %rbx
mov    %rsi,%rbx
mov    $0xfff9,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %rax,%rax
je     114b <receive_from_server+0x1b>
movb   $0x0,(%rbx,%rax,1)
pop    %rbx
ret
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"receive_from_server(): failure\00"
define i64 @receive_from_server(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
%7 = load i8*, i8** %4
%8 = call i64 @recv(i32 %6, i8* %7, i32 65529, i32 0)
store i64 %8, i64* %5
%9 = icmp ule i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = load i64, i64* %5
%16 = getelementptr inbounds i8, i8* %14, i64 %15
store i8 0, i8* %16
%17 = load i64, i64* %5
ret i64 %17
}

LLVM IR (-O2):
@.str = [31 x i8] c"receive_from_server(): failure\00"
define i64 @receive_from_server(i32 %0, i8* %1) {
%3 = tail call i64 @recv(i32 %0, i8* %1, i32 65529, i32 0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %1, i64 %3
store i8 0, i8* %9
ret i64 %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void QEIDisable(uint32_t ui32Base) {
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) &= ~(0x00000001);
}


x86 assembly (clang, -O0):
<QEIDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIDisable>:
movslq %edi,%rax
andl   $0xfffffffe,(%rax)
ret

LLVM IR (-O0):
define void @QEIDisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 0
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, -2
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @QEIDisable(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i32*
%4 = load volatile i32, i32* %3
%5 = and i32 %4, -2
store volatile i32 %5, i32* %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
void read_aout_data(char *buf, int size, FILE *f) {
  if (size <= 0)
    return;
  fread(buf, size, 1, f);
}


x86 assembly (clang, -O0):
<read_aout_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1132 <read_aout_data+0x22>
jmp    1147 <read_aout_data+0x37>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fread@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_aout_data>:
test   %esi,%esi
jle    1121 <read_aout_data+0x11>
mov    %rdx,%rcx
mov    $0x1,%edx
jmp    1030 <fread@plt>
ret

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

LLVM IR (-O2):
define void @read_aout_data(i8* nocapture %0, i32 %1, i32* nocapture %2) {
%4 = icmp slt i32 %1, 1
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @fread(i8* %0, i32 %1, i32 1, i32* %2)
br label %7
7: ; preds = %3, %5
ret void
}
char comps_set_index_cmp(void *item1, void *item2) {
  return *(unsigned int *)item1 == *(unsigned int *)item2;
}


x86 assembly (clang, -O0):
<comps_set_index_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<comps_set_index_cmp>:
mov    (%rdi),%eax
cmp    (%rsi),%eax
sete   %al
ret

LLVM IR (-O0):
define signext i8 @comps_set_index_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = icmp eq i32 %7, %10
%12 = zext i1 %11 to i32
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
define signext i8 @comps_set_index_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp eq i32 %4, %6
%8 = zext i1 %7 to i8
ret i8 %8
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
void gpio_odr(uint32_t *port, uint8_t pins, uint8_t state) {
  if (state)
    port[0x50C / 4] |= pins;
  else
    port[0x50C / 4] &= ~((uint32_t)pins);
}


x86 assembly (clang, -O0):
<gpio_odr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1136 <gpio_odr+0x36>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
or     0xa18(%rax),%rcx
mov    %rcx,0xa18(%rax)
jmp    1150 <gpio_odr+0x50>
mov    -0x10(%rbp),%rcx
xor    $0xffffffffffffffff,%rcx
mov    -0x8(%rbp),%rax
and    0xa18(%rax),%rcx
mov    %rcx,0xa18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_odr>:
test   %rdx,%rdx
je     110d <gpio_odr+0xd>
or     %rsi,0xa18(%rdi)
ret
not    %rsi
and    %rsi,0xa18(%rdi)
ret

LLVM IR (-O0):
define void @gpio_odr(i64* %0, i64 %1, i64 %2) {
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
store i64* %0, i64** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = load i64, i64* %5
%11 = load i64*, i64** %4
%12 = getelementptr inbounds i64, i64* %11, i64 323
%13 = load i64, i64* %12
%14 = or i64 %13, %10
store i64 %14, i64* %12
br label %22
15: ; preds = %3
%16 = load i64, i64* %5
%17 = xor i64 %16, -1
%18 = load i64*, i64** %4
%19 = getelementptr inbounds i64, i64* %18, i64 323
%20 = load i64, i64* %19
%21 = and i64 %20, %17
store i64 %21, i64* %19
br label %22
22: ; preds = %15, %9
ret void
}

LLVM IR (-O2):
define void @gpio_odr(i64* nocapture %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = getelementptr inbounds i64, i64* %0, i64 323
%7 = load i64, i64* %6
%8 = or i64 %7, %1
store i64 %8, i64* %6
br label %14
9: ; preds = %3
%10 = xor i64 %1, -1
%11 = getelementptr inbounds i64, i64* %0, i64 323
%12 = load i64, i64* %11
%13 = and i64 %12, %10
store i64 %13, i64* %11
br label %14
14: ; preds = %9, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ touchmanager_button_detach_all();
int /*<<< orphan*/ touchmanager_grid_detach_all();
void touchmanager_detach_all() {
  touchmanager_button_detach_all();
  touchmanager_grid_detach_all();
}


x86 assembly (clang, -O0):
<touchmanager_detach_all>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <touchmanager_button_detach_all@plt>
mov    $0x0,%al
call   1040 <touchmanager_grid_detach_all@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<touchmanager_detach_all>:
push   %rax
xor    %eax,%eax
call   1030 <touchmanager_button_detach_all@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <touchmanager_grid_detach_all@plt>

LLVM IR (-O0):
define void @touchmanager_detach_all() {
%1 = call i32 (...) @touchmanager_button_detach_all()
%2 = call i32 (...) @touchmanager_grid_detach_all()
ret void
}

LLVM IR (-O2):
define void @touchmanager_detach_all() {
%1 = tail call i32 (...) @touchmanager_button_detach_all()
%2 = tail call i32 (...) @touchmanager_grid_detach_all()
ret void
}
/* Variables and functions */
int rom_present(char *);
int im1024_available() {
  return rom_present(L"roms/video/im1024/im1024font.bin");
}


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

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

LLVM IR (-O0):
@.str = [33 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 105, i32 109, i32 49, i32 48, i32 50, i32 52, i32 47, i32 105, i32 109, i32 49, i32 48, i32 50, i32 52, i32 102, i32 111, i32 110, i32 116, i32 46, i32 98, i32 105, i32 110, i32 0]
define i32 @im1024_available() {
%1 = call i32 @rom_present(i8* bitcast ([33 x i32]* @.str to i8*))
ret i32 %1
}

LLVM IR (-O2):
@.str = [33 x i32] [i32 114, i32 111, i32 109, i32 115, i32 47, i32 118, i32 105, i32 100, i32 101, i32 111, i32 47, i32 105, i32 109, i32 49, i32 48, i32 50, i32 52, i32 47, i32 105, i32 109, i32 49, i32 48, i32 50, i32 52, i32 102, i32 111, i32 110, i32 116, i32 46, i32 98, i32 105, i32 110, i32 0]
define i32 @im1024_available() {
%1 = tail call i32 @rom_present(i8* bitcast ([33 x i32]* @.str to i8*))
ret i32 %1
}
/* Variables and functions */
scalar_t__ mock(char *);
char *cf_s_history(char *s) { return (char *)mock(s); }


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

x86 assembly (clang, -O2):
<cf_s_history>:
jmp    1030 <mock@plt>

LLVM IR (-O0):
define i8* @cf_s_history(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mock(i8* %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @cf_s_history(i8* %0) {
%2 = tail call i64 @mock(i8* %0)
%3 = inttoptr i64 %2 to i8*
ret i8* %3
}
/* Variables and functions */
double __ieee754_y0(double);
double y0(double x) { return __ieee754_y0(x); }


x86 assembly (clang, -O0):
<y0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <__ieee754_y0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<y0>:
jmp    1030 <__ieee754_y0@plt>

LLVM IR (-O0):
define double @y0(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @__ieee754_y0(double %3)
ret double %4
}

LLVM IR (-O2):
define double @y0(double %0) {
%2 = tail call double @__ieee754_y0(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
size_t align_up(size_t x, size_t align) {
  assert(0 == (align & (align - 1)));
  return (x + (align - 1)) & ~(align - 1);
}


x86 assembly (clang, -O0):
<align_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
and    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<align_up>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    -0x1(%rsi),%rax
xor    %edi,%edi
test   %rax,%rsi
sete   %dil
call   1030 <assert@plt>
lea    (%r14,%rbx,1),%rax
add    $0xffffffffffffffff,%rax
neg    %rbx
and    %rax,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @align_up(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %4
%7 = sub i64 %6, 1
%8 = and i64 %5, %7
%9 = icmp eq i64 0, %8
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i64, i64* %3
%13 = load i64, i64* %4
%14 = sub i64 %13, 1
%15 = add i64 %12, %14
%16 = load i64, i64* %4
%17 = sub i64 %16, 1
%18 = xor i64 %17, -1
%19 = and i64 %15, %18
ret i64 %19
}

LLVM IR (-O2):
define i64 @align_up(i64 %0, i64 %1) {
%3 = tail call i64 @llvm.ctpop.i64(i64 %1)
%4 = icmp ult i64 %3, 2
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = add i64 %0, -1
%8 = add i64 %7, %1
%9 = sub i64 0, %1
%10 = and i64 %8, %9
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void fig06_06() {
  int a[12] = {1, 3, 5, 4, 7, 2, 99, 16, 45, 67, 89, 45};
  size_t i;
  int total = 0;
  for (i = 0; i < 12; ++i) {
    total += a[i];
  }
  printf("Total of array element value is %d\n", total);
}


x86 assembly (clang, -O0):
<fig06_06>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x30,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x3c(%rbp)
movq   $0x0,-0x38(%rbp)
cmpq   $0xc,-0x38(%rbp)
jae    1176 <fig06_06+0x56>
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    114c <fig06_06+0x2c>
mov    -0x3c(%rbp),%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fig06_06>:
lea    0xee9(%rip),%rdi
mov    $0x17f,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@__const.fig06_06.a = [12 x i32] [i32 1, i32 3, i32 5, i32 4, i32 7, i32 2, i32 99, i32 16, i32 45, i32 67, i32 89, i32 45]
@.str = [36 x i8] c"Total of array element value is %d\0A\00"
define void @fig06_06() {
%1 = alloca [12 x i32]
%2 = alloca i64
%3 = alloca i32
%4 = bitcast [12 x i32]* %1 to i8*
store i32 0, i32* %3
store i64 0, i64* %2
br label %5
5: ; preds = %14, %0
%6 = load i64, i64* %2
%7 = icmp ult i64 %6, 12
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i64, i64* %2
%10 = getelementptr inbounds [12 x i32], [12 x i32]* %1, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = load i32, i32* %3
%13 = add nsw i32 %12, %11
store i32 %13, i32* %3
br label %14
14: ; preds = %8
%15 = load i64, i64* %2
%16 = add i64 %15, 1
store i64 %16, i64* %2
br label %5
17: ; preds = %5
%18 = load i32, i32* %3
%19 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %18)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"Total of array element value is %d\0A\00"
define void @fig06_06() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 383)
ret void
}