xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
int /*<<< orphan*/ usleep(int);
void *txthread_loop(void *arg) {
  int txon = 1;
  (void)arg;
  while (txon) {
    usleep(1000 * 1000);
  }
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<txthread_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     114c <txthread_loop+0x2c>
mov    $0xf4240,%edi
call   1040 <usleep@plt>
jmp    1133 <txthread_loop+0x13>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<txthread_loop>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xf4240,%edi
call   1030 <usleep@plt>
jmp    1120 <txthread_loop+0x10>

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

LLVM IR (-O2):
define noalias i8* @txthread_loop(i8* nocapture readnone %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @usleep(i32 1000000)
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ jmp_buf;

/* Variables and functions */
int /*<<< orphan*/ setjmp(int /*<<< orphan*/);
int foo(int x) {
  static int thestatic;
  int retval;
  jmp_buf env;
  thestatic = x;
  retval = thestatic + x;
  setjmp(env);
  return retval;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,0x2f08(%rip)
mov    0x2f02(%rip),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <setjmp@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%eax
lea    (%rax,%rax,1),%ebx
call   1030 <setjmp@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@foo.thestatic = internal global i32 0
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
store i32 %5, i32* @foo.thestatic
%6 = load i32, i32* @foo.thestatic
%7 = load i32, i32* %2
%8 = add nsw i32 %6, %7
store i32 %8, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @setjmp(i32 %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = call i32 @setjmp(i32 undef)
ret i32 %2
}
void inc(int *posi) {
  if (*posi + 1 == 8) {
    *posi = 0;
  } else {
    ++*posi;
  }
}


x86 assembly (clang, -O0):
<inc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0x1,%eax
cmp    $0x8,%eax
jne    1129 <inc+0x29>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
jmp    1134 <inc+0x34>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc>:
mov    (%rdi),%eax
add    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x8,%eax
cmovne %eax,%ecx
mov    %ecx,(%rdi)
ret

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

LLVM IR (-O2):
define void @inc(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, 1
%4 = icmp eq i32 %3, 8
%5 = select i1 %4, i32 0, i32 %3
store i32 %5, i32* %0
ret void
}
void ble_rsp_attclient_read_by_handle(
    const struct ble_msg_attclient_read_by_handle_rsp_t *msg) {}


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

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

LLVM IR (-O0):
%struct.ble_msg_attclient_read_by_handle_rsp_t = type opaque
define void @ble_rsp_attclient_read_by_handle(%struct.ble_msg_attclient_read_by_handle_rsp_t* %0) {
%2 = alloca %struct.ble_msg_attclient_read_by_handle_rsp_t*
store %struct.ble_msg_attclient_read_by_handle_rsp_t* %0, %struct.ble_msg_attclient_read_by_handle_rsp_t** %2
ret void
}

LLVM IR (-O2):
%struct.ble_msg_attclient_read_by_handle_rsp_t = type opaque
define void @ble_rsp_attclient_read_by_handle(%struct.ble_msg_attclient_read_by_handle_rsp_t* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SA1Absolute(int);
int /*<<< orphan*/ STA8(int /*<<< orphan*/);
void Op8DM1(void) { STA8(SA1Absolute(2)); }


x86 assembly (clang, -O0):
<Op8DM1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <SA1Absolute@plt>
mov    %eax,%edi
call   1040 <STA8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op8DM1>:
push   %rax
mov    $0x2,%edi
call   1030 <SA1Absolute@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <STA8@plt>

LLVM IR (-O0):
define void @Op8DM1() {
%1 = call i32 @SA1Absolute(i32 2)
%2 = call i32 @STA8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op8DM1() {
%1 = tail call i32 @SA1Absolute(i32 2)
%2 = tail call i32 @STA8(i32 %1)
ret void
}
/* Type definitions */
struct list_head {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ list_last(struct list_head *);
int /*<<< orphan*/ sys_list_add(struct list_head *, int /*<<< orphan*/);
void list_push_back(struct list_head *node, struct list_head *head) {
  sys_list_add(node, list_last(head));
}


x86 assembly (clang, -O0):
<list_push_back>:
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    -0x10(%rbp),%rdi
call   1030 <list_last@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <sys_list_add@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_push_back>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <list_last@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <sys_list_add@plt>

LLVM IR (-O0):
%struct.list_head = type { i32 }
define void @list_push_back(%struct.list_head* %0, %struct.list_head* %1) {
%3 = alloca %struct.list_head*
%4 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %3
store %struct.list_head* %1, %struct.list_head** %4
%5 = load %struct.list_head*, %struct.list_head** %3
%6 = load %struct.list_head*, %struct.list_head** %4
%7 = call i32 @list_last(%struct.list_head* %6)
%8 = call i32 @sys_list_add(%struct.list_head* %5, i32 %7)
ret void
}

LLVM IR (-O2):
%struct.list_head = type { i32 }
define void @list_push_back(%struct.list_head* %0, %struct.list_head* %1) {
%3 = tail call i32 @list_last(%struct.list_head* %1)
%4 = tail call i32 @sys_list_add(%struct.list_head* %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void delete (void **ptr) {
  if (!ptr)
    return;
  if (*ptr) {
    free(*ptr);
    *ptr = NULL;
  }
}


x86 assembly (clang, -O0):
<delete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <delete+0x1c>
jmp    1151 <delete+0x41>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1151 <delete+0x41>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete>:
push   %rbx
test   %rdi,%rdi
je     112d <delete+0x1d>
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     112d <delete+0x1d>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @delete(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @free(i8* %4)
store i8* null, i8** %0
br label %8
8: ; preds = %1, %6, %3
ret void
}
/* Variables and functions */
int STRCMP(char *, char *);
int /*<<< orphan*/ print(int);
int /*<<< orphan*/ printid(char *);
void main() {
  char s1[] = "abc";
  char s2[] = "defg";
  int n;
  printid(s1);
  printid(s2);
  n = STRCMP(s1, s2);
  print(n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec2(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xebd(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xeb8(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x4(%rbp),%rdi
call   1040 <printid@plt>
lea    -0x9(%rbp),%rdi
call   1040 <printid@plt>
lea    -0x4(%rbp),%rdi
lea    -0x9(%rbp),%rsi
call   1050 <STRCMP@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x636261,0x14(%rsp)
movb   $0x0,0x10(%rsp)
movl   $0x67666564,0xc(%rsp)
67
lea    0x14(%rsp),%r14
mov    %r14,%rdi
call   1040 <printid@plt>
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <printid@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <STRCMP@plt>
mov    %eax,%edi
call   1030 <print@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s1 = [4 x i8] c"abc\00"
@__const.main.s2 = [5 x i8] c"defg\00"
define void @main() {
%1 = alloca [4 x i8]
%2 = alloca [5 x i8]
%3 = alloca i32
%4 = bitcast [4 x i8]* %1 to i8*
%5 = bitcast [5 x i8]* %2 to i8*
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%7 = call i32 @printid(i8* %6)
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%9 = call i32 @printid(i8* %8)
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%12 = call i32 @STRCMP(i8* %10, i8* %11)
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = call i32 @print(i32 %13)
ret void
}

LLVM IR (-O2):
@__const.main.s2 = [5 x i8] c"defg\00"
define void @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = bitcast i32* %1 to i8*
store i32 6513249, i32* %1
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i32 @printid(i8* %3)
%6 = call i32 @printid(i8* %4)
%7 = call i32 @STRCMP(i8* %3, i8* %4)
%8 = call i32 @print(i32 %7)
ret void
}
/* Variables and functions */
double __ocml_log2_f64(double);
double log2(double x) { return __ocml_log2_f64(x); }


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

x86 assembly (clang, -O2):
<log2>:
jmp    1030 <__ocml_log2_f64@plt>

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

LLVM IR (-O2):
define double @log2(double %0) {
%2 = tail call double @__ocml_log2_f64(double %0)
ret double %2
}
/* Variables and functions */
int rand();
int extra_randomInt(int nMin, int nMax) {
  return rand() % (nMax - nMin) + nMin;
}


x86 assembly (clang, -O0):
<extra_randomInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extra_randomInt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @extra_randomInt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @rand()
%6 = load i32, i32* %4
%7 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = srem i32 %5, %8
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @extra_randomInt(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub nsw i32 %1, %0
%5 = srem i32 %3, %4
%6 = add nsw i32 %5, %0
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ init_skill_group_tab();
void init_skill(void) { init_skill_group_tab(); }


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

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

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

LLVM IR (-O2):
define void @init_skill() {
%1 = tail call i32 (...) @init_skill_group_tab()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ToneA();
void Melody() {
  ToneA();
  ToneA();
  ToneA();
  ToneA();
  ToneA();
  ToneA();
  ToneA();
  ToneA();
}


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

x86 assembly (clang, -O2):
<Melody>:
push   %rax
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
call   1030 <ToneA@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ToneA@plt>

LLVM IR (-O0):
define void @Melody() {
%1 = call i32 (...) @ToneA()
%2 = call i32 (...) @ToneA()
%3 = call i32 (...) @ToneA()
%4 = call i32 (...) @ToneA()
%5 = call i32 (...) @ToneA()
%6 = call i32 (...) @ToneA()
%7 = call i32 (...) @ToneA()
%8 = call i32 (...) @ToneA()
ret void
}

LLVM IR (-O2):
define void @Melody() {
%1 = tail call i32 (...) @ToneA()
%2 = tail call i32 (...) @ToneA()
%3 = tail call i32 (...) @ToneA()
%4 = tail call i32 (...) @ToneA()
%5 = tail call i32 (...) @ToneA()
%6 = tail call i32 (...) @ToneA()
%7 = tail call i32 (...) @ToneA()
%8 = tail call i32 (...) @ToneA()
ret void
}
extern int gui_ksys_get_state_menegers_keys(void) {
  int value;
  __asm__ __volatile__("int $0x40" : "=a"(value) : "a"(66), "b"(3));
  return (value);
}


x86 assembly (clang, -O0):
<gui_ksys_get_state_menegers_keys>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    $0x42,%eax
mov    $0x3,%ebx
int    $0x40
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_ksys_get_state_menegers_keys>:
push   %rbx
mov    $0x42,%eax
mov    $0x3,%ebx
int    $0x40
pop    %rbx
ret

LLVM IR (-O0):
define i32 @gui_ksys_get_state_menegers_keys() {
%1 = alloca i32
%2 = call i32 asm sideeffect "int $$0x40", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 66, i32 3)
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @gui_ksys_get_state_menegers_keys() {
%1 = tail call i32 asm sideeffect "int $$0x40", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 66, i32 3)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ isatty(int /*<<< orphan*/);
int read(int /*<<< orphan*/, char *, int);
KeyGetChar() {
  char c;
  while (read(0, &c, 1) != 1)
    if (!isatty(0))
      exit(0);
  return (c & 0377);
}


x86 assembly (clang, -O0):
<KeyGetChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0x1,%eax
je     116d <KeyGetChar+0x3d>
xor    %edi,%edi
call   1030 <isatty@plt>
cmp    $0x0,%eax
jne    1168 <KeyGetChar+0x38>
xor    %edi,%edi
call   1050 <exit@plt>
jmp    1138 <KeyGetChar+0x8>
movsbl -0x1(%rbp),%eax
and    $0xff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KeyGetChar>:
push   %rbx
sub    $0x10,%rsp
lea    0xf(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0x1,%eax
je     1166 <KeyGetChar+0x36>
xor    %edi,%edi
call   1030 <isatty@plt>
test   %eax,%eax
jne    1140 <KeyGetChar+0x10>
xor    %edi,%edi
call   1050 <exit@plt>
movzbl 0xf(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @KeyGetChar() {
%1 = alloca i8
br label %2
2: ; preds = %10, %0
%3 = call i32 @read(i32 0, i8* %1, i32 1)
%4 = icmp ne i32 %3, 1
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = call i32 @isatty(i32 0)
%7 = icmp ne i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = call i32 @exit(i32 0)
unreachable
10: ; preds = %5
br label %2
11: ; preds = %2
%12 = load i8, i8* %1
%13 = sext i8 %12 to i32
%14 = and i32 %13, 255
ret i32 %14
}

LLVM IR (-O2):
define i32 @KeyGetChar() {
%1 = alloca i8
br label %2
2: ; preds = %5, %0
%3 = call i32 @read(i32 0, i8* %1, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i32 @isatty(i32 0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %5
%9 = tail call i32 @exit(i32 0)
unreachable
10: ; preds = %2
%11 = load i8, i8* %1
%12 = zext i8 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void Gr_Free(void *ptr) { free(ptr); }


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

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

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

LLVM IR (-O2):
define void @Gr_Free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void set_tty(void) {}


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

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

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

LLVM IR (-O2):
define void @set_tty() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CheckExclusionTime();
Action() {
  CheckExclusionTime();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @Action() {
%1 = call i32 (...) @CheckExclusionTime()
ret i32 0
}

LLVM IR (-O2):
define i32 @Action() {
%1 = tail call i32 (...) @CheckExclusionTime()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int16_t swap2(int16_t data) {
  union {
    int16_t val;
    unsigned char chr[2];
  } in, out;
  in.val = data;
  out.chr[0] = in.chr[1];
  out.chr[1] = in.chr[0];
  return out.val;
}


x86 assembly (clang, -O0):
<swap2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x7(%rbp),%al
mov    %al,-0x10(%rbp)
mov    -0x8(%rbp),%al
mov    %al,-0xf(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap2>:
rol    $0x8,%di
movzwl %di,%eax
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @swap2(i32 %0) {
%2 = alloca i32
%3 = alloca %union.anon
%4 = alloca %union.anon
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = bitcast %union.anon* %3 to i32*
store i32 %5, i32* %6
%7 = bitcast %union.anon* %3 to [2 x i8]*
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
%9 = load i8, i8* %8
%10 = bitcast %union.anon* %4 to [2 x i8]*
%11 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
store i8 %9, i8* %11
%12 = bitcast %union.anon* %3 to [2 x i8]*
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %12, i64 0, i64 0
%14 = load i8, i8* %13
%15 = bitcast %union.anon* %4 to [2 x i8]*
%16 = getelementptr inbounds [2 x i8], [2 x i8]* %15, i64 0, i64 1
store i8 %14, i8* %16
%17 = bitcast %union.anon* %4 to i32*
%18 = load i32, i32* %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @swap2(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = tail call i16 @llvm.bswap.i16(i16 %2)
%4 = zext i16 %3 to i32
ret i32 %4
}
truecmd(argc, argv) char **argv;
{ return 0; }


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

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

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

LLVM IR (-O2):
define i32 @truecmd(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
uint8_t mod8(uint8_t a, uint8_t m) {
  while (a >= m)
    a -= m;
  return a;
}


x86 assembly (clang, -O0):
<mod8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jl     112e <mod8+0x2e>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <mod8+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod8>:
mov    %rdi,%rax
add    %rsi,%rax
cs nopw 0x0(%rax,%rax,1)
sub    %rsi,%rax
cmp    %rsi,%rax
jge    1110 <mod8+0x10>
ret

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

LLVM IR (-O2):
define i64 @mod8(i64 %0, i64 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %0, %2 ], [ %6, %3 ]
%5 = icmp slt i64 %4, %1
%6 = sub nsw i64 %4, %1
br i1 %5, label %7, label %3
7: ; preds = %3
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ absolutelongx();
int /*<<< orphan*/ adc16(int /*<<< orphan*/);
int /*<<< orphan*/ readmemw65816(int /*<<< orphan*/);
void adcLongx16(void) { adc16(readmemw65816(absolutelongx())); }


x86 assembly (clang, -O0):
<adcLongx16>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <absolutelongx@plt>
mov    %eax,%edi
call   1030 <readmemw65816@plt>
mov    %eax,%edi
call   1050 <adc16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<adcLongx16>:
push   %rax
xor    %eax,%eax
call   1040 <absolutelongx@plt>
mov    %eax,%edi
call   1030 <readmemw65816@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <adc16@plt>

LLVM IR (-O0):
define void @adcLongx16() {
%1 = call i32 (...) @absolutelongx()
%2 = call i32 @readmemw65816(i32 %1)
%3 = call i32 @adc16(i32 %2)
ret void
}

LLVM IR (-O2):
define void @adcLongx16() {
%1 = tail call i32 (...) @absolutelongx()
%2 = tail call i32 @readmemw65816(i32 %1)
%3 = tail call i32 @adc16(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _clear_error_stack();
void *_ptr_chain_add(void *, void const *);
void *ptr_chain_add(void *buf, const void *addr) {
  { _clear_error_stack(); };
  return (_ptr_chain_add(buf, addr));
}


x86 assembly (clang, -O0):
<ptr_chain_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <_clear_error_stack@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <_ptr_chain_add@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ptr_chain_add>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <_clear_error_stack@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <_ptr_chain_add@plt>

LLVM IR (-O0):
define i8* @ptr_chain_add(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (...) @_clear_error_stack()
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i8* @_ptr_chain_add(i8* %6, i8* %7)
ret i8* %8
}

LLVM IR (-O2):
define i8* @ptr_chain_add(i8* %0, i8* %1) {
%3 = tail call i32 (...) @_clear_error_stack()
%4 = tail call i8* @_ptr_chain_add(i8* %0, i8* %1)
ret i8* %4
}
int format_float(float x, char *buf, int n) { return 0; }


x86 assembly (clang, -O0):
<format_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @format_float(float %0, i8* %1, i32 %2) {
%4 = alloca float
%5 = alloca i8*
%6 = alloca i32
store float %0, float* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @format_float(float %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
float decode_salinity(unsigned char s) {
  if (s == 0)
    return s;
  else
    return (((float)s / 10.0) + 20.0);
}


x86 assembly (clang, -O0):
<decode_salinity>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
cmp    $0x0,%eax
jne    1129 <decode_salinity+0x29>
movzbl -0x5(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1156 <decode_salinity+0x56>
movzbl -0x5(%rbp),%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xecb(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xeb7(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_salinity>:
test   %edi,%edi
je     1121 <decode_salinity+0x21>
movzbl %dil,%eax
cvtsi2sd %eax,%xmm0
divsd  0xeec(%rip),%xmm0
addsd  0xeec(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @decode_salinity(i8 zeroext %0) {
%2 = alloca float
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8, i8* %3
%9 = uitofp i8 %8 to float
store float %9, float* %2
br label %17
10: ; preds = %1
%11 = load i8, i8* %3
%12 = uitofp i8 %11 to float
%13 = fpext float %12 to double
%14 = fdiv double %13, 1.000000e+01
%15 = fadd double %14, 2.000000e+01
%16 = fptrunc double %15 to float
store float %16, float* %2
br label %17
17: ; preds = %10, %7
%18 = load float, float* %2
ret float %18
}

LLVM IR (-O2):
define float @decode_salinity(i8 zeroext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = uitofp i8 %0 to double
%5 = fdiv double %4, 1.000000e+01
%6 = fadd double %5, 2.000000e+01
%7 = fptrunc double %6 to float
br label %8
8: ; preds = %1, %3
%9 = phi float [ %7, %3 ], [ 0.000000e+00, %1 ]
ret float %9
}
/* Variables and functions */
int F(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char const *argv[]) {
  int a;
  scanf("%d", &a);
  printf("%d", F(a));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%edi
call   1030 <F@plt>
mov    %eax,%esi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
call   1030 <F@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%8 = load i32, i32* %6
%9 = call i32 @F(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = call i32 @F(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
char *vle_cmds_at_arg(char const *);
char *vle_cmds_past_arg(char const *);
char *vle_cmds_next_arg(const char args[]) {
  args = vle_cmds_past_arg(args);
  return vle_cmds_at_arg(args);
}


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

x86 assembly (clang, -O2):
<vle_cmds_next_arg>:
push   %rax
call   1030 <vle_cmds_past_arg@plt>
mov    %rax,%rdi
pop    %rax
jmp    1040 <vle_cmds_at_arg@plt>

LLVM IR (-O0):
define i8* @vle_cmds_next_arg(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @vle_cmds_past_arg(i8* %3)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @vle_cmds_at_arg(i8* %5)
ret i8* %6
}

LLVM IR (-O2):
define i8* @vle_cmds_next_arg(i8* %0) {
%2 = tail call i8* @vle_cmds_past_arg(i8* %0)
%3 = tail call i8* @vle_cmds_at_arg(i8* %2)
ret i8* %3
}
void foo576(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo576(i32 %0) {
ret void
}
/* Variables and functions */
double atan(double);
double d_atan(double *x) { return (atan(*x)); }


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

x86 assembly (clang, -O2):
<d_atan>:
movsd  (%rdi),%xmm0
jmp    1030 <atan@plt>

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

LLVM IR (-O2):
define double @d_atan(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double @atan(double %2)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_array(int *arr, int nb_elements) {
  int i;
  for (i = 0; i < nb_elements; i++) {
    printf("%d ", arr[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print_array+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_array+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_array(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = 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 = [4 x i8] c"%d \00"
define void @print_array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
double read_double();
int /*<<< orphan*/ write_double(double);
int main() {
  double d;
  d = read_double();
  write_double(d);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call double (...) @read_double()
store double %3, double* %2
%4 = load double, double* %2
%5 = call i32 @write_double(double %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call double (...) @read_double()
%2 = tail call i32 @write_double(double %1)
ret i32 0
}
/* Variables and functions */
char tolower(char);
void ToLowerCase(char *text) {
  int i = 0;
  while (text[i] != '\0') {
    text[i] = tolower(text[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<ToLowerCase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1164 <ToLowerCase+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <ToLowerCase+0x13>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @ToLowerCase(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %11, %4 ], [ %2, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = tail call signext i8 @tolower(i8 signext %6)
store i8 %8, i8* %7
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GL_ONE_MINUS_SRC_ALPHA;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ GL_SRC_ALPHA;
int /*<<< orphan*/ glBlendFunc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ gluOrtho2D(int /*<<< orphan*/, int, int, int /*<<< orphan*/);
void gl_init() {
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glClearColor(1.0, 1.0, 1.0, 0.0);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluOrtho2D(0, 600, 800, 0);
}


x86 assembly (clang, -O0):
<gl_init>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    0x2e84(%rip),%rax
mov    (%rax),%esi
call   1030 <glBlendFunc@plt>
movsd  0xe8d(%rip),%xmm2
xorps  %xmm3,%xmm3
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1050 <glClearColor@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
mov    $0x0,%al
call   1060 <glLoadIdentity@plt>
xor    %ecx,%ecx
mov    $0x258,%esi
mov    $0x320,%edx
mov    %ecx,%edi
call   1070 <gluOrtho2D@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl_init>:
push   %rax
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
call   1030 <glBlendFunc@plt>
movsd  0xe90(%rip),%xmm0
xorps  %xmm3,%xmm3
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1050 <glClearColor@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
xor    %eax,%eax
call   1060 <glLoadIdentity@plt>
xor    %edi,%edi
mov    $0x258,%esi
mov    $0x320,%edx
xor    %ecx,%ecx
pop    %rax
jmp    1070 <gluOrtho2D@plt>

LLVM IR (-O0):
@GL_SRC_ALPHA = global i32 0
@GL_ONE_MINUS_SRC_ALPHA = global i32 0
@GL_PROJECTION = global i32 0
define void @gl_init() {
%1 = load i32, i32* @GL_SRC_ALPHA
%2 = load i32, i32* @GL_ONE_MINUS_SRC_ALPHA
%3 = call i32 @glBlendFunc(i32 %1, i32 %2)
%4 = call i32 @glClearColor(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 0.000000e+00)
%5 = load i32, i32* @GL_PROJECTION
%6 = call i32 @glMatrixMode(i32 %5)
%7 = call i32 (...) @glLoadIdentity()
%8 = call i32 @gluOrtho2D(i32 0, i32 600, i32 800, i32 0)
ret void
}

LLVM IR (-O2):
@GL_SRC_ALPHA = global i32 0
@GL_ONE_MINUS_SRC_ALPHA = global i32 0
@GL_PROJECTION = global i32 0
define void @gl_init() {
%1 = load i32, i32* @GL_SRC_ALPHA
%2 = load i32, i32* @GL_ONE_MINUS_SRC_ALPHA
%3 = tail call i32 @glBlendFunc(i32 %1, i32 %2)
%4 = tail call i32 @glClearColor(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 0.000000e+00)
%5 = load i32, i32* @GL_PROJECTION
%6 = tail call i32 @glMatrixMode(i32 %5)
%7 = tail call i32 (...) @glLoadIdentity()
%8 = tail call i32 @gluOrtho2D(i32 0, i32 600, i32 800, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ simplificar(int, int);
void mult(int n1, int d1, int n2, int d2) {
  int n = n1 * n2;
  int d = d1 * d2;
  printf("%d/%d = ", n, d);
  simplificar(n, d);
}


x86 assembly (clang, -O0):
<mult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <simplificar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mult>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
imul   %edx,%ebp
imul   %ecx,%ebx
lea    0xecc(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1040 <printf@plt>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <simplificar@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"%d/%d = \00"
define void @mult(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %7
%13 = mul nsw i32 %11, %12
store i32 %13, i32* %9
%14 = load i32, i32* %6
%15 = load i32, i32* %8
%16 = mul nsw i32 %14, %15
store i32 %16, i32* %10
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
%20 = load i32, i32* %9
%21 = load i32, i32* %10
%22 = call i32 @simplificar(i32 %20, i32 %21)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d/%d = \00"
define void @mult(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = mul nsw i32 %2, %0
%6 = mul nsw i32 %3, %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = tail call i32 @simplificar(i32 %5, i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void emit_help(void) {
  fputs("Usage: crosstalkc [-C dir] socket-path\n", stderr);
  exit(EX_USAGE);
}


x86 assembly (clang, -O0):
<emit_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<emit_help>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Usage: crosstalkc [-C dir] socket-path\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@.str = [40 x i8] c"Usage: crosstalkc [-C dir] socket-path\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ __coverity_alloc__(int);
void *EC_POINT_new(void *group) { __coverity_alloc__(10); }


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

x86 assembly (clang, -O2):
<EC_POINT_new>:
mov    $0xa,%edi
jmp    1030 <__coverity_alloc__@plt>

LLVM IR (-O0):
define i8* @EC_POINT_new(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 @__coverity_alloc__(i32 10)
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define noalias i8* @EC_POINT_new(i8* nocapture readnone %0) {
%2 = tail call i32 @__coverity_alloc__(i32 10)
ret i8* undef
}
int cmp(const void *a, const void *b) {
  const int pa = *(const int *)a;
  const int pb = *(const int *)b;
  return (pa - pb);
}


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

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

LLVM IR (-O0):
define i32 @cmp(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*
%9 = load i32, i32* %8
store i32 %9, i32* %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = sub nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int printf(char *, int);
int main(void) {
  int bph2o = 212;
  int rv;
  rv = printf("%d F is water's boiling point.\n", bph2o);
  printf("The printf () function printed %d characters.\n", rv);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd4,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xede(%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
mov    $0xd4,%esi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"%d F is water's boiling point.\0A\00"
@.str.1 = [47 x i8] c"The printf () function printed %d characters.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 212, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [32 x i8] c"%d F is water's boiling point.\0A\00"
@.str.1 = [47 x i8] c"The printf () function printed %d characters.\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 212)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i32 0
}