xunge/DecIR huggingface dataset:
int get_longest_line(char *buff) {
  int longest_len = 0, current_len = 0;
  char *c = buff;
  while (c++) {
    current_len++;
    if (*c == '\n') {
      if (current_len > longest_len) {
        longest_len = current_len;
        current_len = 0;
      }
    }
  }
  return longest_len;
}


x86 assembly (clang, -O0):
<get_longest_line>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     1173 <get_longest_line+0x73>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    116e <get_longest_line+0x6e>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1169 <get_longest_line+0x69>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    116e <get_longest_line+0x6e>
jmp    111e <get_longest_line+0x1e>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @get_longest_line(i8* %0) {
%2 = icmp eq i8* %0, null
ret i32 0
}
void foo_2_2_1_1_2_1_2_1_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_1_1_2_1_2_1_1() {
ret void
}
int test_imm_BCint32_reg(int val) { return ((val) & (0xBC << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_BCint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xbc,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_BCint32_reg>:
test   $0xbc,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_BCint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 188
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_BCint32_reg(i32 %0) {
%2 = and i32 %0, 188
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int test_imm_62uint32_reg(unsigned int val) {
  return ((val) & (0x62 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_62uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x62,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_62uint32_reg>:
test   $0x62,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_62uint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 98
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_62uint32_reg(i32 %0) {
%2 = and i32 %0, 98
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
struct node *lastNode(struct node *);
int /*<<< orphan*/ quickSortRecur(struct node *, struct node *);
void quickSort(struct node *head) {
  struct node *h = lastNode(head);
  quickSortRecur(head, h);
}


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

x86 assembly (clang, -O2):
<quickSort>:
push   %rbx
mov    %rdi,%rbx
call   1030 <lastNode@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1040 <quickSortRecur@plt>

LLVM IR (-O0):
%struct.node = type { i32 }
define void @quickSort(%struct.node* %0) {
%2 = alloca %struct.node*
%3 = alloca %struct.node*
store %struct.node* %0, %struct.node** %2
%4 = load %struct.node*, %struct.node** %2
%5 = call %struct.node* @lastNode(%struct.node* %4)
store %struct.node* %5, %struct.node** %3
%6 = load %struct.node*, %struct.node** %2
%7 = load %struct.node*, %struct.node** %3
%8 = call i32 @quickSortRecur(%struct.node* %6, %struct.node* %7)
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
define void @quickSort(%struct.node* %0) {
%2 = tail call %struct.node* @lastNode(%struct.node* %0)
%3 = tail call i32 @quickSortRecur(%struct.node* %0, %struct.node* %2)
ret void
}
int test_imm_65int16_reg(short val) {
  return ((val) & (0x65 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_65int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x65,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_65int16_reg>:
test   $0x65,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_65int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 101
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_65int16_reg(i16 signext %0) {
%2 = and i16 %0, 101
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
void testbench_write(const char *buf, unsigned len) {
  while (len > 0) {
    putchar(*(buf++));
    len--;
  }
}


x86 assembly (clang, -O0):
<testbench_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jbe    114e <testbench_write+0x3e>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <testbench_write+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testbench_write>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     1143 <testbench_write+0x33>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1130 <testbench_write+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @testbench_write(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ %1, %2 ]
%6 = phi i8* [ %7, %4 ], [ %0, %2 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = tail call i32 @putchar(i32 %9)
%11 = add i32 %5, -1
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %2
ret void
}
void pftrace_done(void) {}


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

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

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

LLVM IR (-O2):
define void @pftrace_done() {
ret void
}
char *fgaj_red(int c) { return c ? "[0;31m" : ""; }


x86 assembly (clang, -O0):
<fgaj_red>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xef6(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgaj_red>:
test   %edi,%edi
lea    0xefe(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[0;31m\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @fgaj_red(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[0;31m\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @fgaj_red(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
void _s_update() {}


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

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

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

LLVM IR (-O2):
define void @_s_update() {
ret void
}
void init_available_ns(void) {}


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

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

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

LLVM IR (-O2):
define void @init_available_ns() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void sleep_test() {
  sleep(5000);
  printf("\n");
}


x86 assembly (clang, -O0):
<sleep_test>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1388,%edi
call   1040 <sleep@plt>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep_test>:
push   %rax
mov    $0x1388,%edi
call   1040 <sleep@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @sleep_test() {
%1 = tail call i32 @sleep(i32 5000)
%2 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
scalar_t__ fopen(char *, char *);
int rand();
int /*<<< orphan*/ srand(long);
int randomNumber() {
  int number;
  srand((long)fopen("/dev/urandom", "r"));
  number = 1 + rand() % 16;
  return number;
}


x86 assembly (clang, -O0):
<randomNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xec7(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rdi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x10,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomNumber>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xece(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rdi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
lea    0xf(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff0,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/urandom\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @randomNumber() {
%1 = alloca i32
%2 = call i64 @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @srand(i64 %2)
%4 = call i32 (...) @rand()
%5 = srem i32 %4, 16
%6 = add nsw i32 1, %5
store i32 %6, i32* %1
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/urandom\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @randomNumber() {
%1 = tail call i64 @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @srand(i64 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 16
%5 = add nsw i32 %4, 1
ret i32 %5
}
void INT_Excep_DMAC_DMTEND0(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_DMAC_DMTEND0() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ int80(int, char *, char *, char *, int /*<<< orphan*/,
                         int /*<<< orphan*/, int /*<<< orphan*/);
char getSeconds() {
  char h;
  char mi;
  char s;
  int80(6, &h, &mi, &s, 0, 0, 0);
  return s;
}


x86 assembly (clang, -O0):
<getSeconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x6,%edi
lea    -0x1(%rbp),%rsi
lea    -0x2(%rbp),%rdx
lea    -0x3(%rbp),%rcx
xor    %r9d,%r9d
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1030 <int80@plt>
movsbl -0x3(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSeconds>:
sub    $0x18,%rsp
movl   $0x0,(%rsp)
lea    0x17(%rsp),%rsi
lea    0x16(%rsp),%rdx
lea    0x15(%rsp),%rcx
mov    $0x6,%edi
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <int80@plt>
mov    0x15(%rsp),%al
add    $0x18,%rsp
ret

LLVM IR (-O0):
define signext i8 @getSeconds() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = call i32 @int80(i32 6, i8* %1, i8* %2, i8* %3, i32 0, i32 0, i32 0)
%5 = load i8, i8* %3
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @getSeconds() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = call i32 @int80(i32 6, i8* %1, i8* %2, i8* %3, i32 0, i32 0, i32 0)
%5 = load i8, i8* %3
ret i8 %5
}
void right_trim(char *buf, char c) {
  char *s = buf - 1;
  for (; *buf; ++buf) {
    if (*buf != c)
      s = buf;
  }
  *++s = 0;
}


x86 assembly (clang, -O0):
<right_trim>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1158 <right_trim+0x58>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
je     1142 <right_trim+0x42>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1147 <right_trim+0x47>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111a <right_trim+0x1a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<right_trim>:
lea    -0x1(%rdi),%rax
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <right_trim+0x23>
nopw   0x0(%rax,%rax,1)
cmp    %sil,%cl
cmovne %rdi,%rax
movzbl 0x1(%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <right_trim+0x10>
movb   $0x0,0x1(%rax)
ret

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

LLVM IR (-O2):
define void @right_trim(i8* nocapture %0, i8 signext %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 -1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %2, %6
%7 = phi i8 [ %13, %6 ], [ %4, %2 ]
%8 = phi i8* [ %11, %6 ], [ %3, %2 ]
%9 = phi i8* [ %12, %6 ], [ %0, %2 ]
%10 = icmp eq i8 %7, %1
%11 = select i1 %10, i8* %8, i8* %9
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %6, %2
%16 = phi i8* [ %3, %2 ], [ %11, %6 ]
%17 = getelementptr inbounds i8, i8* %16, i64 1
store i8 0, i8* %17
ret void
}
void *heapRealloc(void *userData, void *ptr, unsigned int size) {
  do {
    (void)(1 ? (void)0 : ((void)(userData)));
  } while (0);
  return realloc(ptr, size);
}


x86 assembly (clang, -O0):
<heapRealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
jmp    1128 <heapRealloc+0x18>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
mov    %eax,%esi
call   1030 <realloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heapRealloc>:
mov    %rsi,%rdi
mov    %edx,%esi
jmp    1030 <realloc@plt>

LLVM IR (-O0):
define i8* @heapRealloc(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
br label %7
7: ; preds = %3
br label %8
8: ; preds = %7
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = zext i32 %10 to i64
%12 = call i8* @realloc(i8* %9, i64 %11)
ret i8* %12
}

LLVM IR (-O2):
define noalias i8* @heapRealloc(i8* nocapture readnone %0, i8* nocapture %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = tail call i8* @realloc(i8* %1, i64 %4)
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ GL_DEPTH_TEST;
int /*<<< orphan*/ GL_LIGHT0;
int /*<<< orphan*/ GL_LIGHTING;
int /*<<< orphan*/ GL_SMOOTH;
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glShadeModel(int /*<<< orphan*/);
void movelight_init(void) {
  glClearColor(0.0, 0.0, 0.0, 0.0);
  glShadeModel(GL_SMOOTH);
  glEnable(GL_LIGHTING);
  glEnable(GL_LIGHT0);
  glEnable(GL_DEPTH_TEST);
}


x86 assembly (clang, -O0):
<movelight_init>:
push   %rbp
mov    %rsp,%rbp
xorps  %xmm3,%xmm3
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
movaps %xmm3,%xmm2
call   1040 <glClearColor@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1050 <glShadeModel@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
call   1030 <glEnable@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1030 <glEnable@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1030 <glEnable@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<movelight_init>:
push   %rax
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
xorps  %xmm3,%xmm3
call   1040 <glClearColor@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
call   1050 <glShadeModel@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1030 <glEnable@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
call   1030 <glEnable@plt>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1030 <glEnable@plt>

LLVM IR (-O0):
@GL_SMOOTH = global i32 0
@GL_LIGHTING = global i32 0
@GL_LIGHT0 = global i32 0
@GL_DEPTH_TEST = global i32 0
define void @movelight_init() {
%1 = call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%2 = load i32, i32* @GL_SMOOTH
%3 = call i32 @glShadeModel(i32 %2)
%4 = load i32, i32* @GL_LIGHTING
%5 = call i32 @glEnable(i32 %4)
%6 = load i32, i32* @GL_LIGHT0
%7 = call i32 @glEnable(i32 %6)
%8 = load i32, i32* @GL_DEPTH_TEST
%9 = call i32 @glEnable(i32 %8)
ret void
}

LLVM IR (-O2):
@GL_SMOOTH = global i32 0
@GL_LIGHTING = global i32 0
@GL_LIGHT0 = global i32 0
@GL_DEPTH_TEST = global i32 0
define void @movelight_init() {
%1 = tail call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%2 = load i32, i32* @GL_SMOOTH
%3 = tail call i32 @glShadeModel(i32 %2)
%4 = load i32, i32* @GL_LIGHTING
%5 = tail call i32 @glEnable(i32 %4)
%6 = load i32, i32* @GL_LIGHT0
%7 = tail call i32 @glEnable(i32 %6)
%8 = load i32, i32* @GL_DEPTH_TEST
%9 = tail call i32 @glEnable(i32 %8)
ret void
}
/* Variables and functions */
int sqrtf(float);
float invSqrt(float x) { return 1 / sqrtf(x); }


x86 assembly (clang, -O0):
<invSqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sqrtf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<invSqrt>:
push   %rax
call   1030 <sqrtf@plt>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x3,%ecx
cmovb  %eax,%edx
xorps  %xmm0,%xmm0
cvtsi2ss %edx,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @invSqrt(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @sqrtf(float %3)
%5 = sdiv i32 1, %4
%6 = sitofp i32 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @invSqrt(float %0) {
%2 = tail call i32 @sqrtf(float %0)
%3 = add i32 %2, 1
%4 = icmp ult i32 %3, 3
%5 = select i1 %4, i32 %2, i32 0
%6 = sitofp i32 %5 to float
ret float %6
}
int get_n_bytes_readable_on_socket(int fd) { return 4096; }


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

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

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

LLVM IR (-O2):
define i32 @get_n_bytes_readable_on_socket(i32 %0) {
ret i32 4096
}
/* Variables and functions */
unsigned int cgc_strlen(char const *);
int /*<<< orphan*/ write_bytes(char const *, unsigned int);
int /*<<< orphan*/ write_int(unsigned int);
void write_string(const char *str) {
  unsigned int length = cgc_strlen(str);
  write_int(length);
  write_bytes(str, length);
}


x86 assembly (clang, -O0):
<write_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <cgc_strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <write_int@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <write_bytes@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_string>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <cgc_strlen@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1040 <write_int@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <write_bytes@plt>

LLVM IR (-O0):
define void @write_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @cgc_strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @write_int(i32 %6)
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = call i32 @write_bytes(i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @write_string(i8* %0) {
%2 = tail call i32 @cgc_strlen(i8* %0)
%3 = tail call i32 @write_int(i32 %2)
%4 = tail call i32 @write_bytes(i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memmove(char *, char *, int);
int /*<<< orphan*/ puts(char *);
int main() {
  char str[] = "memmove can be very useful......";
  memmove(str + 20, str + 15, 11);
  puts(str + 20);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x21,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
add    $0x14,%rdi
lea    -0x30(%rbp),%rsi
add    $0xf,%rsi
mov    $0xb,%edx
call   1050 <memmove@plt>
lea    -0x30(%rbp),%rdi
add    $0x14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movaps 0xee4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
movb   $0x0,0x20(%rsp)
lea    0x14(%rsp),%rbx
lea    0xf(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xb,%edx
call   1040 <memmove@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [33 x i8] c"memmove can be very useful......\00"
define i32 @main() {
%1 = alloca [33 x i8]
%2 = bitcast [33 x i8]* %1 to i8*
%3 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds i8, i8* %3, i64 20
%5 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds i8, i8* %5, i64 15
%7 = call i32 @memmove(i8* %4, i8* %6, i32 11)
%8 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 0
%9 = getelementptr inbounds i8, i8* %8, i64 20
%10 = call i32 @puts(i8* %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [33 x i8] c"memmove can be very useful......\00"
define i32 @main() {
%1 = alloca [33 x i8]
%2 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 20
%4 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 15
%5 = call i32 @memmove(i8* %3, i8* %4, i32 11)
%6 = call i32 @puts(i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ FNFILTER_set_paranoid(int);
int MIME_set_paranoid(int level) {
  FNFILTER_set_paranoid(level);
  return level;
}


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

x86 assembly (clang, -O2):
<MIME_set_paranoid>:
push   %rbx
mov    %edi,%ebx
call   1030 <FNFILTER_set_paranoid@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @MIME_set_paranoid(i32 returned %0) {
%2 = tail call i32 @FNFILTER_set_paranoid(i32 %0)
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
int GetFileType(char *pname) {
  if (pname != NULL)
    strcpy(pname, "PCE");
  return 0;
}


x86 assembly (clang, -O0):
<GetFileType>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1137 <GetFileType+0x27>
mov    -0x8(%rbp),%rdi
lea    0xece(%rip),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetFileType>:
test   %rdi,%rdi
je     1126 <GetFileType+0x16>
push   %rax
lea    0xee3(%rip),%rsi
call   1030 <strcpy@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"PCE\00"
define i32 @GetFileType(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 %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %5, %1
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"PCE\00"
define i32 @GetFileType(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, char const *);
void putstr(int fcolor, int bcolor, const char *str) {
  printf("\033[%dm\033[%dm%s\033[0m", fcolor, bcolor, str);
}


x86 assembly (clang, -O0):
<putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putstr>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    %edi,%esi
lea    0xee2(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"\1B[%dm\1B[%dm%s\1B[0m\00"
define void @putstr(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"\1B[%dm\1B[%dm%s\1B[0m\00"
define void @putstr(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i8* %2)
ret void
}
void foo244() {}


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

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

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

LLVM IR (-O2):
define void @foo244() {
ret void
}
void dumpSDIOReg(struct sdhost_host *host) {}


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

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

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

LLVM IR (-O2):
%struct.sdhost_host = type opaque
define void @dumpSDIOReg(%struct.sdhost_host* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void url_put(char *url) {
  if (!url)
    return;
  free(url);
}


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

x86 assembly (clang, -O2):
<url_put>:
test   %rdi,%rdi
je     111a <url_put+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @url_put(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 %9
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @free(i8* %7)
br label %9
9: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @url_put(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %1, %3
ret void
}
/* Variables and functions */
unsigned int _uiTlvGetLengthLen(unsigned char *);
int iTlvLengthLen(unsigned char *psTlvObj) {
  unsigned int uiRet;
  uiRet = _uiTlvGetLengthLen(psTlvObj);
  if (uiRet == 0)
    return (-10005);
  return (uiRet);
}


x86 assembly (clang, -O0):
<iTlvLengthLen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <_uiTlvGetLengthLen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    113e <iTlvLengthLen+0x2e>
movl   $0xffffd8eb,-0x4(%rbp)
jmp    1144 <iTlvLengthLen+0x34>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iTlvLengthLen>:
push   %rax
call   1030 <_uiTlvGetLengthLen@plt>
test   %eax,%eax
mov    $0xffffd8eb,%ecx
cmove  %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @iTlvLengthLen(i8* %0) {
%2 = tail call i32 @_uiTlvGetLengthLen(i8* %0)
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -10005, i32 %2
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int /*<<< orphan*/ const *, int);
uint16_t get16bit(const uint8_t **ptr) {
  uint16_t t16;
  memcpy(&t16, *ptr, 2);
  (*ptr) += 2;
  return ((((t16) << 8) & 0xFF00) | (((t16) >> 8) & 0xFF));
}


x86 assembly (clang, -O0):
<get16bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x2,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x8,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
and    $0xff00,%eax
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get16bit>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    (%rdi),%rsi
lea    0xc(%rsp),%rdi
mov    $0x2,%edx
call   1030 <memcpy@plt>
addq   $0x8,(%rbx)
movzwl 0xc(%rsp),%eax
rol    $0x8,%ax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get16bit(i32** %0) {
%2 = alloca i32**
%3 = alloca i32
store i32** %0, i32*** %2
%4 = load i32**, i32*** %2
%5 = load i32*, i32** %4
%6 = call i32 @memcpy(i32* %3, i32* %5, i32 2)
%7 = load i32**, i32*** %2
%8 = load i32*, i32** %7
%9 = getelementptr inbounds i32, i32* %8, i64 2
store i32* %9, i32** %7
%10 = load i32, i32* %3
%11 = shl i32 %10, 8
%12 = and i32 %11, 65280
%13 = load i32, i32* %3
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
%16 = or i32 %12, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @get16bit(i32** nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32*, i32** %0
%5 = call i32 @memcpy(i32* %2, i32* %4, i32 2)
%6 = load i32*, i32** %0
%7 = getelementptr inbounds i32, i32* %6, i64 2
store i32* %7, i32** %0
%8 = load i32, i32* %2
%9 = trunc i32 %8 to i16
%10 = call i16 @llvm.bswap.i16(i16 %9)
%11 = zext i16 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ LoadMapPalette();
int /*<<< orphan*/ V_SetPalette(int /*<<< orphan*/);
void CV_usegamma_OnChange(void) {
  LoadMapPalette();
  V_SetPalette(0);
}


x86 assembly (clang, -O0):
<CV_usegamma_OnChange>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <LoadMapPalette@plt>
xor    %edi,%edi
call   1040 <V_SetPalette@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CV_usegamma_OnChange>:
push   %rax
xor    %eax,%eax
call   1030 <LoadMapPalette@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <V_SetPalette@plt>

LLVM IR (-O0):
define void @CV_usegamma_OnChange() {
%1 = call i32 (...) @LoadMapPalette()
%2 = call i32 @V_SetPalette(i32 0)
ret void
}

LLVM IR (-O2):
define void @CV_usegamma_OnChange() {
%1 = tail call i32 (...) @LoadMapPalette()
%2 = tail call i32 @V_SetPalette(i32 0)
ret void
}
int upcrt_gcd(int a, int b) { return (b == 0) ? a : upcrt_gcd(b, a % b); }


x86 assembly (clang, -O0):
<upcrt_gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1133 <upcrt_gcd+0x23>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1147 <upcrt_gcd+0x37>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%esi
call   1030 <upcrt_gcd@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<upcrt_gcd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <upcrt_gcd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <upcrt_gcd+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @upcrt_gcd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i32, i32* %3
br label %15
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = srem i32 %11, %12
%14 = call i32 @upcrt_gcd(i32 %10, i32 %13)
br label %15
15: ; preds = %9, %7
%16 = phi i32 [ %8, %7 ], [ %14, %9 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @upcrt_gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar(int);
void ft_putnbr(int nb) {
  if (nb < 0) {
    ft_putchar('-');
    nb = -nb;
  }
  if (nb >= 10) {
    ft_putnbr(nb / 10);
    ft_putnbr(nb % 10);
  } else
    ft_putchar(nb + '0');
}


x86 assembly (clang, -O0):
<ft_putnbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1147 <ft_putnbr+0x27>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jl     117a <ft_putnbr+0x5a>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <ft_putnbr@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1040 <ft_putnbr@plt>
jmp    1185 <ft_putnbr+0x65>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1030 <ft_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebp
mov    $0xcccccccd,%r14d
test   %ebp,%ebp
jns    113c <ft_putnbr+0x1c>
mov    $0x2d,%edi
call   1030 <ft_putchar@plt>
neg    %ebp
cmp    $0xa,%ebp
jb     115f <ft_putnbr+0x3f>
mov    %ebp,%ebx
imul   %r14,%rbx
shr    $0x23,%rbx
mov    %ebx,%edi
call   1040 <ft_putnbr@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %eax,%ebp
test   %ebp,%ebp
jns    113c <ft_putnbr+0x1c>
jmp    1130 <ft_putnbr+0x10>
add    $0x30,%ebp
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <ft_putchar@plt>

LLVM IR (-O0):
define void @ft_putnbr(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = call i32 @ft_putchar(i32 45)
%7 = load i32, i32* %2
%8 = sub nsw i32 0, %7
store i32 %8, i32* %2
br label %9
9: ; preds = %5, %1
%10 = load i32, i32* %2
%11 = icmp sge i32 %10, 10
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 10
%15 = load i32, i32* %2
%16 = srem i32 %15, 10
br label %21
17: ; preds = %9
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 48
%20 = call i32 @ft_putchar(i32 %19)
br label %21
21: ; preds = %17, %12
ret void
}

LLVM IR (-O2):
define void @ft_putnbr(i32 %0) {
br label %2
2: ; preds = %11, %1
%3 = phi i32 [ %0, %1 ], [ %13, %11 ]
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @ft_putchar(i32 45)
%7 = sub nsw i32 0, %3
br label %8
8: ; preds = %5, %2
%9 = phi i32 [ %7, %5 ], [ %3, %2 ]
%10 = icmp ugt i32 %9, 9
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = udiv i32 %9, 10
tail call void @ft_putnbr(i32 %12)
%13 = urem i32 %9, 10
br label %2
14: ; preds = %8
%15 = add nuw nsw i32 %9, 48
%16 = tail call i32 @ft_putchar(i32 %15)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_001();
void test_main() { test_001(); }


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

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

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

LLVM IR (-O2):
define void @test_main() {
%1 = tail call i32 (...) @test_001()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("do ./configure --enable-sniffer to enable build support\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 = [57 x i8] c"do ./configure --enable-sniffer to enable build support\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [56 x i8] c"do ./configure --enable-sniffer to enable build support\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void RTRringopen() {}


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

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

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

LLVM IR (-O2):
define void @RTRringopen() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, unsigned int);
void f2(int size) {
  char src[12] = "helloworld";
  char dest[12];
  memcpy(dest, src, (unsigned)size);
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xedc(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x1c(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
sub    $0x18,%rsp
mov    %edi,%edx
movabs $0x726f776f6c6c6568,%rax
77 6f 72
mov    %rax,(%rsp)
movl   $0x646c,0x8(%rsp)
lea    0xc(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <memcpy@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.f2.src = [12 x i8] c"helloworld\00\00"
define void @f2(i32 %0) {
%2 = alloca i32
%3 = alloca [12 x i8]
%4 = alloca [12 x i8]
store i32 %0, i32* %2
%5 = bitcast [12 x i8]* %3 to i8*
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%8 = load i32, i32* %2
%9 = call i32 @memcpy(i8* %6, i8* %7, i32 %8)
ret void
}

LLVM IR (-O2):
@__const.f2.src = [12 x i8] c"helloworld\00\00"
define void @f2(i32 %0) {
%2 = alloca [12 x i8]
%3 = alloca [12 x i8]
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%6 = call i32 @memcpy(i8* %5, i8* %4, i32 %0)
ret void
}
/* Variables and functions */
int send(int, char *, int, int /*<<< orphan*/);
int strlen(char *);
int Send(int sock, char *buf) {
  int n, len = strlen(buf);
  n = send(sock, buf, len, 0);
  if (n != len)
    return -1;
  return len;
}


x86 assembly (clang, -O0):
<Send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
xor    %ecx,%ecx
call   1040 <send@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
je     1167 <Send+0x47>
movl   $0xffffffff,-0x4(%rbp)
jmp    116d <Send+0x4d>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Send>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
cmp    %ebp,%eax
mov    $0xffffffff,%eax
cmove  %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @Send(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @send(i32 %0, i8* %1, i32 %3, i32 0)
%5 = icmp eq i32 %4, %3
%6 = select i1 %5, i32 %3, i32 -1
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ Report(char const *, int, char const *, char const *);
int /*<<< orphan*/ trio_equal_case(char const *, char const *);
int Compare(const char *file, int line, const char *expected, const char *got) {
  if (!trio_equal_case(expected, got)) {
    Report(file, line, expected, got);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <trio_equal_case@plt>
cmp    $0x0,%eax
jne    116d <Compare+0x4d>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1040 <Report@plt>
movl   $0x1,-0x4(%rbp)
jmp    1174 <Compare+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Compare>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %rdi,%rbp
mov    %rdx,%rdi
mov    %rcx,%rsi
call   1030 <trio_equal_case@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    115c <Compare+0x3c>
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1040 <Report@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @Compare(i8* %0, i32 %1, i8* %2, i8* %3) {
%5 = tail call i32 @trio_equal_case(i8* %2, i8* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @Report(i8* %0, i32 %1, i8* %2, i8* %3)
br label %9
9: ; preds = %4, %7
%10 = phi i32 [ 1, %7 ], [ 0, %4 ]
ret i32 %10
}
tcreat(a) { return (1); }


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

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

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

LLVM IR (-O2):
define i32 @tcreat(i32 %0) {
ret i32 1
}