xunge/DecIR huggingface dataset:
int tree2b(int i) { return i + 2; }


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

x86 assembly (clang, -O2):
<tree2b>:
lea    0x2(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @tree2b(i32 %0) {
%2 = add nsw i32 %0, 2
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void z_usage(int argc, char **argv) {
  if (argc < 3) {
    puts("usage: ./z-test-xxx <iterations> <num> ... <numX>");
    puts("\toptions:\n"
         "\t\t0 ::: executes FLUSHALL\n"
         "\t\t1:<num> ::: executes SET key:<i> where i from 0 to <num>\n"
         "\t\t2 ::: executes a keys *\n"
         "\t\t3:<num> ::: executes INCR key <num> times\n"
         "\t\t4:<num> ::: executes SADDR key <0 to num> times\n");
    exit(-1);
  }
  return;
}


x86 assembly (clang, -O0):
<z_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
jge    115b <z_usage+0x3b>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<z_usage>:
cmp    $0x2,%edi
jle    1126 <z_usage+0x6>
ret
push   %rax
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"usage: ./z-test-xxx <iterations> <num> ... <numX>\00"
@.str.1 = [216 x i8] c"\09options:\0A\09\090 ::: executes FLUSHALL\0A\09\091:<num> ::: executes SET key:<i> where i from 0 to <num>\0A\09\092 ::: executes a keys *\0A\09\093:<num> ::: executes INCR key <num> times\0A\09\094:<num> ::: executes SADDR key <0 to num> times\0A\00"
define void @z_usage(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 3
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = call i32 @puts(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @puts(i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"usage: ./z-test-xxx <iterations> <num> ... <numX>\00"
@.str.1 = [216 x i8] c"\09options:\0A\09\090 ::: executes FLUSHALL\0A\09\091:<num> ::: executes SET key:<i> where i from 0 to <num>\0A\09\092 ::: executes a keys *\0A\09\093:<num> ::: executes INCR key <num> times\0A\09\094:<num> ::: executes SADDR key <0 to num> times\0A\00"
define void @z_usage(i32 %0, i8** nocapture readnone %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_int_array(int *ns, size_t size) {
  for (int i = 0; i < size; i++) {
    printf("%d, ", ns[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_int_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    115c <print_int_array+0x4c>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <print_int_array+0x17>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1157 <print_int_array+0x37>
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xec6(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r14,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_int_array+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d, \00"
define void @print_int_array(i32* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %2
%5 = tail call i32 @putchar(i32 10)
ret void
6: ; preds = %2, %6
%7 = phi i64 [ %11, %6 ], [ 0, %2 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw i64 %7, 1
%12 = icmp eq i64 %11, %1
br i1 %12, label %4, label %6
}
/* Type definitions */
typedef long uint32_t;
struct etimer {
  int dummy;
};

/* Variables and functions */
int timer_elapsed_milliseconds(struct etimer *, long);
bool timer_elapsed_seconds(struct etimer *t, uint32_t seconds) {
  uint32_t milliseconds = seconds;
  milliseconds *= 1000L;
  return timer_elapsed_milliseconds(t, milliseconds);
}


x86 assembly (clang, -O0):
<timer_elapsed_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
imul   $0x3e8,-0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <timer_elapsed_milliseconds@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_elapsed_seconds>:
imul   $0x3e8,%rsi,%rsi
jmp    1030 <timer_elapsed_milliseconds@plt>

LLVM IR (-O0):
%struct.etimer = type { i32 }
define i32 @timer_elapsed_seconds(%struct.etimer* %0, i64 %1) {
%3 = alloca %struct.etimer*
%4 = alloca i64
%5 = alloca i64
store %struct.etimer* %0, %struct.etimer** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
store i64 %6, i64* %5
%7 = load i64, i64* %5
%8 = mul nsw i64 %7, 1000
store i64 %8, i64* %5
%9 = load %struct.etimer*, %struct.etimer** %3
%10 = load i64, i64* %5
%11 = call i32 @timer_elapsed_milliseconds(%struct.etimer* %9, i64 %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.etimer = type { i32 }
define i32 @timer_elapsed_seconds(%struct.etimer* %0, i64 %1) {
%3 = mul nsw i64 %1, 1000
%4 = tail call i32 @timer_elapsed_milliseconds(%struct.etimer* %0, i64 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ get_priority();
int /*<<< orphan*/ set_priority(int);
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  get_priority();
  set_priority(66);
  get_priority();
  sleep(100);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <get_priority@plt>
mov    $0x42,%edi
call   1030 <set_priority@plt>
mov    $0x0,%al
call   1040 <get_priority@plt>
mov    $0x64,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <get_priority@plt>
mov    $0x42,%edi
call   1030 <set_priority@plt>
xor    %eax,%eax
call   1040 <get_priority@plt>
mov    $0x64,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @get_priority()
%7 = call i32 @set_priority(i32 66)
%8 = call i32 (...) @get_priority()
%9 = call i32 @sleep(i32 100)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @get_priority()
%4 = tail call i32 @set_priority(i32 66)
%5 = tail call i32 (...) @get_priority()
%6 = tail call i32 @sleep(i32 100)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ glRotatef(double, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ glTranslatef(double, double, double);
void BendRight(void) {
  glRotatef(90.0, 0, 0, 1);
  glTranslatef(0.0, 1.0, 0.0);
  glRotatef(90.0, 1, 0, 0);
  glTranslatef(0.0, -1.0, 0.0);
}


x86 assembly (clang, -O0):
<BendRight>:
push   %rbp
mov    %rsp,%rbp
movsd  0xedc(%rip),%xmm0
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1040 <glRotatef@plt>
xorps  %xmm2,%xmm2
movsd  0xecb(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glTranslatef@plt>
movsd  0xeb3(%rip),%xmm0
mov    $0x1,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <glRotatef@plt>
xorps  %xmm2,%xmm2
movsd  0xe92(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glTranslatef@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<BendRight>:
push   %rax
movsd  0xed7(%rip),%xmm0
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <glRotatef@plt>
movsd  0xec9(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
call   1030 <glTranslatef@plt>
movsd  0xeae(%rip),%xmm0
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <glRotatef@plt>
movsd  0xea8(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
pop    %rax
jmp    1030 <glTranslatef@plt>

LLVM IR (-O0):
define void @BendRight() {
%1 = call i32 @glRotatef(double 9.000000e+01, i32 0, i32 0, i32 1)
%2 = call i32 @glTranslatef(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%3 = call i32 @glRotatef(double 9.000000e+01, i32 1, i32 0, i32 0)
%4 = call i32 @glTranslatef(double 0.000000e+00, double -1.000000e+00, double 0.000000e+00)
ret void
}

LLVM IR (-O2):
define void @BendRight() {
%1 = tail call i32 @glRotatef(double 9.000000e+01, i32 0, i32 0, i32 1)
%2 = tail call i32 @glTranslatef(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%3 = tail call i32 @glRotatef(double 9.000000e+01, i32 1, i32 0, i32 0)
%4 = tail call i32 @glTranslatef(double 0.000000e+00, double -1.000000e+00, double 0.000000e+00)
ret void
}
/* Type definitions */
typedef scalar_t__ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ iswalpha(scalar_t__);
void skip_nonalpha(wchar_t **text) {
  while (**text && !iswalpha(**text))
    (*text)++;
}


x86 assembly (clang, -O0):
<skip_nonalpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x9(%rbp)
je     114c <skip_nonalpha+0x3c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rdi
call   1030 <iswalpha@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    115c <skip_nonalpha+0x4c>
jmp    116f <skip_nonalpha+0x5f>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x8,%rcx
mov    %rcx,(%rax)
jmp    111c <skip_nonalpha+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_nonalpha>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    (%rax),%rdi
test   %rdi,%rdi
je     113c <skip_nonalpha+0x2c>
nop
call   1030 <iswalpha@plt>
test   %eax,%eax
jne    113c <skip_nonalpha+0x2c>
mov    (%rbx),%rax
lea    0x8(%rax),%rcx
mov    %rcx,(%rbx)
mov    0x8(%rax),%rdi
test   %rdi,%rdi
jne    1120 <skip_nonalpha+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @skip_nonalpha(i64** %0) {
%2 = alloca i64**
store i64** %0, i64*** %2
br label %3
3: ; preds = %17, %1
%4 = load i64**, i64*** %2
%5 = load i64*, i64** %4
%6 = load i64, i64* %5
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %3
%9 = load i64**, i64*** %2
%10 = load i64*, i64** %9
%11 = load i64, i64* %10
%12 = call i32 @iswalpha(i64 %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br label %15
15: ; preds = %8, %3
%16 = phi i1 [ false, %3 ], [ %14, %8 ]
br i1 %16, label %17, label %21
17: ; preds = %15
%18 = load i64**, i64*** %2
%19 = load i64*, i64** %18
%20 = getelementptr inbounds i64, i64* %19, i32 1
store i64* %20, i64** %18
br label %3
21: ; preds = %15
ret void
}

LLVM IR (-O2):
define void @skip_nonalpha(i64** nocapture %0) {
%2 = load i64*, i64** %0
%3 = load i64, i64* %2
%4 = icmp eq i64 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %1, %9
%6 = phi i64 [ %12, %9 ], [ %3, %1 ]
%7 = tail call i32 @iswalpha(i64 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load i64*, i64** %0
%11 = getelementptr inbounds i64, i64* %10, i64 1
store i64* %11, i64** %0
%12 = load i64, i64* %11
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %9, %1
ret void
}
void fakeDrSetup(int width, int height, int redrawRate, void *context,
                 int drFlags) {}


x86 assembly (clang, -O0):
<fakeDrSetup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @fakeDrSetup(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
ret void
}

LLVM IR (-O2):
define void @fakeDrSetup(i32 %0, i32 %1, i32 %2, i8* nocapture %3, i32 %4) {
ret void
}
void trimlenc(s1) char *s1;
{
  int l;
  l = strlen(s1) - 1;
  while (l >= 0) {
    if (s1[l] != ' ')
      break;
    s1[l] = 0;
    l--;
  }
}


x86 assembly (clang, -O0):
<trimlenc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%rax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     116a <trimlenc+0x5a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     1150 <trimlenc+0x40>
jmp    116a <trimlenc+0x5a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    112c <trimlenc+0x1c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trimlenc>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
add    $0xffffffff,%eax
js     1131 <trimlenc+0x21>
xchg   %ax,%ax
mov    %eax,%eax
cmpb   $0x20,(%rbx,%rax,1)
jne    1131 <trimlenc+0x21>
movb   $0x0,(%rbx,%rax,1)
add    $0xffffffff,%eax
jns    1120 <trimlenc+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @trimlenc(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = sub i64 %5, 1
%7 = trunc i64 %6 to i32
store i32 %7, i32* %3
br label %8
8: ; preds = %20, %1
%9 = load i32, i32* %3
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %8
%12 = load i8*, i8** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 32
br i1 %18, label %19, label %20
19: ; preds = %11
br label %27
20: ; preds = %11
%21 = load i8*, i8** %2
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
store i8 0, i8* %24
%25 = load i32, i32* %3
%26 = add nsw i32 %25, -1
store i32 %26, i32* %3
br label %8
27: ; preds = %19, %8
ret void
}

LLVM IR (-O2):
define void @trimlenc(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = add i32 %3, -1
%5 = icmp sgt i32 %4, -1
br i1 %5, label %6, label %15
6: ; preds = %1, %12
%7 = phi i32 [ %13, %12 ], [ %4, %1 ]
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 32
br i1 %11, label %12, label %15
12: ; preds = %6
store i8 0, i8* %9
%13 = add i32 %7, -1
%14 = icmp sgt i32 %13, -1
br i1 %14, label %6, label %15
15: ; preds = %12, %6, %1
ret void
}
/* Variables and functions */
__attribute__((deprecated("use ut_string_is_invalid from libutils"))) bool
rs_str_is_invalid(const char *str) {
  return NULL == str || '\0' == *str;
}


x86 assembly (clang, -O0):
<rs_str_is_invalid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%al
xor    %ecx,%ecx
cmp    -0x8(%rbp),%rcx
mov    %al,-0x9(%rbp)
je     112a <rs_str_is_invalid+0x2a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rs_str_is_invalid>:
test   %rdi,%rdi
je     110e <rs_str_is_invalid+0xe>
xor    %eax,%eax
cmpb   $0x0,(%rdi)
sete   %al
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @rs_str_is_invalid(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* null, %3
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 0, %8
br label %10
10: ; preds = %5, %1
%11 = phi i1 [ true, %1 ], [ %9, %5 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @rs_str_is_invalid(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 1, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
size_t TF_min(size_t a, size_t b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<TF_min>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1127 <TF_min+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <TF_min+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TF_min>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovb  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @TF_min(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ult i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @TF_min(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int usage() {
  printf("locktest -n <number of process> -f <test file> [-T]\n");
  printf("Number of child process must be higher than 1\n");
  printf("\n");
  printf("Send bugs to vincent.roqueta@ext.bull.net\n");
  exit(0);
  return 0;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xefe(%rip),%rdi
call   1030 <printf@plt>
lea    0xf1f(%rip),%rdi
call   1030 <printf@plt>
lea    0xf15(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <puts@plt>
lea    0xef0(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xf08(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"locktest -n <number of process> -f <test file> [-T]\0A\00"
@.str.1 = [47 x i8] c"Number of child process must be higher than 1\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [43 x i8] c"Send bugs to vincent.roqueta@ext.bull.net\0A\00"
define i32 @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [52 x i8] c"locktest -n <number of process> -f <test file> [-T]\00"
@str.4 = [46 x i8] c"Number of child process must be higher than 1\00"
@str.5 = [42 x i8] c"Send bugs to vincent.roqueta@ext.bull.net\00"
define i32 @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.5, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
}
void gtk_widget_get_root_window() {}


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

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

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

LLVM IR (-O2):
define void @gtk_widget_get_root_window() {
ret void
}
/* Variables and functions */
double dist(void const *);
int cmp_Point(const void *p1, const void *p2) {
  double dist1 = dist(p1), dist2 = dist(p2);
  if (dist1 < dist2) {
    return -1;
  } else if (dist2 < dist1) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<cmp_Point>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <dist@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <dist@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    115c <cmp_Point+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1183 <cmp_Point+0x73>
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    117c <cmp_Point+0x6c>
movl   $0x1,-0x4(%rbp)
jmp    1183 <cmp_Point+0x73>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_Point>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
call   1030 <dist@plt>
movsd  %xmm0,0x8(%rsp)
mov    %rbx,%rdi
call   1030 <dist@plt>
xor    %ecx,%ecx
movsd  0x8(%rsp),%xmm1
ucomisd %xmm0,%xmm1
seta   %cl
ucomisd %xmm1,%xmm0
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cmp_Point(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = call double @dist(i8* %8)
store double %9, double* %6
%10 = load i8*, i8** %5
%11 = call double @dist(i8* %10)
store double %11, double* %7
%12 = load double, double* %6
%13 = load double, double* %7
%14 = fcmp olt double %12, %13
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 -1, i32* %3
br label %22
16: ; preds = %2
%17 = load double, double* %7
%18 = load double, double* %6
%19 = fcmp olt double %17, %18
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 1, i32* %3
br label %22
21: ; preds = %16
store i32 0, i32* %3
br label %22
22: ; preds = %21, %20, %15
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @cmp_Point(i8* %0, i8* %1) {
%3 = tail call double @dist(i8* %0)
%4 = tail call double @dist(i8* %1)
%5 = fcmp olt double %3, %4
%6 = fcmp olt double %4, %3
%7 = zext i1 %6 to i32
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ select_frame();
int main(int argc, char **argv) {
  select_frame();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <select_frame@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <select_frame@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @select_frame()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @select_frame()
ret i32 0
}
unsigned int _check_times(unsigned x, unsigned y) {
  unsigned long long whole_ans =
      ((unsigned long long)x) * ((unsigned long long)y);
  unsigned word_ans = (unsigned)whole_ans;
  if (word_ans < whole_ans || word_ans > (1 << 28))
    (_throw_badalloc_fn("/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/"
                        "cyclone/refs/heads/master/bin/genfiles/assndef.c",
                        284));
  return word_ans;
}


x86 assembly (clang, -O0):
<_check_times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%rax
jb     114d <_check_times+0x3d>
cmpl   $0x10000000,-0x14(%rbp)
jbe    1160 <_check_times+0x50>
lea    0xeac(%rip),%rdi
mov    $0x11c,%esi
mov    $0x0,%al
call   1030 <_throw_badalloc_fn@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_times>:
push   %rbx
mov    %edi,%eax
mul    %esi
mov    %eax,%ebx
jo     1121 <_check_times+0x11>
cmp    $0x10000001,%ebx
jb     1134 <_check_times+0x24>
lea    0xed8(%rip),%rdi
mov    $0x11c,%esi
xor    %eax,%eax
call   1030 <_throw_badalloc_fn@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/assndef.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = mul i64 %8, %10
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = trunc i64 %12 to i32
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = zext i32 %14 to i64
%16 = load i64, i64* %5
%17 = icmp ult i64 %15, %16
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i32, i32* %6
%20 = icmp ugt i32 %19, 268435456
br i1 %20, label %21, label %23
21: ; preds = %18, %2
%22 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i32 284)
br label %23
23: ; preds = %21, %18
%24 = load i32, i32* %6
ret i32 %24
}

LLVM IR (-O2):
@.str = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/assndef.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = tail call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %0, i32 %1)
%4 = extractvalue { i32, i1 } %3, 0
%5 = extractvalue { i32, i1 } %3, 1
%6 = icmp ugt i32 %4, 268435456
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str, i64 0, i64 0), i32 284)
br label %10
10: ; preds = %2, %8
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ eiki_strcpy(char *, char const *);
char *eiki_strcat(char *dest, const char *src) {
  char *ptr;
  ptr = dest;
  while (*ptr) {
    ptr++;
  }
  eiki_strcpy(ptr, src);
  return dest;
}


x86 assembly (clang, -O0):
<eiki_strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <eiki_strcat+0x36>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <eiki_strcat+0x18>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <eiki_strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eiki_strcat>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rdi
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi)
lea    0x1(%rdi),%rdi
jne    1120 <eiki_strcat+0x10>
call   1030 <eiki_strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @eiki_strcat(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
store i8* %6, i8** %5
br label %7
7: ; preds = %11, %2
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %5
br label %7
14: ; preds = %7
%15 = load i8*, i8** %5
%16 = load i8*, i8** %4
%17 = call i32 @eiki_strcpy(i8* %15, i8* %16)
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @eiki_strcat(i8* returned %0, i8* %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = tail call i32 @eiki_strcpy(i8* %4, i8* %1)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void make_message(char *temp, char *buffer, char *nick) {
  (void)strcpy(buffer, "## ");
  strcat(buffer, nick);
  strcat(buffer, " ## :");
  strcat(buffer, temp);
}


x86 assembly (clang, -O0):
<make_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_message>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <strcat@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"## \00"
@.str.1 = [6 x i8] c" ## :\00"
define void @make_message(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i32 @strcat(i8* %9, i8* %10)
%12 = load i8*, i8** %5
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%14 = load i8*, i8** %5
%15 = load i8*, i8** %4
%16 = call i32 @strcat(i8* %14, i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"## \00"
@.str.1 = [6 x i8] c" ## :\00"
define void @make_message(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @strcat(i8* %1, i8* %2)
%6 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @strcat(i8* %1, i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void put8(uint8_t **ppb, uint8_t b) {
  **ppb = b;
  (*ppb)++;
}


x86 assembly (clang, -O0):
<put8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put8>:
mov    (%rdi),%rax
mov    %esi,(%rax)
add    $0x4,%rax
mov    %rax,(%rdi)
ret

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

LLVM IR (-O2):
define void @put8(i32** nocapture %0, i32 %1) {
%3 = load i32*, i32** %0
store i32 %1, i32* %3
%4 = getelementptr inbounds i32, i32* %3, i64 1
store i32* %4, i32** %0
ret void
}
int compare(void *a, void *b) {
  int *ia = (int *)a;
  int *ib = (int *)b;
  return *ia - *ib;
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = sub nsw i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ ttysendrecv(char *, char *, int *, int *);
void scrsize(int *rows, int *cols) {
  ttysendrecv("\033[s\033[999;999H\033[6n\033[u", "\033[%d;%dR", rows, cols);
}


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

x86 assembly (clang, -O2):
<scrsize>:
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xee3(%rip),%rdi
lea    0xef1(%rip),%rsi
jmp    1030 <ttysendrecv@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"\1B[s\1B[999;999H\1B[6n\1B[u\00"
@.str.1 = [9 x i8] c"\1B[%d;%dR\00"
define void @scrsize(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32*, i32** %4
%7 = call i32 @ttysendrecv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"\1B[s\1B[999;999H\1B[6n\1B[u\00"
@.str.1 = [9 x i8] c"\1B[%d;%dR\00"
define void @scrsize(i32* %0, i32* %1) {
%3 = tail call i32 @ttysendrecv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %0, i32* %1)
ret void
}
/* Type definitions */
struct aFILE {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ _get_actual_fp(struct aFILE *);
size_t fwrite(void const *, size_t, size_t, int /*<<< orphan*/);
size_t my_fwrite(const void *ptr, size_t size, size_t nmemb, struct aFILE *fp) {
  return fwrite(ptr, size, nmemb, _get_actual_fp(fp));
}


x86 assembly (clang, -O0):
<my_fwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <_get_actual_fp@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
call   1040 <fwrite@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_fwrite>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rcx,%rdi
call   1030 <_get_actual_fp@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
%struct.aFILE = type { i32 }
define i64 @my_fwrite(i8* %0, i64 %1, i64 %2, %struct.aFILE* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
%8 = alloca %struct.aFILE*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store %struct.aFILE* %3, %struct.aFILE** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load i64, i64* %7
%12 = load %struct.aFILE*, %struct.aFILE** %8
%13 = call i32 @_get_actual_fp(%struct.aFILE* %12)
%14 = call i64 @fwrite(i8* %9, i64 %10, i64 %11, i32 %13)
ret i64 %14
}

LLVM IR (-O2):
%struct.aFILE = type { i32 }
define i64 @my_fwrite(i8* %0, i64 %1, i64 %2, %struct.aFILE* %3) {
%5 = tail call i32 @_get_actual_fp(%struct.aFILE* %3)
%6 = tail call i64 @fwrite(i8* %0, i64 %1, i64 %2, i32 %5)
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ debug_critical(char *);
void signal_fpe(int sig_value) {
  debug_critical("[signal_fpe] Received SIGFPE [floating-point exception]");
}


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

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

LLVM IR (-O0):
@.str = [56 x i8] c"[signal_fpe] Received SIGFPE [floating-point exception]\00"
define void @signal_fpe(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @debug_critical(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [56 x i8] c"[signal_fpe] Received SIGFPE [floating-point exception]\00"
define void @signal_fpe(i32 %0) {
%2 = tail call i32 @debug_critical(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
ret void
}
int strsrchic(char chaine[], char srch) {
  int i, x;
  char c;
  c = 1;
  x = 0;
  i = 0;
  while (chaine[i] != 0) {
    c = chaine[i];
    if (c == srch) {
      x = 1;
      break;
    }
    i++;
  }
  if (x)
    return i;
  return -1;
}


x86 assembly (clang, -O0):
<strsrchic>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movb   $0x1,-0x1d(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     116d <strsrchic+0x6d>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x1d(%rbp)
movsbl -0x1d(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    115f <strsrchic+0x5f>
movl   $0x1,-0x1c(%rbp)
jmp    116d <strsrchic+0x6d>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1120 <strsrchic+0x20>
cmpl   $0x0,-0x1c(%rbp)
je     1182 <strsrchic+0x82>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <strsrchic+0x89>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsrchic>:
mov    $0xffffffff,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rdi),%eax
add    $0x1,%ecx
test   %al,%al
je     1123 <strsrchic+0x23>
add    $0x1,%rdi
cmp    %sil,%al
jne    1110 <strsrchic+0x10>
cmp    $0x1,%al
sbb    %eax,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @strsrchic(i8* nocapture %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %10, %3 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = icmp eq i8 %6, %1
%9 = or i1 %7, %8
%10 = add nuw i64 %4, 1
br i1 %9, label %11, label %3
11: ; preds = %3
%12 = trunc i64 %4 to i32
%13 = select i1 %7, i32 -1, i32 %12
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int write(int, char *, int);
void send_notification() {
  if (write(3, "!", 1) != 1)
    printf("Could not send notification!\n");
  else
    printf("Notification sent.\n");
}


x86 assembly (clang, -O0):
<send_notification>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
lea    0xed0(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmp    $0x1,%eax
je     1154 <send_notification+0x34>
lea    0xeb8(%rip),%rdi
call   1040 <printf@plt>
jmp    1160 <send_notification+0x40>
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_notification>:
push   %rax
lea    0xf06(%rip),%rsi
mov    $0x3,%edi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x1,%eax
lea    0xebf(%rip),%rax
lea    0xecb(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"!\00"
@.str.1 = [30 x i8] c"Could not send notification!\0A\00"
@.str.2 = [20 x i8] c"Notification sent.\0A\00"
define void @send_notification() {
%1 = call i32 @write(i32 3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = icmp ne i32 %1, 1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"!\00"
@str = [19 x i8] c"Notification sent.\00"
@str.3 = [29 x i8] c"Could not send notification!\00"
define void @send_notification() {
%1 = tail call i32 @write(i32 3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = icmp eq i32 %1, 1
%3 = select i1 %2, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @str.3, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret void
}
void QF_onCleanup(void) { ; }


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

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

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

LLVM IR (-O2):
define void @QF_onCleanup() {
ret void
}
void debug_write(const char *c, int i) {}


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

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

LLVM IR (-O0):
define void @debug_write(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @debug_write(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int is_valid_ip(char *);
int main(void) {
  char ip_correct[] = "172.31.255.255";
  char ip_incorrect[] = "192.168.2.300";
  assert(is_valid_ip(ip_correct));
  assert(!is_valid_ip(ip_incorrect));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x13(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xec2(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xeba(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x21(%rbp)
mov    0xeaf(%rip),%eax
mov    %eax,-0x19(%rbp)
mov    0xea9(%rip),%ax
mov    %ax,-0x15(%rbp)
lea    -0x13(%rbp),%rdi
call   1040 <is_valid_ip@plt>
mov    %eax,%edi
call   1030 <assert@plt>
lea    -0x21(%rbp),%rdi
call   1040 <is_valid_ip@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movabs $0x3535322e353532,%rax
mov    %rax,0x1f(%rsp)
movabs $0x322e31332e323731,%rax
31 2e 32
mov    %rax,0x18(%rsp)
movabs $0x3030332e322e38,%rax
mov    %rax,0xe(%rsp)
movabs $0x2e3836312e323931,%rax
36 38 2e
mov    %rax,0x8(%rsp)
lea    0x18(%rsp),%rdi
call   1040 <is_valid_ip@plt>
mov    %eax,%edi
call   1030 <assert@plt>
lea    0x8(%rsp),%rdi
call   1040 <is_valid_ip@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.ip_correct = [15 x i8] c"172.31.255.255\00"
@__const.main.ip_incorrect = [14 x i8] c"192.168.2.300\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [15 x i8]
%3 = alloca [14 x i8]
store i32 0, i32* %1
%4 = bitcast [15 x i8]* %2 to i8*
%5 = bitcast [14 x i8]* %3 to i8*
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%7 = call i32 @is_valid_ip(i8* %6)
%8 = call i32 @assert(i32 %7)
%9 = getelementptr inbounds [14 x i8], [14 x i8]* %3, i64 0, i64 0
%10 = call i32 @is_valid_ip(i8* %9)
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
ret i32 0
}

LLVM IR (-O2):
@__const.main.ip_correct = [15 x i8] c"172.31.255.255\00"
@__const.main.ip_incorrect = [14 x i8] c"192.168.2.300\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [14 x i8]
%3 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%5 = call i32 @is_valid_ip(i8* %3)
%6 = call i32 @assert(i32 %5)
%7 = call i32 @is_valid_ip(i8* %4)
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
ret i32 0
}