xunge/DecIR huggingface dataset:
/* Type definitions */
struct ft {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct ft *);
void ft_destroy(struct ft *ft) { free(ft); }


x86 assembly (clang, -O0):
<ft_destroy>:
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):
<ft_destroy>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.ft = type { i32 }
define void @ft_destroy(%struct.ft* %0) {
%2 = alloca %struct.ft*
store %struct.ft* %0, %struct.ft** %2
%3 = load %struct.ft*, %struct.ft** %2
%4 = call i32 @free(%struct.ft* %3)
ret void
}

LLVM IR (-O2):
%struct.ft = type { i32 }
define void @ft_destroy(%struct.ft* nocapture %0) {
%2 = tail call i32 @free(%struct.ft* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
void read_until_newline(FILE *f) {
  while (1) {
    int c = fgetc(f);
    if (c == EOF || c == '\n')
      return;
  }
}


x86 assembly (clang, -O0):
<read_until_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2eb6(%rip),%rcx
cmp    (%rcx),%eax
je     1144 <read_until_newline+0x34>
cmpl   $0xa,-0xc(%rbp)
jne    114a <read_until_newline+0x3a>
add    $0x10,%rsp
pop    %rbp
ret
jmp    111c <read_until_newline+0xc>

x86 assembly (clang, -O2):
<read_until_newline>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eca(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%eax
je     1132 <read_until_newline+0x22>
cmp    (%r14),%eax
jne    1120 <read_until_newline+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define void @read_until_newline(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
%6 = icmp ne i32 %3, 10
%7 = and i1 %6, %5
br i1 %7, label %2, label %8
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char *);
void usage(const char *name) {
  printf("Usage: %s [OPTIONS]\n"
         "\n"
         "  -h, --help      display this help and exit\n"
         "  -V, --version   output version information and exit\n"
         "\n"
         "Report bugs to <%s>.\n",
         name, "aliguori@us.ibm.com");
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
lea    0xf6e(%rip),%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [143 x i8] c"Usage: %s [OPTIONS]\0A\0A -h, --help display this help and exit\0A -V, --version output version information and exit\0A\0AReport bugs to <%s>.\0A\00"
@.str.1 = [20 x i8] c"aliguori@us.ibm.com\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [143 x i8] c"Usage: %s [OPTIONS]\0A\0A -h, --help display this help and exit\0A -V, --version output version information and exit\0A\0AReport bugs to <%s>.\0A\00"
@.str.1 = [20 x i8] c"aliguori@us.ibm.com\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([143 x i8], [143 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ ffs(int);
int /*<<< orphan*/ link_failure_ffs();
void test_ffs(int x) {
  if (ffs(x) != ffs(x))
    link_failure_ffs();
}


x86 assembly (clang, -O0):
<test_ffs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <ffs@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <ffs@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     1156 <test_ffs+0x36>
mov    $0x0,%al
call   1040 <link_failure_ffs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ffs>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <ffs@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1030 <ffs@plt>
cmp    %rax,%r14
jne    1142 <test_ffs+0x22>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <link_failure_ffs@plt>

LLVM IR (-O0):
define void @test_ffs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @ffs(i32 %3)
%5 = load i32, i32* %2
%6 = call i64 @ffs(i32 %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_ffs()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_ffs(i32 %0) {
%2 = tail call i64 @ffs(i32 %0)
%3 = tail call i64 @ffs(i32 %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_ffs()
br label %7
7: ; preds = %5, %1
ret void
}
int strhash(const char *x) {
  int h = 0;
  while (*x)
    h = h * 13 + *(x++);
  return h;
}


x86 assembly (clang, -O0):
<strhash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113c <strhash+0x3c>
imul   $0xd,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strhash+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strhash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <strhash+0x27>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
lea    (%rax,%rax,2),%edx
lea    (%rax,%rdx,4),%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <strhash+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strhash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul nsw i32 %6, 13
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = add nsw i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %11, %4 ]
ret i32 %15
}
int main() {
  union machine_inst {
    unsigned addr;
    struct {
      unsigned opcode : 16;
    } misc;
    struct {
      unsigned opcode : 8;
      unsigned offset : 8;
    } branch;
    struct {
      unsigned opcode : 7;
      unsigned src_reg : 3;
      unsigned dst_reg : 3;
      unsigned dst_mode : 3;
    } sgl_op;
    struct {
      unsigned opcode : 7;
      unsigned src_reg : 3;
      unsigned dst_reg : 3;
      unsigned dst_mode : 3;
    } reg_src;
    struct {
      unsigned opcode : 4;
      unsigned src_mode : 3;
      unsigned src_reg : 3;
      unsigned dst_mode : 3;
      unsigned dst_reg : 3;
    } dbl_op;
  } x;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.machine_inst = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %union.machine_inst
store i32 0, i32* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
scalar_t__ checkPasswd();
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (checkPasswd())
    printf("correct\n");
  else
    printf("wrong\n");
  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 <checkPasswd@plt>
cmp    $0x0,%rax
je     1158 <main+0x38>
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
jmp    1164 <main+0x44>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <checkPasswd@plt>
test   %rax,%rax
lea    0xece(%rip),%rax
lea    0xecd(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"correct\0A\00"
@.str.1 = [7 x i8] c"wrong\0A\00"
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 i64 (...) @checkPasswd()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %12
10: ; preds = %2
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %8
ret i32 0
}

LLVM IR (-O2):
@str = [6 x i8] c"wrong\00"
@str.2 = [8 x i8] c"correct\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @checkPasswd()
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.2, i64 0, i64 0)
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
ret i32 0
}
/* Variables and functions */
double sqrt(double);
double coq_fsqrt(double x) { return sqrt(x); }


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

x86 assembly (clang, -O2):
<coq_fsqrt>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     111f <coq_fsqrt+0xf>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define double @coq_fsqrt(double %0) {
%2 = tail call double @sqrt(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/);
void sig_handler() {
  pthread_exit(0);
  return;
}


x86 assembly (clang, -O0):
<sig_handler>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <pthread_exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_handler>:
xor    %edi,%edi
jmp    1030 <pthread_exit@plt>

LLVM IR (-O0):
define void @sig_handler() {
%1 = call i32 @pthread_exit(i32 0)
ret void
}

LLVM IR (-O2):
define void @sig_handler() {
%1 = tail call i32 @pthread_exit(i32 0)
ret void
}
/* Type definitions */
typedef scalar_t__ wint_t;

/* Variables and functions */
int isgraph(scalar_t__);
int iswgraph(wint_t wc) { return ((wc < (wint_t)0x100 ? isgraph(wc) : 0)); }


x86 assembly (clang, -O0):
<iswgraph>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x100,-0x8(%rbp)
jge    113b <iswgraph+0x2b>
mov    -0x8(%rbp),%rdi
call   1030 <isgraph@plt>
mov    %eax,-0xc(%rbp)
jmp    1145 <iswgraph+0x35>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    1145 <iswgraph+0x35>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswgraph>:
cmp    $0xff,%rdi
jg     111e <iswgraph+0xe>
jmp    1030 <isgraph@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @iswgraph(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 256
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i64, i64* %2
%7 = call i32 @isgraph(i64 %6)
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %5
%10 = phi i32 [ %7, %5 ], [ 0, %8 ]
ret i32 %10
}

LLVM IR (-O2):
define i32 @iswgraph(i64 %0) {
%2 = icmp slt i64 %0, 256
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @isgraph(i64 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
scalar_t__ ran1();
double RandomRange(double inf, double sup) {
  return (double)ran1() * (sup - inf) + inf;
}


x86 assembly (clang, -O0):
<RandomRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <ran1@plt>
cvtsi2sd %rax,%xmm0
movsd  -0x10(%rbp),%xmm2
subsd  -0x8(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomRange>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <ran1@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm2
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @RandomRange(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = call i64 (...) @ran1()
%6 = sitofp i64 %5 to double
%7 = load double, double* %4
%8 = load double, double* %3
%9 = fsub double %7, %8
%10 = load double, double* %3
%11 = call double @llvm.fmuladd.f64(double %6, double %9, double %10)
ret double %11
}

LLVM IR (-O2):
define double @RandomRange(double %0, double %1) {
%3 = tail call i64 (...) @ran1()
%4 = sitofp i64 %3 to double
%5 = fsub double %1, %0
%6 = tail call double @llvm.fmuladd.f64(double %4, double %5, double %0)
ret double %6
}
void simple_object_set_big_32(unsigned char *buf, unsigned int val) {
  buf[0] = (val >> 24) & 0xff;
  buf[1] = (val >> 16) & 0xff;
  buf[2] = (val >> 8) & 0xff;
  buf[3] = val & 0xff;
}


x86 assembly (clang, -O0):
<simple_object_set_big_32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_object_set_big_32>:
bswap  %esi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @simple_object_set_big_32(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = lshr i32 %5, 24
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %4
%12 = lshr i32 %11, 16
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
%17 = load i32, i32* %4
%18 = lshr i32 %17, 8
%19 = and i32 %18, 255
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 2
store i8 %20, i8* %22
%23 = load i32, i32* %4
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 3
store i8 %25, i8* %27
ret void
}

LLVM IR (-O2):
define void @simple_object_set_big_32(i8* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = trunc i32 %3 to i8
store i8 %4, i8* %0
%5 = lshr i32 %1, 16
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %6, i8* %7
%8 = lshr i32 %1, 8
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %9, i8* %10
%11 = trunc i32 %1 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
/* Variables and functions */
double atan2(double, double);
double fpu_fpatan(double a, double b) {
  double c;
  c = atan2(b, a);
  return c;
}


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

x86 assembly (clang, -O2):
<fpu_fpatan>:
movaps %xmm0,%xmm2
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
jmp    1030 <atan2@plt>

LLVM IR (-O0):
define double @fpu_fpatan(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %4
%7 = load double, double* %3
%8 = call double @atan2(double %6, double %7)
store double %8, double* %5
%9 = load double, double* %5
ret double %9
}

LLVM IR (-O2):
define double @fpu_fpatan(double %0, double %1) {
%3 = tail call double @atan2(double %1, double %0)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello Split Module Table world (7)\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [36 x i8] c"Hello Split Module Table world (7)\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [35 x i8] c"Hello Split Module Table world (7)\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main() {
  int i = 0;
  while (1) {
    i++;
    printf("%s\n", "Hello");
    if (i > 2)
      break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xeca(%rip),%rdi
lea    0xec7(%rip),%rsi
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jle    1151 <main+0x41>
jmp    1156 <main+0x46>
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rbx
lea    0xee2(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [6 x i8] c"Hello\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %0, %10
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %3
br label %11
10: ; preds = %3
br label %3
11: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [6 x i8] c"Hello\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_an_address();
int main() {
  print_an_address();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @print_an_address()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @print_an_address()
ret i32 0
}
/* Variables and functions */
char *ft_strccpy(char *, char const *, int);
scalar_t__ ft_strclen(char const *, int);
scalar_t__ malloc(scalar_t__);
char *ft_strcdup(const char *str, int c) {
  char *dup;
  dup = (char *)malloc(ft_strclen(str, c) + 1);
  return (ft_strccpy(dup, str, c));
}


x86 assembly (clang, -O0):
<ft_strcdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <ft_strclen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <ft_strccpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strcdup>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1050 <ft_strclen@plt>
lea    0x1(%rax),%rdi
call   1040 <malloc@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <ft_strccpy@plt>

LLVM IR (-O0):
define i8* @ft_strcdup(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i64 @ft_strclen(i8* %6, i32 %7)
%9 = add nsw i64 %8, 1
%10 = call i64 @malloc(i64 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = call i8* @ft_strccpy(i8* %12, i8* %13, i32 %14)
ret i8* %15
}

LLVM IR (-O2):
define i8* @ft_strcdup(i8* %0, i32 %1) {
%3 = tail call i64 @ft_strclen(i8* %0, i32 %1)
%4 = add nsw i64 %3, 1
%5 = tail call i64 @malloc(i64 %4)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i8* @ft_strccpy(i8* %6, i8* %0, i32 %1)
ret i8* %7
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ nrerror(char *);
double *dvector(long nl, long nh) {
  double *v;
  v = (double *)malloc((size_t)((nh - nl + 2) * sizeof(double)));
  if (!v)
    nrerror("allocation failure in dvector()");
  return v - nl + 1;
}


x86 assembly (clang, -O0):
<dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
sub    -0x8(%rbp),%rdi
add    $0x2,%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1160 <dvector+0x40>
lea    0xea5(%rip),%rdi
call   1030 <nrerror@plt>
mov    -0x18(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0x8,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dvector>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
sub    %rdi,%rsi
lea    0x10(,%rsi,8),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114b <dvector+0x2b>
lea    0xeba(%rip),%rdi
call   1030 <nrerror@plt>
shl    $0x3,%r14
sub    %r14,%rbx
add    $0x8,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"allocation failure in dvector()\00"
define double* @dvector(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca double*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = load i64, i64* %3
%8 = sub nsw i64 %6, %7
%9 = add nsw i64 %8, 2
%10 = mul i64 %9, 8
%11 = call i64 @malloc(i64 %10)
%12 = inttoptr i64 %11 to double*
store double* %12, double** %5
%13 = load double*, double** %5
%14 = icmp ne double* %13, null
br i1 %14, label %17, label %15
15: ; preds = %2
%16 = call i32 @nrerror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
%18 = load double*, double** %5
%19 = load i64, i64* %3
%20 = sub i64 0, %19
%21 = getelementptr inbounds double, double* %18, i64 %20
%22 = getelementptr inbounds double, double* %21, i64 1
ret double* %22
}

LLVM IR (-O2):
@.str = [32 x i8] c"allocation failure in dvector()\00"
define double* @dvector(i64 %0, i64 %1) {
%3 = sub nsw i64 %1, %0
%4 = shl i64 %3, 3
%5 = add i64 %4, 16
%6 = tail call i64 @malloc(i64 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 @nrerror(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = inttoptr i64 %6 to double*
%12 = sub i64 0, %0
%13 = getelementptr inbounds double, double* %11, i64 %12
%14 = getelementptr inbounds double, double* %13, i64 1
ret double* %14
}
void rho_ruby_raise_runtime(const char *szText) { ; }


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

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

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

LLVM IR (-O2):
define void @rho_ruby_raise_runtime(i8* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ tolower(char);
int util_chars_to_square(char *move_str) {
  int x = (int)(tolower(move_str[0]) - 'a'), y = (int)(move_str[1] - '0') - 1;
  return y * 8 + x;
}


x86 assembly (clang, -O0):
<util_chars_to_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
sub    $0x61,%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
sub    $0x30,%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x3,%eax
add    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_chars_to_square>:
push   %rbx
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <tolower@plt>
movsbl 0x1(%rbx),%ecx
lea    (%rax,%rcx,8),%eax
add    $0xfffffe17,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @util_chars_to_square(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = call i64 @tolower(i8 signext %7)
%9 = sub nsw i64 %8, 97
%10 = trunc i64 %9 to i32
store i32 %10, i32* %3
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 48
%16 = sub nsw i32 %15, 1
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = mul nsw i32 %17, 8
%19 = load i32, i32* %3
%20 = add nsw i32 %18, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @util_chars_to_square(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i64 @tolower(i8 signext %2)
%4 = trunc i64 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = shl nsw i32 %7, 3
%9 = add i32 %4, -489
%10 = add i32 %9, %8
ret i32 %10
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
unsigned long long ceil(float);
unsigned long long int CalcNumSeedsPerSeq(uint64_t seq_length,
                                          uint64_t seed_length,
                                          uint64_t seed_step) {
  if (seed_step == 0 || seed_length == 0 || seq_length == 0)
    return 0;
  return (ceil(((float)(seq_length - seed_length + 1)) / seed_step));
}


x86 assembly (clang, -O0):
<CalcNumSeedsPerSeq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1145 <CalcNumSeedsPerSeq+0x35>
cmpq   $0x0,-0x18(%rbp)
je     1145 <CalcNumSeedsPerSeq+0x35>
cmpq   $0x0,-0x10(%rbp)
jne    1152 <CalcNumSeedsPerSeq+0x42>
movq   $0x0,-0x8(%rbp)
jmp    1176 <CalcNumSeedsPerSeq+0x66>
mov    -0x10(%rbp),%rax
sub    -0x18(%rbp),%rax
add    $0x1,%rax
cvtsi2ss %rax,%xmm0
cvtsi2ssq -0x20(%rbp),%xmm1
divss  %xmm1,%xmm0
call   1030 <ceil@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalcNumSeedsPerSeq>:
test   %rdi,%rdi
je     1139 <CalcNumSeedsPerSeq+0x29>
test   %rsi,%rsi
je     1139 <CalcNumSeedsPerSeq+0x29>
test   %rdx,%rdx
je     1139 <CalcNumSeedsPerSeq+0x29>
sub    %rsi,%rdi
add    $0x1,%rdi
cvtsi2ss %rdi,%xmm0
cvtsi2ss %rdx,%xmm1
divss  %xmm1,%xmm0
jmp    1030 <ceil@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @CalcNumSeedsPerSeq(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%8 = load i64, i64* %7
%9 = icmp eq i64 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %3
%11 = load i64, i64* %6
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = load i64, i64* %5
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %13, %10, %3
store i64 0, i64* %4
br label %27
17: ; preds = %13
%18 = load i64, i64* %5
%19 = load i64, i64* %6
%20 = sub nsw i64 %18, %19
%21 = add nsw i64 %20, 1
%22 = sitofp i64 %21 to float
%23 = load i64, i64* %7
%24 = sitofp i64 %23 to float
%25 = fdiv float %22, %24
%26 = call i64 @ceil(float %25)
store i64 %26, i64* %4
br label %27
27: ; preds = %17, %16
%28 = load i64, i64* %4
ret i64 %28
}

LLVM IR (-O2):
define i64 @CalcNumSeedsPerSeq(i64 %0, i64 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
%5 = icmp eq i64 %1, 0
%6 = or i1 %5, %4
%7 = icmp eq i64 %0, 0
%8 = or i1 %7, %6
br i1 %8, label %16, label %9
9: ; preds = %3
%10 = add i64 %0, 1
%11 = sub i64 %10, %1
%12 = sitofp i64 %11 to float
%13 = sitofp i64 %2 to float
%14 = fdiv float %12, %13
%15 = tail call i64 @ceil(float %14)
br label %16
16: ; preds = %3, %9
%17 = phi i64 [ %15, %9 ], [ 0, %3 ]
ret i64 %17
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long value_mask;
};
typedef TYPE_1__ XConfigureRequestEvent;

/* Variables and functions */
void set_XConfigureRequestEvent_value_mask(void *_p, unsigned long _v) {
  ((XConfigureRequestEvent *)_p)->value_mask = (unsigned long)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XConfigureRequestEvent_value_mask(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XConfigureRequestEvent_value_mask(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
int fp64(void) { return 6; }


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

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

LLVM IR (-O0):
define i32 @fp64() {
ret i32 6
}

LLVM IR (-O2):
define i32 @fp64() {
ret i32 6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("hello,world"); }


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"hello,world\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SCOTCH_randomReset();
void SCOTCHFRANDOMRESET() { SCOTCH_randomReset(); }


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

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

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

LLVM IR (-O2):
define void @SCOTCHFRANDOMRESET() {
%1 = tail call i32 (...) @SCOTCH_randomReset()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bubble_sort(int *, int /*<<< orphan*/);
int /*<<< orphan*/ bubble_sort_reverse(int *, int /*<<< orphan*/);
int /*<<< orphan*/ length;
int /*<<< orphan*/ printf(char *);
int main(void) {
  extern length;
  int arr[] = {3, 4, 6, 2, 5, 4, 1, 5, 9, 8, 7};
  bubble_sort(arr, length);
  printf("\n\n");
  bubble_sort_reverse(arr, length);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xead(%rip),%rsi
mov    $0x2c,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    0x2e78(%rip),%rax
mov    (%rax),%esi
call   1060 <bubble_sort@plt>
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    0x2e5a(%rip),%rax
mov    (%rax),%esi
call   1050 <bubble_sort_reverse@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
movups 0xede(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeaa(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0x2e7f(%rip),%r14
mov    (%r14),%esi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <bubble_sort@plt>
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1040 <bubble_sort_reverse@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.arr = [11 x i32] [i32 3, i32 4, i32 6, i32 2, i32 5, i32 4, i32 1, i32 5, i32 9, i32 8, i32 7]
@length = global i32 0
@.str = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%4 = load i32, i32* @length
%5 = call i32 @bubble_sort(i32* %3, i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%8 = load i32, i32* @length
%9 = call i32 @bubble_sort_reverse(i32* %7, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [11 x i32] [i32 3, i32 4, i32 6, i32 2, i32 5, i32 4, i32 1, i32 5, i32 9, i32 8, i32 7]
@length = global i32 0
@str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%4 = load i32, i32* @length
%5 = call i32 @bubble_sort(i32* %3, i32 %4)
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%7 = load i32, i32* @length
%8 = call i32 @bubble_sort_reverse(i32* %3, i32 %7)
ret i32 0
}
unsigned int getcouleur(int mode) {
  switch (mode) {
  case 1:
    return (230 << (0 * 8)) | (120 << (1 * 8)) | (18 << (2 * 8));
  case 3:
    return (120 << (1 * 8)) | (252 << (0 * 8)) | (18 << (2 * 8));
  case 2:
    return (160 << (1 * 8)) | (236 << (0 * 8)) | (40 << (2 * 8));
  case 0:
    return (40 << (2 * 8)) | (220 << (0 * 8)) | (140 << (1 * 8));
  case 4:
    return (200 << (1 * 8)) | (80 << (0 * 8)) | (18 << (2 * 8));
  case 5:
    return (250 << (2 * 8)) | (30 << (1 * 8)) | (80 << (0 * 8));
  case 6:
    return (16 << (2 * 8)) | (16 << (1 * 8)) | (16 << (0 * 8));
  }
  return 0;
}


x86 assembly (clang, -O0):
<getcouleur>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x6,%rax
ja     1180 <getcouleur+0x80>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1278e6,-0x4(%rbp)
jmp    1187 <getcouleur+0x87>
movl   $0x1278fc,-0x4(%rbp)
jmp    1187 <getcouleur+0x87>
movl   $0x28a0ec,-0x4(%rbp)
jmp    1187 <getcouleur+0x87>
movl   $0x288cdc,-0x4(%rbp)
jmp    1187 <getcouleur+0x87>
movl   $0x12c850,-0x4(%rbp)
jmp    1187 <getcouleur+0x87>
movl   $0xfa1e50,-0x4(%rbp)
jmp    1187 <getcouleur+0x87>
movl   $0x101010,-0x4(%rbp)
jmp    1187 <getcouleur+0x87>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcouleur>:
xor    %eax,%eax
cmp    $0x6,%edi
ja     1114 <getcouleur+0x14>
movslq %edi,%rax
lea    0xeef(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @getcouleur(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %12 [
i32 1, label %5
i32 3, label %6
i32 2, label %7
i32 0, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
]
5: ; preds = %1
store i32 1210598, i32* %2
br label %13
6: ; preds = %1
store i32 1210620, i32* %2
br label %13
7: ; preds = %1
store i32 2662636, i32* %2
br label %13
8: ; preds = %1
store i32 2657500, i32* %2
br label %13
9: ; preds = %1
store i32 1230928, i32* %2
br label %13
10: ; preds = %1
store i32 16391760, i32* %2
br label %13
11: ; preds = %1
store i32 1052688, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11, %10, %9, %8, %7, %6, %5
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@switch.table.getcouleur = [7 x i32] [i32 2657500, i32 1210598, i32 2662636, i32 1210620, i32 1230928, i32 16391760, i32 1052688]
define i32 @getcouleur(i32 %0) {
%2 = icmp ult i32 %0, 7
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [7 x i32], [7 x i32]* @switch.table.getcouleur, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int kill(int n, int m) {
  errno = EINVAL;
  return -1;
}


x86 assembly (clang, -O0):
<kill>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ec7(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec6(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
@errno = global i32 0
define i32 @kill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @EINVAL
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EINVAL = global i32 0
@errno = global i32 0
define i32 @kill(i32 %0, i32 %1) {
%3 = load i32, i32* @EINVAL
store i32 %3, i32* @errno
ret i32 -1
}
/* Type definitions */
struct kgsl_device_private {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ BUG();
long adreno_compat_ioctl(struct kgsl_device_private *dev_priv, unsigned int cmd,
                         void *data) {
  BUG();
}


x86 assembly (clang, -O0):
<adreno_compat_ioctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    $0x0,%al
call   1030 <BUG@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.kgsl_device_private = type { i32 }
define i64 @adreno_compat_ioctl(%struct.kgsl_device_private* %0, i32 %1, i8* %2) {
%4 = alloca i64
%5 = alloca %struct.kgsl_device_private*
%6 = alloca i32
%7 = alloca i8*
store %struct.kgsl_device_private* %0, %struct.kgsl_device_private** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%8 = call i32 (...) @BUG()
%9 = load i64, i64* %4
ret i64 %9
}

LLVM IR (-O2):
%struct.kgsl_device_private = type { i32 }
define i64 @adreno_compat_ioctl(%struct.kgsl_device_private* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 (...) @BUG()
ret i64 undef
}
/* Variables and functions */
int /*<<< orphan*/ DOWN();
int UP();
int /*<<< orphan*/ cliente();
int /*<<< orphan*/ executa_processo();
int /*<<< orphan*/ printf(char *);
void barbeiro() {
  if (UP() == 1) {
    printf("Barbeiro trabalha!\n");
    executa_processo();
    DOWN();
  } else {
    printf("Cliente espera\n");
    cliente();
  }
}


x86 assembly (clang, -O0):
<barbeiro>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <UP@plt>
cmp    $0x1,%eax
jne    1183 <barbeiro+0x33>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <executa_processo@plt>
mov    $0x0,%al
call   1070 <DOWN@plt>
jmp    1196 <barbeiro+0x46>
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <cliente@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<barbeiro>:
push   %rax
xor    %eax,%eax
call   1040 <UP@plt>
cmp    $0x1,%eax
jne    1178 <barbeiro+0x28>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1060 <executa_processo@plt>
xor    %eax,%eax
pop    %rcx
jmp    1070 <DOWN@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <cliente@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Barbeiro trabalha!\0A\00"
@.str.1 = [16 x i8] c"Cliente espera\0A\00"
define void @barbeiro() {
%1 = call i32 (...) @UP()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (...) @executa_processo()
%6 = call i32 (...) @DOWN()
br label %10
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (...) @cliente()
br label %10
10: ; preds = %7, %3
ret void
}

LLVM IR (-O2):
@str = [15 x i8] c"Cliente espera\00"
@str.2 = [19 x i8] c"Barbeiro trabalha!\00"
define void @barbeiro() {
%1 = tail call i32 (...) @UP()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 (...) @executa_processo()
%6 = tail call i32 (...) @DOWN()
br label %10
7: ; preds = %0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 (...) @cliente()
br label %10
10: ; preds = %7, %3
ret void
}
/* Variables and functions */
int FileDescrForEntry(int);
int SerialPortIsOpen(int portNum) { return FileDescrForEntry(portNum) != -1; }


x86 assembly (clang, -O0):
<SerialPortIsOpen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <FileDescrForEntry@plt>
cmp    $0xffffffff,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SerialPortIsOpen(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @FileDescrForEntry(i32 %3)
%5 = icmp ne i32 %4, -1
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @SerialPortIsOpen(i32 %0) {
%2 = tail call i32 @FileDescrForEntry(i32 %0)
%3 = icmp ne i32 %2, -1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(char);
int isnumeric(char *str) {
  while (*str) {
    if (!isdigit(*str))
      return 0;
    str++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isnumeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115b <isnumeric+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    114a <isnumeric+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1162 <isnumeric+0x52>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <isnumeric+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnumeric>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <isnumeric+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1149 <isnumeric+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <isnumeric+0x20>
jmp    114b <isnumeric+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isnumeric(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isdigit(i8 signext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}
char getc() {
  int c;
  __asm__("mov $0x01, %eax");
  __asm__("int $0x84");
  __asm__("movl %%edx, %0" : "=r"(c));
  return (char)c;
}


x86 assembly (clang, -O0):
<getc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
int    $0x84
mov    %edx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getc>:
mov    $0x1,%eax
int    $0x84
mov    %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @getc() {
%1 = alloca i32
%2 = call i32 asm "movl %edx, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @getc() {
tail call void asm sideeffect "mov $$0x01, %eax", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "int $$0x84", "~{dirflag},~{fpsr},~{flags}"()
%1 = tail call i32 asm "movl %edx, $0", "=r,~{dirflag},~{fpsr},~{flags}"()
%2 = trunc i32 %1 to i8
ret i8 %2
}