xunge/DecIR huggingface dataset:
void foo_1_2_2_1_1_1_1_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_2_1_1_1_1_2_1() {
ret void
}
/* Variables and functions */
scalar_t__ COND_EQ();
int /*<<< orphan*/ EA_AL_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_seq_8_al(void) { m68ki_write_8(EA_AL_8(), COND_EQ() ? 0xff : 0); }


x86 assembly (clang, -O0):
<m68k_op_seq_8_al>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <EA_AL_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <COND_EQ@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_seq_8_al>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1030 <EA_AL_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <COND_EQ@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_seq_8_al() {
%1 = call i32 (...) @EA_AL_8()
%2 = call i64 (...) @COND_EQ()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_seq_8_al() {
%1 = tail call i32 (...) @EA_AL_8()
%2 = tail call i64 (...) @COND_EQ()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
/* Variables and functions */
int getch();
int /*<<< orphan*/ ui_message(char *, char const *);
int ui_confirm(const char *message) {
  ui_message("%s (Y/N)", message);
  switch (getch()) {
  case 'y':
  case 'Y':
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<ui_confirm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <ui_message@plt>
xor    %eax,%eax
call   1030 <getch@plt>
or     $0x20,%eax
sub    $0x79,%eax
je     1154 <ui_confirm+0x34>
jmp    1160 <ui_confirm+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1167 <ui_confirm+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ui_confirm>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <ui_message@plt>
xor    %eax,%eax
call   1030 <getch@plt>
and    $0xffffffdf,%eax
xor    %ecx,%ecx
cmp    $0x59,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%s (Y/N)\00"
define i32 @ui_confirm(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @ui_message(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @getch()
switch i32 %6, label %8 [
i32 121, label %7
i32 89, label %7
]
7: ; preds = %1, %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s (Y/N)\00"
define i32 @ui_confirm(i8* %0) {
%2 = tail call i32 @ui_message(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (...) @getch()
%4 = and i32 %3, -33
%5 = icmp eq i32 %4, 89
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int ustime();
int64_t mstime(void) { return ustime() / 1000; }


x86 assembly (clang, -O0):
<mstime>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <ustime@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<mstime>:
push   %rax
xor    %eax,%eax
call   1030 <ustime@plt>
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @mstime() {
%1 = call i32 (...) @ustime()
%2 = sdiv i32 %1, 1000
ret i32 %2
}

LLVM IR (-O2):
define i32 @mstime() {
%1 = tail call i32 (...) @ustime()
%2 = sdiv i32 %1, 1000
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main() {
  int a = 3;
  int b = 5;
  int c = 12;
  float as = (a + b + c) / 3.0;
  printf("The arithmetic mean is %2.f\n", as);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
movl   $0xc,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xeb7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"The arithmetic mean is %2.f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 0, i32* %1
store i32 3, i32* %2
store i32 5, i32* %3
store i32 12, i32* %4
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
%9 = load i32, i32* %4
%10 = add nsw i32 %8, %9
%11 = sitofp i32 %10 to double
%12 = fdiv double %11, 3.000000e+00
%13 = fptrunc double %12 to float
store float %13, float* %5
%14 = load float, float* %5
%15 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), float %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"The arithmetic mean is %2.f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), float 0x401AAAAAA0000000)
ret i32 0
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
struct list *list_alloc_item(void *);
struct list *list_prepend_item(struct list *, struct list *);
struct list *list_prepend_data(struct list *list, void *data) {
  struct list *item = NULL;
  item = list_alloc_item(data);
  if (item) {
    item = list_prepend_item(list, item);
  }
  return item;
}


x86 assembly (clang, -O0):
<list_prepend_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <list_alloc_item@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1161 <list_prepend_data+0x41>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <list_prepend_item@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_prepend_data>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <list_alloc_item@plt>
test   %rax,%rax
je     113d <list_prepend_data+0x1d>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <list_prepend_item@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.list = type { i32 }
define %struct.list* @list_prepend_data(%struct.list* %0, i8* %1) {
%3 = alloca %struct.list*
%4 = alloca i8*
%5 = alloca %struct.list*
store %struct.list* %0, %struct.list** %3
store i8* %1, i8** %4
store %struct.list* null, %struct.list** %5
%6 = load i8*, i8** %4
%7 = call %struct.list* @list_alloc_item(i8* %6)
store %struct.list* %7, %struct.list** %5
%8 = load %struct.list*, %struct.list** %5
%9 = icmp ne %struct.list* %8, null
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load %struct.list*, %struct.list** %3
%12 = load %struct.list*, %struct.list** %5
%13 = call %struct.list* @list_prepend_item(%struct.list* %11, %struct.list* %12)
store %struct.list* %13, %struct.list** %5
br label %14
14: ; preds = %10, %2
%15 = load %struct.list*, %struct.list** %5
ret %struct.list* %15
}

LLVM IR (-O2):
%struct.list = type { i32 }
define %struct.list* @list_prepend_data(%struct.list* %0, i8* %1) {
%3 = tail call %struct.list* @list_alloc_item(i8* %1)
%4 = icmp eq %struct.list* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call %struct.list* @list_prepend_item(%struct.list* %0, %struct.list* %3)
br label %7
7: ; preds = %5, %2
%8 = phi %struct.list* [ %6, %5 ], [ null, %2 ]
ret %struct.list* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cls0(void) { printf("\033[2J"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[2J\00"
define void @cls0() {
%1 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[2J\00"
define void @cls0() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bmount(char *);
int /*<<< orphan*/ bumount(char *);
int /*<<< orphan*/ mi_unlink(char *);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  bmount("prova");
  printf("Es borrarà %s, n'està segur? (S/N) \n", argv[1]);
  mi_unlink(argv[1]);
  bumount("prova");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeaa(%rip),%rdi
call   1050 <bmount@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <mi_unlink@plt>
lea    0xe7d(%rip),%rdi
call   1040 <bumount@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
lea    0xeb2(%rip),%r14
mov    %r14,%rdi
call   1050 <bmount@plt>
mov    0x8(%rbx),%rsi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%rdi
call   1060 <mi_unlink@plt>
mov    %r14,%rdi
call   1040 <bumount@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"prova\00"
@.str.1 = [39 x i8] c"Es borrar\C3\A0 %s, n'est\C3\A0 segur? (S/N) \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @bmount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i8**, i8*** %4
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @mi_unlink(i8* %12)
%14 = call i32 @bumount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"prova\00"
@.str.1 = [39 x i8] c"Es borrar\C3\A0 %s, n'est\C3\A0 segur? (S/N) \0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @bmount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %4
%8 = tail call i32 @mi_unlink(i8* %7)
%9 = tail call i32 @bumount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void _mosquitto_free(void *mem) { free(mem); }


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

x86 assembly (clang, -O2):
<_mosquitto_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @_mosquitto_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
unsigned givehtsz(unsigned mnf) {
  unsigned htsz = 2 * mnf / 3;
  if (!(htsz % 5))
    htsz++;
  if (!(htsz % 3))
    htsz++;
  if (!(htsz % 2))
    htsz++;
  return htsz;
}


x86 assembly (clang, -O0):
<givehtsz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    1137 <givehtsz+0x37>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    1155 <givehtsz+0x55>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    116d <givehtsz+0x6d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<givehtsz>:
lea    (%rdi,%rdi,1),%eax
mov    $0xaaaaaaab,%ecx
imul   %rax,%rcx
shr    $0x21,%rcx
imul   $0xcccccccd,%ecx,%eax
cmp    $0x33333334,%eax
adc    $0x0,%ecx
imul   $0xaaaaaaab,%ecx,%eax
cmp    $0x55555556,%eax
adc    $0x0,%ecx
mov    %ecx,%eax
not    %eax
and    $0x1,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @givehtsz(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = mul i32 2, %4
%6 = udiv i32 %5, 3
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = urem i32 %7, 5
%9 = icmp ne i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %1
%11 = load i32, i32* %3
%12 = add i32 %11, 1
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %1
%14 = load i32, i32* %3
%15 = urem i32 %14, 3
%16 = icmp ne i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %13
%18 = load i32, i32* %3
%19 = add i32 %18, 1
store i32 %19, i32* %3
br label %20
20: ; preds = %17, %13
%21 = load i32, i32* %3
%22 = urem i32 %21, 2
%23 = icmp ne i32 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %20
%25 = load i32, i32* %3
%26 = add i32 %25, 1
store i32 %26, i32* %3
br label %27
27: ; preds = %24, %20
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @givehtsz(i32 %0) {
%2 = shl i32 %0, 1
%3 = udiv i32 %2, 3
%4 = urem i32 %3, 5
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = add nuw nsw i32 %3, %6
%8 = urem i32 %7, 3
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %7, %10
%12 = and i32 %11, 1
%13 = xor i32 %12, 1
%14 = add nuw nsw i32 %13, %11
ret i32 %14
}
unsigned int has_zero(unsigned int x) {
  unsigned int y;
  y = x;
  y -= 0x01010101;
  y &= ~x;
  return y & 0x80808080;
}


x86 assembly (clang, -O0):
<has_zero>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1010101,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x80808080,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_zero>:
lea    -0x1010101(%rdi),%eax
mov    %edi,%ecx
not    %ecx
and    %ecx,%eax
and    $0x80808080,%eax
ret

LLVM IR (-O0):
define i32 @has_zero(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = sub i32 %5, 16843009
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = xor i32 %7, -1
%9 = load i32, i32* %3
%10 = and i32 %9, %8
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = and i32 %11, -2139062144
ret i32 %12
}

LLVM IR (-O2):
define i32 @has_zero(i32 %0) {
%2 = add i32 %0, -16843009
%3 = and i32 %0, -2139062144
%4 = xor i32 %3, -2139062144
%5 = and i32 %4, %2
ret i32 %5
}
void RTAvloGCPtrDoWithAll(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvloGCPtrDoWithAll() {
ret void
}
/* Variables and functions */
long bb_strtoll(char const *, char **, int);
__attribute__((always_)) long bb_strtol(const char *arg, char **endp,
                                        int base) {
  return bb_strtoll(arg, endp, base);
}


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

x86 assembly (clang, -O2):
<bb_strtol>:
jmp    1030 <bb_strtoll@plt>

LLVM IR (-O0):
define i64 @bb_strtol(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8**, i8*** %5
%9 = load i32, i32* %6
%10 = call i64 @bb_strtoll(i8* %7, i8** %8, i32 %9)
ret i64 %10
}

LLVM IR (-O2):
define i64 @bb_strtol(i8* %0, i8** %1, i32 %2) {
%4 = tail call i64 @bb_strtoll(i8* %0, i8** %1, i32 %2)
ret i64 %4
}
/* Variables and functions */
scalar_t__ strlen(char *);
int /*<<< orphan*/ unhexmangle_to_buffer(char *, char *, scalar_t__);
void unhexmangle_string(char *s) { unhexmangle_to_buffer(s, s, strlen(s) + 1); }


x86 assembly (clang, -O0):
<unhexmangle_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1040 <unhexmangle_to_buffer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unhexmangle_string>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %rbx,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <unhexmangle_to_buffer@plt>

LLVM IR (-O0):
define void @unhexmangle_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = call i32 @unhexmangle_to_buffer(i8* %3, i8* %4, i64 %7)
ret void
}

LLVM IR (-O2):
define void @unhexmangle_string(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i32 @unhexmangle_to_buffer(i8* %0, i8* %0, i64 %3)
ret void
}
/* Type definitions */
struct user_t {
  int dummy;
};

/* Variables and functions */
int send_motd(struct user_t *);
int /*<<< orphan*/ send_to_user(char *, struct user_t *);
int welcome_mess(struct user_t *user) {
  int ret;
  ret = send_motd(user);
  send_to_user("|", user);
  return ret;
}


x86 assembly (clang, -O0):
<welcome_mess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <send_motd@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1030 <send_to_user@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<welcome_mess>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <send_motd@plt>
mov    %eax,%ebp
lea    0xecc(%rip),%rdi
mov    %rbx,%rsi
call   1030 <send_to_user@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.user_t = type { i32 }
@.str = [2 x i8] c"|\00"
define i32 @welcome_mess(%struct.user_t* %0) {
%2 = alloca %struct.user_t*
%3 = alloca i32
store %struct.user_t* %0, %struct.user_t** %2
%4 = load %struct.user_t*, %struct.user_t** %2
%5 = call i32 @send_motd(%struct.user_t* %4)
store i32 %5, i32* %3
%6 = load %struct.user_t*, %struct.user_t** %2
%7 = call i32 @send_to_user(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.user_t* %6)
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
%struct.user_t = type { i32 }
@.str = [2 x i8] c"|\00"
define i32 @welcome_mess(%struct.user_t* %0) {
%2 = tail call i32 @send_motd(%struct.user_t* %0)
%3 = tail call i32 @send_to_user(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.user_t* %0)
ret i32 %2
}
/* Type definitions */
typedef int useconds_t;
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int nanosleep(struct timespec *, int /*<<< orphan*/ *);
int usleep(useconds_t usec) {
  struct timespec ts;
  ts.tv_sec = usec / (1000 * 1000);
  ts.tv_nsec = (usec % (1000 * 1000)) * 1000;
  return nanosleep(&ts, NULL);
}


x86 assembly (clang, -O0):
<usleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
imul   $0x3e8,%edx,%eax
mov    %eax,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usleep>:
push   %rax
movslq %edi,%rax
imul   $0x431bde83,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x32,%rcx
add    %edx,%ecx
mov    %ecx,(%rsp)
imul   $0xf4240,%ecx,%ecx
sub    %ecx,%eax
imul   $0x3e8,%eax,%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define i32 @usleep(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 1000000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %2
%8 = srem i32 %7, 1000000
%9 = mul nsw i32 %8, 1000
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i32 %9, i32* %10
%11 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
ret i32 %11
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
define i32 @usleep(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = sdiv i32 %0, 1000000
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 %4, i32* %5
%6 = srem i32 %0, 1000000
%7 = mul nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i32 %7, i32* %8
%9 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
ret i32 %9
}
int movsbl_1(void) {
  int res;
  __asm__ __volatile__("movl $0x12345678, %%eax\n\t"
                       "movb $0x22, %%al\n\t"
                       "movsbl %%al,%%eax\n\t"
                       "mov %%eax, %0"
                       : "=r"(res)
                       :
                       : "eax");
  return res;
}


x86 assembly (clang, -O0):
<movsbl_1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x12345678,%eax
mov    $0x22,%al
movsbl %al,%eax
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<movsbl_1>:
mov    $0x12345678,%eax
mov    $0x22,%al
movsbl %al,%eax
mov    %eax,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @movsbl_1() {
%1 = alloca i32
%2 = call i32 asm sideeffect "movl $$0x12345678, %eax\0A\09movb $$0x22, %al\0A\09movsbl %al,%eax\0A\09mov %eax, $0", "=r,~{eax},~{dirflag},~{fpsr},~{flags}"()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @movsbl_1() {
%1 = tail call i32 asm sideeffect "movl $$0x12345678, %eax\0A\09movb $$0x22, %al\0A\09movsbl %al,%eax\0A\09mov %eax, $0", "=r,~{eax},~{dirflag},~{fpsr},~{flags}"()
ret i32 %1
}
void machdep_init(void) {}


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

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

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

LLVM IR (-O2):
define void @machdep_init() {
ret void
}
/* Type definitions */
typedef scalar_t__ wchar_t;

/* Variables and functions */
size_t wcslen(const wchar_t *s) {
  const wchar_t *p;
  for (p = s; *p; ++p)
    ;
  return p - s;
}


x86 assembly (clang, -O0):
<wcslen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1134 <wcslen+0x34>
jmp    1123 <wcslen+0x23>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <wcslen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
sar    $0x3,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcslen>:
mov    $0xfffffffffffffff8,%rax
nopw   0x0(%rax,%rax,1)
cmpq   $0x0,0x8(%rdi,%rax,1)
lea    0x8(%rax),%rax
jne    1110 <wcslen+0x10>
sar    $0x3,%rax
ret

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

LLVM IR (-O2):
define i64 @wcslen(i64* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64* [ %0, %1 ], [ %6, %2 ]
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds i64, i64* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i64* %3 to i64
%9 = ptrtoint i64* %0 to i64
%10 = sub i64 %8, %9
%11 = ashr exact i64 %10, 3
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, int, int, double);
char *CSP(char *MeasurementType, int NumberOfProbes, int MessageSize,
          double ServerDelay) {
  static char str[50];
  sprintf(str, "s %s %d %d %.0f\n", MeasurementType, NumberOfProbes,
          MessageSize, ServerDelay);
  return str;
}


x86 assembly (clang, -O0):
<CSP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
movsd  -0x18(%rbp),%xmm0
lea    0x2f02(%rip),%rdi
lea    0xebb(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2eef(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CSP>:
push   %rbx
mov    %edx,%r8d
mov    %esi,%ecx
mov    %rdi,%rdx
lea    0x2f20(%rip),%rbx
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@CSP.str = internal global [50 x i8] zeroinitializer
@.str = [17 x i8] c"s %s %d %d %.0f\0A\00"
define i8* @CSP(i8* %0, i32 %1, i32 %2, double %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store double %3, double* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load double, double* %8
%13 = call i32 @sprintf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @CSP.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %10, i32 %11, double %12)
ret i8* getelementptr inbounds ([50 x i8], [50 x i8]* @CSP.str, i64 0, i64 0)
}

LLVM IR (-O2):
@CSP.str = internal global [50 x i8] zeroinitializer
@.str = [17 x i8] c"s %s %d %d %.0f\0A\00"
define i8* @CSP(i8* %0, i32 %1, i32 %2, double %3) {
%5 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @CSP.str, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32 %2, double %3)
ret i8* getelementptr inbounds ([50 x i8], [50 x i8]* @CSP.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int main() {
  unsigned int x = 2;
  unsigned int y = (0U - x / 2) / 2;
  if (-1U / x != y)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
shr    $0x1,%ecx
xor    %eax,%eax
sub    %ecx,%eax
shr    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    $0xffffffff,%eax
xor    %edx,%edx
divl   -0x8(%rbp)
cmp    -0xc(%rbp),%eax
je     1150 <main+0x40>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%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
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %2
%4 = load i32, i32* %2
%5 = udiv i32 %4, 2
%6 = sub i32 0, %5
%7 = udiv i32 %6, 2
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = udiv i32 -1, %8
%10 = load i32, i32* %3
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ATI4200_Done();
void DLLUnRegister() { ATI4200_Done(); }


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

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

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

LLVM IR (-O2):
define void @DLLUnRegister() {
%1 = tail call i32 (...) @ATI4200_Done()
ret void
}
/* Variables and functions */
int sys_openat(int, char const *, int, int);
int sys_open(const char *p, int f, int m) {
  return sys_openat((-100), p, f, m);
}


x86 assembly (clang, -O0):
<sys_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0xffffff9c,%edi
call   1030 <sys_openat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_open>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
mov    $0xffffff9c,%edi
jmp    1030 <sys_openat@plt>

LLVM IR (-O0):
define i32 @sys_open(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 i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @sys_openat(i32 -100, i8* %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @sys_open(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @sys_openat(i32 -100, i8* %0, i32 %1, i32 %2)
ret i32 %4
}
void ScaleCols_C() {}


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

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

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

LLVM IR (-O2):
define void @ScaleCols_C() {
ret void
}
int Q_isprint(int c) {
  if ((c >= 0x20) && (c <= 0x7E)) {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<Q_isprint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jl     1127 <Q_isprint+0x27>
cmpl   $0x7e,-0x8(%rbp)
jg     1127 <Q_isprint+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <Q_isprint+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Q_isprint>:
add    $0xffffffe0,%edi
xor    %eax,%eax
cmp    $0x5f,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @Q_isprint(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 32
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 126
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @Q_isprint(i32 %0) {
%2 = add i32 %0, -32
%3 = icmp ult i32 %2, 95
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void error_and_exit() {
  fprintf(stderr, "Usage: app [SRC] [DST]\n");
  fprintf(stderr, "Append SRC to DST\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<error_and_exit>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error_and_exit>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: app [SRC] [DST]\0A\00"
@.str.1 = [19 x i8] c"Append SRC to DST\0A\00"
@EXIT_FAILURE = global i32 0
define void @error_and_exit() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: app [SRC] [DST]\0A\00"
@.str.1 = [19 x i8] c"Append SRC to DST\0A\00"
@EXIT_FAILURE = global i32 0
define void @error_and_exit() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, char *const, char *const);
scalar_t__ strlen(char *const);
char *join_strings(char *const key, char *const value) {
  char *s = malloc(strlen(key) + strlen(value) + 2);
  sprintf(s, "%s=%s", key, value);
  return s;
}


x86 assembly (clang, -O0):
<join_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe83(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<join_strings>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xe9b(%rip),%rsi
mov    %rax,%rdi
mov    %r12,%rdx
mov    %r14,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s=%s\00"
define i8* @join_strings(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %7, %9
%11 = add nsw i64 %10, 2
%12 = call i8* @malloc(i64 %11)
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = load i8*, i8** %3
%15 = load i8*, i8** %4
%16 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15)
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s=%s\00"
define noalias i8* @join_strings(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 2
%6 = add i64 %5, %4
%7 = tail call i8* @malloc(i64 %6)
%8 = tail call i32 @sprintf(i8* dereferenceable(1) %7, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret i8* %7
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t read16(uint8_t *p) { return p[0] | (p[1] << 8); }


x86 assembly (clang, -O0):
<read16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read16>:
mov    0x4(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @read16(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %7
%9 = shl i32 %8, 8
%10 = or i32 %5, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @read16(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
%6 = or i32 %5, %2
ret i32 %6
}
/* Type definitions */
typedef size_t uint64_t;

/* Variables and functions */
uint64_t get_char_pos(const char arr[], uint64_t sz, char c) {
  for (uint64_t i = 0; i < sz; i++)
    if (arr[i] == c)
      return i;
}


x86 assembly (clang, -O0):
<get_char_pos>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %al,-0x19(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1162 <get_char_pos+0x62>
mov    -0x10(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
jne    114c <get_char_pos+0x4c>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1162 <get_char_pos+0x62>
jmp    1151 <get_char_pos+0x51>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1119 <get_char_pos+0x19>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_char_pos>:
xor    %eax,%eax
test   %rsi,%rsi
je     1121 <get_char_pos+0x21>
nopw   0x0(%rax,%rax,1)
cmp    %dl,(%rdi,%rax,1)
je     1121 <get_char_pos+0x21>
add    $0x1,%rax
cmp    %rax,%rsi
jne    1110 <get_char_pos+0x10>
mov    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @get_char_pos(i8* %0, i64 %1, i8 signext %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8
%8 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8 %2, i8* %7
store i64 0, i64* %8
br label %9
9: ; preds = %25, %3
%10 = load i64, i64* %8
%11 = load i64, i64* %6
%12 = icmp ult i64 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %9
%14 = load i8*, i8** %5
%15 = load i64, i64* %8
%16 = getelementptr inbounds i8, i8* %14, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = load i8, i8* %7
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %18, %20
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = load i64, i64* %8
store i64 %23, i64* %4
br label %28
24: ; preds = %13
br label %25
25: ; preds = %24
%26 = load i64, i64* %8
%27 = add i64 %26, 1
store i64 %27, i64* %8
br label %9
28: ; preds = %22, %9
%29 = load i64, i64* %4
ret i64 %29
}

LLVM IR (-O2):
define i64 @get_char_pos(i8* nocapture %0, i64 %1, i8 signext %2) {
%4 = icmp eq i64 %1, 0
br i1 %4, label %13, label %5
5: ; preds = %3, %10
%6 = phi i64 [ %11, %10 ], [ 0, %3 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, %2
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = add nuw i64 %6, 1
%12 = icmp eq i64 %11, %1
br i1 %12, label %13, label %5
13: ; preds = %10, %5, %3
%14 = phi i64 [ 0, %3 ], [ %6, %5 ], [ %1, %10 ]
ret i64 %14
}
void Update_parameters(void) {}


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

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

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

LLVM IR (-O2):
define void @Update_parameters() {
ret void
}
void led_toggle(void) { (*((volatile unsigned long *)0x400253FC)) ^= 0x01; }


x86 assembly (clang, -O0):
<led_toggle>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400253fc,%eax
mov    (%rax),%rcx
xor    $0x1,%rcx
mov    $0x400253fc,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<led_toggle>:
xorq   $0x1,0x400253fc
40 01
ret

LLVM IR (-O0):
define void @led_toggle() {
%1 = load volatile i64, i64* inttoptr (i64 1073894396 to i64*)
%2 = xor i64 %1, 1
store volatile i64 %2, i64* inttoptr (i64 1073894396 to i64*)
ret void
}

LLVM IR (-O2):
define void @led_toggle() {
%1 = load volatile i64, i64* inttoptr (i64 1073894396 to i64*)
%2 = xor i64 %1, 1
store volatile i64 %2, i64* inttoptr (i64 1073894396 to i64*)
ret void
}
void rop3_207_1_1(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~T;
  stk1 = S | stk2;
  *D = (stk1 & (~S) & (~T)) | (*D & S) | (*D & T);
}


x86 assembly (clang, -O0):
<rop3_207_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
movzbl -0xa(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0xa(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_207_1_1>:
mov    %edx,%eax
or     %sil,%al
not    %al
mov    (%rdi),%cl
and    %cl,%sil
or     %al,%sil
and    %dl,%cl
or     %sil,%cl
mov    %cl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_207_1_1(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %6
%10 = zext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %8
%13 = load i8, i8* %5
%14 = zext i8 %13 to i32
%15 = load i8, i8* %8
%16 = zext i8 %15 to i32
%17 = or i32 %14, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %7
%19 = load i8, i8* %7
%20 = zext i8 %19 to i32
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = xor i32 %22, -1
%24 = and i32 %20, %23
%25 = load i8, i8* %6
%26 = zext i8 %25 to i32
%27 = xor i32 %26, -1
%28 = and i32 %24, %27
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = zext i8 %30 to i32
%32 = load i8, i8* %5
%33 = zext i8 %32 to i32
%34 = and i32 %31, %33
%35 = or i32 %28, %34
%36 = load i8*, i8** %4
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = load i8, i8* %6
%40 = zext i8 %39 to i32
%41 = and i32 %38, %40
%42 = or i32 %35, %41
%43 = trunc i32 %42 to i8
%44 = load i8*, i8** %4
store i8 %43, i8* %44
ret void
}

LLVM IR (-O2):
define void @rop3_207_1_1(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = or i8 %2, %1
%5 = xor i8 %4, -1
%6 = load i8, i8* %0
%7 = and i8 %6, %1
%8 = or i8 %7, %5
%9 = and i8 %6, %2
%10 = or i8 %8, %9
store i8 %10, i8* %0
ret void
}
/* Type definitions */
struct connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void on_closed(int id, struct connection *p_conn) {
  printf("ID [%d] closed", id);
}


x86 assembly (clang, -O0):
<on_closed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<on_closed>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.connection = type { i32 }
@.str = [15 x i8] c"ID [%d] closed\00"
define void @on_closed(i32 %0, %struct.connection* %1) {
%3 = alloca i32
%4 = alloca %struct.connection*
store i32 %0, i32* %3
store %struct.connection* %1, %struct.connection** %4
%5 = load i32, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
%struct.connection = type { i32 }
@.str = [15 x i8] c"ID [%d] closed\00"
define void @on_closed(i32 %0, %struct.connection* nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
struct strbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int getmsg(int fd, struct strbuf *ctlptr, struct strbuf *dataptr, int *flags) {
  fprintf(stderr, "delegated: getmsg() is not linked to this executable.\n");
  return -1;
}


x86 assembly (clang, -O0):
<getmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmsg>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.strbuf = type { i32 }
@stderr = global i32 0
@.str = [55 x i8] c"delegated: getmsg() is not linked to this executable.\0A\00"
define i32 @getmsg(i32 %0, %struct.strbuf* %1, %struct.strbuf* %2, i32* %3) {
%5 = alloca i32
%6 = alloca %struct.strbuf*
%7 = alloca %struct.strbuf*
%8 = alloca i32*
store i32 %0, i32* %5
store %struct.strbuf* %1, %struct.strbuf** %6
store %struct.strbuf* %2, %struct.strbuf** %7
store i32* %3, i32** %8
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
%struct.strbuf = type { i32 }
@stderr = global i32 0
@.str = [55 x i8] c"delegated: getmsg() is not linked to this executable.\0A\00"
define i32 @getmsg(i32 %0, %struct.strbuf* nocapture readnone %1, %struct.strbuf* nocapture readnone %2, i32* nocapture readnone %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void Error(char *str) {
  fprintf(stderr, "%s\n", str);
  exit(1);
}


x86 assembly (clang, -O0):
<Error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @Error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

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