xunge/DecIR huggingface dataset:
int isNotEqual(int x, int y) { return !!(x ^ y); }


x86 assembly (clang, -O0):
<isNotEqual>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNotEqual>:
xor    %eax,%eax
cmp    %esi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @isNotEqual(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = xor i32 %5, %6
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @isNotEqual(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int main() {
  const char *fac[] = {"abcd", "defdg"};
  printf("%s\n", fac[1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2cf1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2cee(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"abcd\00"
@.str.1 = [6 x i8] c"defdg\00"
@__const.main.fac = [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i32 0, i32 0)]
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [2 x i8*]
%2 = bitcast [2 x i8*]* %1 to i8*
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 1
%4 = load i8*, i8** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %4)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"defdg\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
void _defaults_rc_goto_eol(FILE *stream) {
  int tok;
  do {
    tok = fgetc(stream);
  } while (!feof(stream) && tok != '\n');
}


x86 assembly (clang, -O0):
<_defaults_rc_goto_eol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
jne    115b <_defaults_rc_goto_eol+0x3b>
cmpl   $0xa,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    112c <_defaults_rc_goto_eol+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_defaults_rc_goto_eol>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <feof@plt>
cmp    $0xa,%ebp
je     114b <_defaults_rc_goto_eol+0x2b>
test   %eax,%eax
je     1130 <_defaults_rc_goto_eol+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @_defaults_rc_goto_eol(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = tail call i32 @feof(i32* %0)
%5 = icmp eq i32 %4, 0
%6 = icmp ne i32 %3, 10
%7 = and i1 %6, %5
br i1 %7, label %2, label %8
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void csapp_free(void *ptr) { free(ptr); }


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

LLVM IR (-O0):
define void @csapp_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 @csapp_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int RoundUp(int n, int block_size) {
  return block_size * ((n + block_size - 1) / block_size);
}


x86 assembly (clang, -O0):
<RoundUp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
imul   %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RoundUp>:
lea    (%rdi,%rsi,1),%ecx
add    $0xffffffff,%ecx
mov    %ecx,%eax
cltd
idiv   %esi
sub    %edx,%ecx
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @RoundUp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
%9 = sub nsw i32 %8, 1
%10 = load i32, i32* %4
%11 = sdiv i32 %9, %10
%12 = mul nsw i32 %5, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @RoundUp(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = srem i32 %4, %1
%6 = sub i32 %4, %5
ret i32 %6
}
/* Variables and functions */
scalar_t__ hp5400_command_write(int, int, int, char *);
int /*<<< orphan*/ sanei_debug_BACKEND_NAME_call(int, char *, int);
int WriteByte(int iHandle, int cmd, char data) {
  if (hp5400_command_write(iHandle, cmd, 1, &data) < 0) {
    sanei_debug_BACKEND_NAME_call(32, "failed to send byte (cmd=%04X)\n", cmd);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<WriteByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    $0x1,%edx
lea    -0xd(%rbp),%rcx
call   1030 <hp5400_command_write@plt>
cmp    $0x0,%rax
jge    1171 <WriteByte+0x51>
mov    -0xc(%rbp),%edx
mov    $0x20,%edi
lea    0xea0(%rip),%rsi
call   1040 <sanei_debug_BACKEND_NAME_call@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1178 <WriteByte+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteByte>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %dl,0xf(%rsp)
lea    0xf(%rsp),%rcx
mov    $0x1,%edx
call   1030 <hp5400_command_write@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jns    115c <WriteByte+0x3c>
lea    0xeb5(%rip),%rsi
mov    $0x20,%edi
mov    %ebx,%edx
call   1040 <sanei_debug_BACKEND_NAME_call@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"failed to send byte (cmd=%04X)\0A\00"
define i32 @WriteByte(i32 %0, i32 %1, i8 signext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8 %2, i8* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i64 @hp5400_command_write(i32 %8, i32 %9, i32 1, i8* %7)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i32, i32* %6
%14 = call i32 @sanei_debug_BACKEND_NAME_call(i32 32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 -1, i32* %4
br label %16
15: ; preds = %3
store i32 0, i32* %4
br label %16
16: ; preds = %15, %12
%17 = load i32, i32* %4
ret i32 %17
}

LLVM IR (-O2):
@.str = [32 x i8] c"failed to send byte (cmd=%04X)\0A\00"
define i32 @WriteByte(i32 %0, i32 %1, i8 signext %2) {
%4 = alloca i8
store i8 %2, i8* %4
%5 = call i64 @hp5400_command_write(i32 %0, i32 %1, i32 1, i8* %4)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 @sanei_debug_BACKEND_NAME_call(i32 32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %9
9: ; preds = %3, %7
%10 = phi i32 [ -1, %7 ], [ 0, %3 ]
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void string2uint(char *msg, uint32_t *number1) {
  uint32_t *uint32;
  uint32 = (uint32_t *)(msg);
  *number1 = *uint32;
}


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

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

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

LLVM IR (-O2):
define void @string2uint(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
store i32 %4, i32* %1
ret void
}
/* Variables and functions */
int readbyte();
unsigned find_start_of_image(void) {
  unsigned n = 0;
  do {
    while (readbyte() != 0xFF)
      n++;
    n += 2;
  } while (readbyte() != 0xD8);
  return n;
}


x86 assembly (clang, -O0):
<find_start_of_image>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
jmp    1124 <find_start_of_image+0x14>
mov    $0x0,%al
call   1030 <readbyte@plt>
cmp    $0xff,%eax
je     1144 <find_start_of_image+0x34>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <find_start_of_image+0x14>
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <readbyte@plt>
cmp    $0xd8,%eax
jne    111f <find_start_of_image+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_start_of_image>:
push   %rbx
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ecx,%ebx
xor    %eax,%eax
call   1030 <readbyte@plt>
lea    0x1(%rbx),%ecx
cmp    $0xff,%eax
jne    1120 <find_start_of_image+0x10>
add    $0x2,%ebx
xor    %eax,%eax
call   1030 <readbyte@plt>
mov    %ebx,%ecx
cmp    $0xd8,%eax
jne    1120 <find_start_of_image+0x10>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @find_start_of_image() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %12, %0
br label %3
3: ; preds = %6, %2
%4 = call i32 (...) @readbyte()
%5 = icmp ne i32 %4, 255
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %1
%8 = add i32 %7, 1
store i32 %8, i32* %1
br label %3
9: ; preds = %3
%10 = load i32, i32* %1
%11 = add i32 %10, 2
store i32 %11, i32* %1
br label %12
12: ; preds = %9
%13 = call i32 (...) @readbyte()
%14 = icmp ne i32 %13, 216
br i1 %14, label %2, label %15
15: ; preds = %12
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
define i32 @find_start_of_image() {
br label %1
1: ; preds = %6, %0
%2 = phi i32 [ 0, %0 ], [ %7, %6 ]
%3 = tail call i32 (...) @readbyte()
%4 = icmp eq i32 %3, 255
%5 = add i32 %2, 1
br i1 %4, label %8, label %6
6: ; preds = %1, %8
%7 = phi i32 [ %5, %1 ], [ %9, %8 ]
br label %1
8: ; preds = %1
%9 = add i32 %2, 2
%10 = tail call i32 (...) @readbyte()
%11 = icmp eq i32 %10, 216
br i1 %11, label %12, label %6
12: ; preds = %8
ret i32 %9
}
unsigned opt_l(unsigned n) {
  unsigned p = 0;
  while (n > 1) {
    p++;
    n /= 10;
  }
  return p;
}


x86 assembly (clang, -O0):
<opt_l>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jbe    1135 <opt_l+0x35>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <opt_l+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<opt_l>:
xor    %eax,%eax
cmp    $0x2,%edi
jb     1124 <opt_l+0x24>
xor    %eax,%eax
mov    $0xcccccccd,%ecx
xchg   %ax,%ax
add    $0x1,%eax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
cmp    $0x13,%edi
mov    %edx,%edi
ja     1110 <opt_l+0x10>
ret

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

LLVM IR (-O2):
define i32 @opt_l(i32 %0) {
%2 = icmp ugt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add i32 %4, 1
%7 = udiv i32 %5, 10
%8 = icmp ugt i32 %5, 19
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
void write_barrier() { __asm__ __volatile__(" " : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @write_barrier() {
tail call void asm sideeffect " ", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int l_lt(char *, char *, int, int);
int intr_wrap_604(char *s1, char *s2, int l1, int l2) {
  return l_lt(s1, s2, l1, l2);
}


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

x86 assembly (clang, -O2):
<intr_wrap_604>:
jmp    1030 <l_lt@plt>

LLVM IR (-O0):
define i32 @intr_wrap_604(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @l_lt(i8* %9, i8* %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @intr_wrap_604(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @l_lt(i8* %0, i8* %1, i32 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *hexstring(unsigned char *, int);
int /*<<< orphan*/ printf(char *, char *, char *, int);
void make_ssl_debug(unsigned char *buf, char *msg, int len) {
  char *h;
  h = hexstring((unsigned char *)buf, len);
  printf("%s: %s (length %d)\n", msg, h, len);
  free(h);
}


x86 assembly (clang, -O0):
<make_ssl_debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <hexstring@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_ssl_debug>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %edx,%esi
call   1050 <hexstring@plt>
mov    %rax,%rbx
lea    0xeb6(%rip),%rdi
mov    %r14,%rsi
mov    %rax,%rdx
mov    %ebp,%ecx
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"%s: %s (length %d)\0A\00"
define void @make_ssl_debug(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %6
%10 = call i8* @hexstring(i8* %8, i32 %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %5
%12 = load i8*, i8** %7
%13 = load i32, i32* %6
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12, i32 %13)
%15 = load i8*, i8** %7
%16 = call i32 @free(i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"%s: %s (length %d)\0A\00"
define void @make_ssl_debug(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @hexstring(i8* %0, i32 %2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %4, i32 %2)
%6 = tail call i32 @free(i8* %4)
ret void
}
char *my_index(string, chr)
char *string;
int chr;
{
  while (*string) {
    if (*string == chr)
      return string;
    string++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<my_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <my_index+0x46>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1135 <my_index+0x35>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    114e <my_index+0x4e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <my_index+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_index>:
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <my_index+0x23>
mov    %rdi,%rax
nopl   0x0(%rax)
movsbl %cl,%ecx
cmp    %esi,%ecx
je     1125 <my_index+0x25>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <my_index+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @my_index(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %5
5: ; preds = %2, %10
%6 = phi i8 [ %12, %10 ], [ %3, %2 ]
%7 = phi i8* [ %11, %10 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
%9 = icmp eq i32 %8, %1
br i1 %9, label %14, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %2
%15 = phi i8* [ null, %2 ], [ null, %10 ], [ %7, %5 ]
ret i8* %15
}
/* Type definitions */
typedef double int64_t;
typedef scalar_t__ int16_t;

/* Variables and functions */
double frexp(double, int *);
void FlattenDouble(int64_t *mantissa, int16_t *exponent, double number) {
  int exp;
  int64_t mant;
  const int64_t MAXVAL = 0x7FFFFFFFFFFFFFFF;
  double fractional_mant;
  fractional_mant = frexp(number, &exp);
  mant = MAXVAL * fractional_mant;
  *mantissa = mant;
  *exponent = (int16_t)exp;
  return;
}


x86 assembly (clang, -O0):
<FlattenDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  0xed3(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    -0x1c(%rbp),%rdi
call   1030 <frexp@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  0xeb3(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movslq -0x1c(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FlattenDouble>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0x4(%rsp),%rdi
call   1030 <frexp@plt>
mulsd  0xed4(%rip),%xmm0
movsd  %xmm0,(%rbx)
movslq 0x4(%rsp),%rax
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @FlattenDouble(double* %0, i64* %1, double %2) {
%4 = alloca double*
%5 = alloca i64*
%6 = alloca double
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double* %0, double** %4
store i64* %1, i64** %5
store double %2, double* %6
store double 0x43E0000000000000, double* %9
%11 = load double, double* %6
%12 = call double @frexp(double %11, i32* %7)
store double %12, double* %10
%13 = load double, double* %10
%14 = fmul double 0x43E0000000000000, %13
store double %14, double* %8
%15 = load double, double* %8
%16 = load double*, double** %4
store double %15, double* %16
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = load i64*, i64** %5
store i64 %18, i64* %19
ret void
}

LLVM IR (-O2):
define void @FlattenDouble(double* nocapture writeonly %0, i64* nocapture writeonly %1, double %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = call double @frexp(double %2, i32* %4)
%7 = fmul double %6, 0x43E0000000000000
store double %7, double* %0
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
store i64 %9, i64* %1
ret void
}
indreg0adrx1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{
  if ((*p0) <= (((int *)11111111)[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<indreg0adrx1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
movslq -0x14(%rbp),%rdx
mov    $0xa98ac7,%ecx
cmp    (%rcx,%rdx,4),%eax
jg     113c <indreg0adrx1+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1143 <indreg0adrx1+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0adrx1>:
mov    (%r8),%edx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    0xa98ac7(,%rcx,4),%edx
setle  %al
ret

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

LLVM IR (-O2):
define i32 @indreg0adrx1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32* nocapture readnone %5) {
%7 = load i32, i32* %4
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i32, i32* inttoptr (i64 11111111 to i32*), i64 %8
%10 = load i32, i32* %9
%11 = icmp sle i32 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void __attribute__((destructor)) libx1_unloaded(void) {
  printf("Libx1: unloaded\n");
}


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"Libx1: unloaded\0A\00"
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @libx1_unloaded, i8* null }]
define void @libx1_unloaded() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @libx1_unloaded, i8* null }]
@str = [16 x i8] c"Libx1: unloaded\00"
define void @libx1_unloaded() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
int my_tablen(char **tab) {
  int i;
  i = 0;
  while (tab && tab[i])
    i++;
  return (i);
}


x86 assembly (clang, -O0):
<my_tablen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1132 <my_tablen+0x32>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1142 <my_tablen+0x42>
jmp    1150 <my_tablen+0x50>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <my_tablen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_tablen>:
test   %rdi,%rdi
je     111e <my_tablen+0x1e>
mov    $0xffffffff,%eax
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <my_tablen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @my_tablen(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ 0, %1 ]
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = trunc i64 %4 to i32
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 0, %1 ], [ %10, %9 ]
ret i32 %12
}
void message_handler_req_lib_amf_protectiongrouptrack(void *conn, void *msg) {}


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

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

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

LLVM IR (-O2):
define void @message_handler_req_lib_amf_protectiongrouptrack(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void handler_sigint(int signum) {
  fprintf(stderr, "\nCaught Ctrl+C, quitting...\n");
  exit(1);
}


x86 assembly (clang, -O0):
<handler_sigint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"\0ACaught Ctrl+C, quitting...\0A\00"
define void @handler_sigint(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
int parity(unsigned int v) {
  int parity = 0;
  while (v) {
    parity = !parity;
    v = v & (v - 1);
  }
  return parity;
}


x86 assembly (clang, -O0):
<parity>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113c <parity+0x3c>
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <parity+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parity>:
xor    %eax,%eax
test   %edi,%edi
je     111c <parity+0x1c>
cs nopw 0x0(%rax,%rax,1)
xor    $0x1,%eax
lea    -0x1(%rdi),%ecx
and    %edi,%ecx
mov    %ecx,%edi
jne    1110 <parity+0x10>
ret

LLVM IR (-O0):
define i32 @parity(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = load i32, i32* %2
%14 = sub i32 %13, 1
%15 = and i32 %12, %14
store i32 %15, i32* %2
br label %4
16: ; preds = %4
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @parity(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = xor i32 %4, 1
%7 = add i32 %5, -1
%8 = and i32 %7, %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ rotate(char *, int, int);
int main() {
  char tst[] = "hello, world";
  rotate(tst, 9, 12);
  printf("%s\n", tst);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xec3(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x11(%rbp),%rdi
mov    $0x9,%esi
mov    $0xc,%edx
call   1040 <rotate@plt>
lea    -0x11(%rbp),%rsi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x646c726f77202c,%rax
mov    %rax,0x5(%rsp)
movabs $0x77202c6f6c6c6568,%rax
2c 20 77
mov    %rax,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x9,%esi
mov    $0xc,%edx
call   1040 <rotate@plt>
lea    0xeaf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.tst = [13 x i8] c"hello, world\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8]
store i32 0, i32* %1
%3 = bitcast [13 x i8]* %2 to i8*
%4 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%5 = call i32 @rotate(i8* %4, i32 9, i32 12)
%6 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.tst = [13 x i8] c"hello, world\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%3 = call i32 @rotate(i8* %2, i32 9, i32 12)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
void glTexImage2D(int a, int b, int c, int width, int height, int d, int e,
                  int f, void *buf) {}


x86 assembly (clang, -O0):
<glTexImage2D>:
push   %rbp
mov    %rsp,%rbp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @glTexImage2D(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i8* %8) {
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
store i32 %0, i32* %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store i32 %4, i32* %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i8* %8, i8** %18
ret void
}

LLVM IR (-O2):
define void @glTexImage2D(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i8* nocapture %8) {
ret void
}
int test_imm_42uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x42 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_42uint64_lowword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
and    $0x42,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_42uint64_lowword_mem>:
testb  $0x42,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_42uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 66
%6 = icmp ne i64 %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_42uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 66
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int fegetround();
char *get_rounding_mode(int);
double nearbyint(double);
int /*<<< orphan*/ printf(char *, char *, double, double);
void *thread_fp(void *arg) {
  int mode = fegetround();
  printf("%s  child: 42.5 = %.1f, -42.5 = %.1f\n", get_rounding_mode(mode),
         nearbyint(42.5), nearbyint(-42.5));
  return arg;
}


x86 assembly (clang, -O0):
<thread_fp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <fegetround@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <get_rounding_mode@plt>
mov    %rax,-0x20(%rbp)
movsd  0xe9e(%rip),%xmm0
call   1060 <nearbyint@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe84(%rip),%xmm0
call   1060 <nearbyint@plt>
mov    -0x20(%rbp),%rsi
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_fp>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <fegetround@plt>
mov    %eax,%edi
call   1050 <get_rounding_mode@plt>
lea    0xec7(%rip),%rdi
movsd  0xeaf(%rip),%xmm0
movsd  0xeaf(%rip),%xmm1
mov    %rax,%rsi
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"%s child: 42.5 = %.1f, -42.5 = %.1f\0A\00"
define i8* @thread_fp(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 (...) @fegetround()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = call i8* @get_rounding_mode(i32 %5)
%7 = call double @llvm.nearbyint.f64(double 4.250000e+01)
%8 = call double @llvm.nearbyint.f64(double -4.250000e+01)
%9 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %6, double %7, double %8)
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [38 x i8] c"%s child: 42.5 = %.1f, -42.5 = %.1f\0A\00"
define i8* @thread_fp(i8* readnone returned %0) {
%2 = tail call i32 (...) @fegetround()
%3 = tail call i8* @get_rounding_mode(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %3, double 4.200000e+01, double -4.200000e+01)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ argl();
void rop_1l() { argl(); }


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

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

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

LLVM IR (-O2):
define void @rop_1l() {
%1 = tail call i32 (...) @argl()
ret void
}
unsigned int get_IEEE_exponent(double d) {
  return (*(unsigned long long *)&d & 0x7ff0000000000000ULL) >> 52;
}


x86 assembly (clang, -O0):
<get_IEEE_exponent>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movabs $0x7ff0000000000000,%rax
and    -0x8(%rbp),%rax
shr    $0x34,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_IEEE_exponent>:
movq   %xmm0,%rax
shr    $0x34,%rax
and    $0x7ff,%eax
ret

LLVM IR (-O0):
define i32 @get_IEEE_exponent(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = bitcast double* %2 to i64*
%4 = load i64, i64* %3
%5 = and i64 %4, 9218868437227405312
%6 = lshr i64 %5, 52
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_IEEE_exponent(double %0) {
%2 = bitcast double %0 to i64
%3 = lshr i64 %2, 52
%4 = trunc i64 %3 to i32
%5 = and i32 %4, 2047
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ clock1();
int /*<<< orphan*/ delay();
void clockEnd(void) {
  clock1();
  delay();
  delay();
}


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

x86 assembly (clang, -O2):
<clockEnd>:
push   %rax
xor    %eax,%eax
call   1040 <clock1@plt>
xor    %eax,%eax
call   1030 <delay@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @clockEnd() {
%1 = call i32 (...) @clock1()
%2 = call i32 (...) @delay()
%3 = call i32 (...) @delay()
ret void
}

LLVM IR (-O2):
define void @clockEnd() {
%1 = tail call i32 (...) @clock1()
%2 = tail call i32 (...) @delay()
%3 = tail call i32 (...) @delay()
ret void
}
int sequenceType_function(const char *_tag_, int _type_) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @sequenceType_function(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
int number(const char c) { return c - '0'; }


x86 assembly (clang, -O0):
<number>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @number(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 48
ret i32 %5
}

LLVM IR (-O2):
define i32 @number(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ sastantua(int);
int main(void) { sastantua(21); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x15,%edi
call   1030 <sastantua@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x15,%edi
call   1030 <sastantua@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @sastantua(i32 21)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @sastantua(i32 21)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ident32(size_t);
int /*<<< orphan*/ ident64(size_t);
scalar_t__ padd(int /*<<< orphan*/ *, size_t);
void place_length(uint8_t *buffer, size_t bufsize, size_t length) {
  if (sizeof(size_t) == 4) {
    *(uint32_t *)padd(buffer, bufsize - 4) = ident32(length);
  } else {
    *(uint64_t *)padd(buffer, bufsize - 8) = ident64(length);
  }
}


x86 assembly (clang, -O0):
<place_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <ident64@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
sub    $0x8,%rsi
call   1040 <padd@plt>
mov    -0x1c(%rbp),%ecx
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<place_length>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rdx,%rdi
call   1030 <ident64@plt>
mov    %eax,%ebp
add    $0xfffffffffffffff8,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <padd@plt>
mov    %ebp,(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @place_length(i32* %0, i64 %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i64
%6 = alloca i64
store i32* %0, i32** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = call i32 @ident64(i64 %7)
%9 = load i32*, i32** %4
%10 = load i64, i64* %5
%11 = sub i64 %10, 8
%12 = call i64 @padd(i32* %9, i64 %11)
%13 = inttoptr i64 %12 to i32*
store i32 %8, i32* %13
ret void
}

LLVM IR (-O2):
define void @place_length(i32* %0, i64 %1, i64 %2) {
%4 = tail call i32 @ident64(i64 %2)
%5 = add i64 %1, -8
%6 = tail call i64 @padd(i32* %0, i64 %5)
%7 = inttoptr i64 %6 to i32*
store i32 %4, i32* %7
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ send_event;
};
struct TYPE_4__ {
  TYPE_1__ xbutton;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xbutton_send_event(void *_p) {
  return (int)((XEvent *)_p)->xbutton.send_event;
}


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

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

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

LLVM IR (-O2):
define i32 @get_XEvent_xbutton_send_event(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
struct addrinfo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int getaddrinfo(char const *, char const *, struct addrinfo const *,
                struct addrinfo **);
int /*<<< orphan*/ perror(char *);
void Getaddrinfo(const char *hostname, const char *service,
                 const struct addrinfo *hints, struct addrinfo **result) {
  int error;
  error = getaddrinfo(hostname, service, hints, result);
  if (error) {
    perror("Getaddrinfo");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<Getaddrinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1050 <getaddrinfo@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1180 <Getaddrinfo+0x50>
lea    0xe8f(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Getaddrinfo>:
push   %rax
call   1050 <getaddrinfo@plt>
test   %eax,%eax
jne    113c <Getaddrinfo+0xc>
pop    %rax
ret
lea    0xebd(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
%struct.addrinfo = type { i32 }
@.str = [12 x i8] c"Getaddrinfo\00"
define void @Getaddrinfo(i8* %0, i8* %1, %struct.addrinfo* %2, %struct.addrinfo** %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.addrinfo*
%8 = alloca %struct.addrinfo**
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store %struct.addrinfo* %2, %struct.addrinfo** %7
store %struct.addrinfo** %3, %struct.addrinfo*** %8
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = load %struct.addrinfo*, %struct.addrinfo** %7
%13 = load %struct.addrinfo**, %struct.addrinfo*** %8
%14 = call i32 @getaddrinfo(i8* %10, i8* %11, %struct.addrinfo* %12, %struct.addrinfo** %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %4
%18 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %4
ret void
}

LLVM IR (-O2):
%struct.addrinfo = type { i32 }
@.str = [12 x i8] c"Getaddrinfo\00"
define void @Getaddrinfo(i8* %0, i8* %1, %struct.addrinfo* %2, %struct.addrinfo** %3) {
%5 = tail call i32 @getaddrinfo(i8* %0, i8* %1, %struct.addrinfo* %2, %struct.addrinfo** %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char);
void hexprint(unsigned char a[32]) {
  for (int i = 0; i < 32; i++) {
    printf("%02x", a[i]);
  }
}


x86 assembly (clang, -O0):
<hexprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1153 <hexprint+0x43>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
lea    0xec4(%rip),%rdi
movzbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <hexprint+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexprint>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %ebx,%ebx
lea    0xedf(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    1130 <hexprint+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
define void @hexprint(i8* nocapture %0) {
br label %3
2: ; preds = %3
ret void
3: ; preds = %1, %3
%4 = phi i64 [ 0, %1 ], [ %8, %3 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
%8 = add nuw nsw i64 %4, 1
%9 = icmp eq i64 %8, 32
br i1 %9, label %2, label %3
}