xunge/DecIR huggingface dataset:
unsigned int operands_fix_8bit_rex_base(unsigned int reg) {
  if ((reg >= 4) && (reg < 8))
    return reg + (64) - 4;
  return reg + (48);
}


x86 assembly (clang, -O0):
<operands_fix_8bit_rex_base>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jb     112c <operands_fix_8bit_rex_base+0x2c>
cmpl   $0x8,-0x8(%rbp)
jae    112c <operands_fix_8bit_rex_base+0x2c>
mov    -0x8(%rbp),%eax
add    $0x40,%eax
sub    $0x4,%eax
mov    %eax,-0x4(%rbp)
jmp    1135 <operands_fix_8bit_rex_base+0x35>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<operands_fix_8bit_rex_base>:
lea    0x30(%rdi),%ecx
lea    0x3c(%rdi),%eax
mov    %edi,%edx
and    $0xfffffffc,%edx
cmp    $0x4,%edx
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @operands_fix_8bit_rex_base(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp uge i32 %4, 4
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp ult i32 %7, 8
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add i32 %10, 64
%12 = sub i32 %11, 4
store i32 %12, i32* %2
br label %16
13: ; preds = %6, %1
%14 = load i32, i32* %3
%15 = add i32 %14, 48
store i32 %15, i32* %2
br label %16
16: ; preds = %13, %9
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @operands_fix_8bit_rex_base(i32 %0) {
%2 = and i32 %0, -4
%3 = icmp eq i32 %2, 4
%4 = select i1 %3, i32 60, i32 48
%5 = add i32 %4, %0
ret i32 %5
}
/* Variables and functions */
int EXIT_SUCCESS;
int main(int argc, char *argv[]) { return EXIT_SUCCESS; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec7(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Variables and functions */
int maxSubArray(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int a[10] = {-2, 1, -3, 4, -1, 2, 1, -5, 4};
  printf("%d\n", maxSubArray(a, 9));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0x9,%esi
call   1050 <maxSubArray@plt>
mov    %eax,%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x9,%esi
call   1040 <maxSubArray@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 -2, i32 1, i32 -3, i32 4, i32 -1, i32 2, i32 1, i32 -5, i32 4, i32 0]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = call i32 @maxSubArray(i32* %5, i32 9)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ILI948x_drv_init();
int gfx_init(void) {
  ILI948x_drv_init();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @gfx_init() {
%1 = tail call i32 (...) @ILI948x_drv_init()
ret i32 0
}
int pickHighest(int a[]) {
  int highest = a[0];
  int i = 1;
  for (; i < 3; i++)
    if (highest < a[i])
      highest = a[i];
  return highest;
}


x86 assembly (clang, -O0):
<pickHighest>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    1157 <pickHighest+0x57>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jge    1144 <pickHighest+0x44>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0xc(%rbp)
jmp    1149 <pickHighest+0x49>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1118 <pickHighest+0x18>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pickHighest>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
cmp    %ecx,%eax
cmovl  %ecx,%eax
mov    0x8(%rdi),%ecx
cmp    %ecx,%eax
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @pickHighest(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = icmp slt i32 %2, %4
%6 = select i1 %5, i32 %4, i32 %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = icmp slt i32 %6, %8
%10 = select i1 %9, i32 %8, i32 %6
ret i32 %10
}
/* Variables and functions */
char *getcwd(char *, int);
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  char *path = malloc(256);
  printf("%s\n", getcwd(path, 256));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x100,%edi
call   1050 <malloc@plt>
mov    %rax,%rdi
mov    $0x100,%esi
call   1040 <getcwd@plt>
lea    0xeb1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(256) i8* @malloc(i32 256)
%4 = tail call i8* @getcwd(i8* %3, i32 256)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
size_t append_hex_in(uint8_t *dst) {
  dst[0] = 0xb0;
  dst[1] = 0x03;
  dst[2] = 0xb3;
  dst[3] = 0x00;
  dst[4] = 0xcd;
  dst[5] = 0x80;
  return 6;
}


x86 assembly (clang, -O0):
<append_hex_in>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0xb0,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x3,0x4(%rax)
mov    -0x8(%rbp),%rax
movl   $0xb3,0x8(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0xc(%rax)
mov    -0x8(%rbp),%rax
movl   $0xcd,0x10(%rax)
mov    -0x8(%rbp),%rax
movl   $0x80,0x14(%rax)
mov    $0x6,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<append_hex_in>:
movaps 0xef9(%rip),%xmm0
movups %xmm0,(%rdi)
movabs $0x80000000cd,%rax
mov    %rax,0x10(%rdi)
mov    $0x6,%eax
ret

LLVM IR (-O0):
define i64 @append_hex_in(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
store i32 176, i32* %4
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 3, i32* %6
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 2
store i32 179, i32* %8
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 3
store i32 0, i32* %10
%11 = load i32*, i32** %2
%12 = getelementptr inbounds i32, i32* %11, i64 4
store i32 205, i32* %12
%13 = load i32*, i32** %2
%14 = getelementptr inbounds i32, i32* %13, i64 5
store i32 128, i32* %14
ret i64 6
}

LLVM IR (-O2):
define i64 @append_hex_in(i32* nocapture writeonly %0) {
%2 = bitcast i32* %0 to <4 x i32>*
store <4 x i32> <i32 176, i32 3, i32 179, i32 0>, <4 x i32>* %2
%3 = getelementptr inbounds i32, i32* %0, i64 4
store i32 205, i32* %3
%4 = getelementptr inbounds i32, i32* %0, i64 5
store i32 128, i32* %4
ret i64 6
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
pid_t _wait(int *status) {
  assert(0);
  return -1;
}


x86 assembly (clang, -O0):
<_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @_wait(i32* nocapture readnone %0) {
%2 = tail call i32 @assert(i32 0)
ret i32 -1
}
int integerRemainder(int a, int b) { return a % b; }


x86 assembly (clang, -O0):
<integerRemainder>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<integerRemainder>:
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @integerRemainder(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 = srem i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @integerRemainder(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
void limpa() { fflush(stdin); }


x86 assembly (clang, -O0):
<limpa>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<limpa>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fflush@plt>

LLVM IR (-O0):
@stdin = global i32 0
define void @limpa() {
%1 = load i32, i32* @stdin
%2 = call i32 @fflush(i32 %1)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @limpa() {
%1 = load i32, i32* @stdin
%2 = tail call i32 @fflush(i32 %1)
ret void
}
/* Variables and functions */
int read_file(int, unsigned char *, int);
int sys_read(int fd, unsigned char *buf, int b_size) {
  return read_file(fd, buf, b_size);
}


x86 assembly (clang, -O0):
<sys_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <read_file@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_read>:
jmp    1030 <read_file@plt>

LLVM IR (-O0):
define i32 @sys_read(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @read_file(i32 %7, i8* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @sys_read(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @read_file(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int16_t av_clip_int16(int a) {
  if ((a + 32768) & ~65535)
    return (a >> 31) ^ 32767;
  else
    return a;
}


x86 assembly (clang, -O0):
<av_clip_int16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x8000,%eax
and    $0xffff0000,%eax
cmp    $0x0,%eax
je     1130 <av_clip_int16+0x30>
mov    -0x8(%rbp),%eax
sar    $0x1f,%eax
xor    $0x7fff,%eax
mov    %eax,-0x4(%rbp)
jmp    1136 <av_clip_int16+0x36>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_clip_int16>:
cmp    $0xffff8001,%edi
mov    $0xffff8000,%ecx
cmovge %edi,%ecx
cmp    $0x7fff,%ecx
mov    $0x7fff,%eax
cmovl  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @av_clip_int16(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 32768
%6 = and i32 %5, -65536
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* %3
%10 = ashr i32 %9, 31
%11 = xor i32 %10, 32767
store i32 %11, i32* %2
br label %14
12: ; preds = %1
%13 = load i32, i32* %3
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %8
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @av_clip_int16(i32 %0) {
%2 = icmp sgt i32 %0, -32768
%3 = select i1 %2, i32 %0, i32 -32768
%4 = icmp slt i32 %3, 32767
%5 = select i1 %4, i32 %3, i32 32767
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int _M_DRV_MC3610_Delay(uint32_t dwMs) { return ((0)); }


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

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

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

LLVM IR (-O2):
define i32 @_M_DRV_MC3610_Delay(i32 %0) {
ret i32 0
}
int b_findMsb(const unsigned *xs, int size) {
  int i = 0, idx = size - 1;
  while (i < size) {
    if (xs[i]) {
      idx = i;
      break;
    }
    i++;
  }
  return idx;
}


x86 assembly (clang, -O0):
<b_findMsb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1152 <b_findMsb+0x52>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1144 <b_findMsb+0x44>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <b_findMsb+0x52>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    111b <b_findMsb+0x1b>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_findMsb>:
lea    -0x1(%rsi),%eax
test   %esi,%esi
jle    111f <b_findMsb+0x1f>
mov    %esi,%edx
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmpl   $0x0,(%rdi,%rcx,4)
jne    1120 <b_findMsb+0x20>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1110 <b_findMsb+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @b_findMsb(i32* nocapture %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %17
5: ; preds = %2
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %2
%18 = phi i32 [ %3, %2 ], [ %16, %15 ], [ %3, %12 ]
ret i32 %18
}
/* Type definitions */
struct stat {
  int st_mode;
};

/* Variables and functions */
int S_IXGRP;
scalar_t__ stat(char const *, struct stat *);
int fsop_path_exec_group(const char *path) {
  struct stat st;
  if (stat(path, &st) < 0)
    return -1;
  return (st.st_mode & S_IXGRP);
}


x86 assembly (clang, -O0):
<fsop_path_exec_group>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
jge    113f <fsop_path_exec_group+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <fsop_path_exec_group+0x3e>
mov    -0x18(%rbp),%eax
mov    0x2e9f(%rip),%rcx
and    (%rcx),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsop_path_exec_group>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    0x2ec8(%rip),%rcx
mov    (%rcx),%ecx
and    (%rsp),%ecx
test   %rax,%rax
mov    $0xffffffff,%eax
cmovns %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@S_IXGRP = global i32 0
define i32 @fsop_path_exec_group(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %14
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = load i32, i32* @S_IXGRP
%13 = and i32 %11, %12
store i32 %13, i32* %2
br label %14
14: ; preds = %9, %8
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_IXGRP = global i32 0
define i32 @fsop_path_exec_group(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp slt i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = load i32, i32* @S_IXGRP
%9 = and i32 %8, %7
%10 = select i1 %5, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int);
int puts(const char *s) {
  write(1, s, strlen(s));
  write(1, "\n", 1);
  return 1;
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
mov    $0x1,%edx
lea    0xea7(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xec1(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @puts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @write(i32 1, i8* %3, i32 %5)
%7 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 1
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define i32 @puts(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @write(i32 1, i8* %0, i32 %2)
%4 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 1
}
void gendivu() {}


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

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

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

LLVM IR (-O2):
define void @gendivu() {
ret void
}
long VMM_PTR_ERR(const void *ptr) { return (ptr) ? -((long)ptr) : -1; }


x86 assembly (clang, -O0):
<VMM_PTR_ERR>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1125 <VMM_PTR_ERR+0x25>
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1135 <VMM_PTR_ERR+0x35>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1135 <VMM_PTR_ERR+0x35>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<VMM_PTR_ERR>:
mov    %rdi,%rcx
neg    %rcx
cmp    $0x1,%rdi
sbb    %rax,%rax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @VMM_PTR_ERR(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 %9
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = ptrtoint i8* %6 to i64
%8 = sub nsw i64 0, %7
br label %10
9: ; preds = %1
br label %10
10: ; preds = %9, %5
%11 = phi i64 [ %8, %5 ], [ -1, %9 ]
ret i64 %11
}

LLVM IR (-O2):
define i64 @VMM_PTR_ERR(i8* %0) {
%2 = icmp eq i8* %0, null
%3 = ptrtoint i8* %0 to i64
%4 = sub nsw i64 0, %3
%5 = select i1 %2, i64 -1, i64 %4
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int *p, *q, *a, *b;
  q = a;
  p = b;
  *p = 1;
  *q = 2;
  assert(*p == 1);
  assert(*q == 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x8(%rbp),%rax
cmpl   $0x1,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x2,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = load i32*, i32** %3
store i32* %5, i32** %2
%6 = load i32*, i32** %4
store i32* %6, i32** %1
%7 = load i32*, i32** %1
store i32 1, i32* %7
%8 = load i32*, i32** %2
store i32 2, i32* %8
%9 = load i32*, i32** %1
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i32*, i32** %2
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 2
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
ret i32 0
}

LLVM IR (-O2):
int is_control_character(int c) {
  return (((c != 0) && (c < 0x20)) || (c == 0x7f));
}


x86 assembly (clang, -O0):
<is_control_character>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1120 <is_control_character+0x20>
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     112a <is_control_character+0x2a>
cmpl   $0x7f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_control_character>:
test   %edi,%edi
setne  %al
cmp    $0x20,%edi
setl   %cl
and    %al,%cl
cmp    $0x7f,%edi
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @is_control_character(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = icmp slt i32 %0, 32
%4 = and i1 %2, %3
%5 = icmp eq i32 %0, 127
%6 = or i1 %5, %4
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
unsigned long lattice_paths(int, unsigned long **);
int /*<<< orphan*/ printf(char *, int, int, unsigned long);
int main() {
  int size = 21;
  unsigned long grid[size][size];
  unsigned long paths;
  paths = lattice_paths(size, grid);
  printf("paths for a %dx%d grid: %ld\n", size, size, paths);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x15,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rsp,%rdx
mov    %rdx,-0x10(%rbp)
mov    %rcx,%rdx
imul   %rdx,%rdx
lea    0xf(,%rdx,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rsi
sub    %rdx,%rsi
mov    %rsi,%rsp
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <lattice_paths@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x28(%rbp),%rcx
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xdc8,%rsp
mov    %rsp,%rsi
mov    $0x15,%edi
call   1040 <lattice_paths@plt>
lea    0xec5(%rip),%rdi
mov    $0x15,%esi
mov    $0x15,%edx
mov    %rax,%rcx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xdc8,%rsp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"paths for a %dx%d grid: %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i32 0, i32* %1
store i32 21, i32* %2
%7 = load i32, i32* %2
%8 = zext i32 %7 to i64
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %3
%12 = mul nuw i64 %8, %10
%13 = alloca i64, i64 %12
store i64 %8, i64* %4
store i64 %10, i64* %5
%14 = load i32, i32* %2
%15 = bitcast i64* %13 to i64**
%16 = call i64 @lattice_paths(i32 %14, i64** %15)
store i64 %16, i64* %6
%17 = load i32, i32* %2
%18 = load i32, i32* %2
%19 = load i64, i64* %6
%20 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18, i64 %19)
store i32 0, i32* %1
%21 = load i8*, i8** %3
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [29 x i8] c"paths for a %dx%d grid: %ld\0A\00"
define i32 @main() {
%1 = alloca [441 x i64*]
%2 = getelementptr inbounds [441 x i64*], [441 x i64*]* %1, i64 0, i64 0
%3 = call i64 @lattice_paths(i32 21, i64** %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 21, i32 21, i64 %3)
ret i32 0
}
void *apr_atomic_xchgptr(volatile void **mem, void *with) {
  __sync_synchronize();
  return (void *)__sync_lock_test_and_set(mem, with);
}


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

x86 assembly (clang, -O2):
<apr_atomic_xchgptr>:
mov    %rsi,%rax
mfence
xchg   %rax,(%rdi)
ret

LLVM IR (-O0):
define i8* @apr_atomic_xchgptr(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
fence seq_cst
%5 = load i8**, i8*** %3
%6 = bitcast i8** %5 to i64*
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i64
%9 = atomicrmw xchg i64* %6, i64 %8 seq_cst
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @apr_atomic_xchgptr(i8** nocapture %0, i8* %1) {
fence seq_cst
%3 = bitcast i8** %0 to i64*
%4 = ptrtoint i8* %1 to i64
%5 = atomicrmw xchg i64* %3, i64 %4 seq_cst
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id,
                             const char *con_id) {
  return (struct clk *)hw;
}


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

x86 assembly (clang, -O2):
<__clk_create_clk>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
%struct.clk = type opaque
%struct.clk_hw = type opaque
define %struct.clk* @__clk_create_clk(%struct.clk_hw* %0, i8* %1, i8* %2) {
%4 = alloca %struct.clk_hw*
%5 = alloca i8*
%6 = alloca i8*
store %struct.clk_hw* %0, %struct.clk_hw** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load %struct.clk_hw*, %struct.clk_hw** %4
%8 = bitcast %struct.clk_hw* %7 to %struct.clk*
ret %struct.clk* %8
}

LLVM IR (-O2):
%struct.clk = type opaque
%struct.clk_hw = type opaque
define %struct.clk* @__clk_create_clk(%struct.clk_hw* readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = bitcast %struct.clk_hw* %0 to %struct.clk*
ret %struct.clk* %4
}
int __attribute__((aligned(64))) test_align64(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @test_align64() align 64 {
ret i32 0
}

LLVM IR (-O2):
define i32 @test_align64() align 64 {
ret i32 0
}
/* Variables and functions */
int _getElemByte(int const);
int _getBytes(const int bits) { return _getElemByte(bits) + 1; }


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

x86 assembly (clang, -O2):
<_getBytes>:
push   %rax
call   1030 <_getElemByte@plt>
add    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @_getBytes(i32 %0) {
%2 = tail call i32 @_getElemByte(i32 %0)
%3 = add nsw i32 %2, 1
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ bswap64(int /*<<< orphan*/);
uint64_t minipack_unpack_uint64(void *ptr, size_t *sz) {
  *sz = 9;
  uint64_t value = *((uint64_t *)(ptr + 1));
  return (uint64_t)bswap64(value);
}


x86 assembly (clang, -O0):
<minipack_unpack_uint64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x9,(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <bswap64@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_unpack_uint64>:
movq   $0x9,(%rsi)
mov    0x1(%rdi),%edi
jmp    1030 <bswap64@plt>

LLVM IR (-O0):
define i32 @minipack_unpack_uint64(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
%5 = alloca i32
store i8* %0, i8** %3
store i64* %1, i64** %4
%6 = load i64*, i64** %4
store i64 9, i64* %6
%7 = load i8*, i8** %3
%8 = getelementptr i8, i8* %7, i64 1
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = call i32 @bswap64(i32 %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @minipack_unpack_uint64(i8* nocapture %0, i64* nocapture writeonly %1) {
store i64 9, i64* %1
%3 = getelementptr i8, i8* %0, i64 1
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = tail call i32 @bswap64(i32 %5)
ret i32 %6
}
void __clear_bit(int nr, volatile unsigned long *addr) {
  asm volatile("btr %1,%0" : "+m"(*(volatile long *)(addr)) : "Ir"(nr));
}


x86 assembly (clang, -O0):
<__clear_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
btr    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__clear_bit>:
btr    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @__clear_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
%6 = load i32, i32* %3
ret void
}

LLVM IR (-O2):
define void @__clear_bit(i32 %0, i64* %1) {
tail call void asm sideeffect "btr $1,$0", "=*m,Ir,*m,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %1, i32 %0, i64* elementtype(i64) %1)
ret void
}
void RTStrFree(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrFree() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setup_parent(char *, int, char **);
int main(int argc, char *argv[]) { setup_parent("fifo", argc, argv); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xed3(%rip),%rdi
call   1030 <setup_parent@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsi,%rdx
mov    %edi,%esi
lea    0xee3(%rip),%rdi
call   1030 <setup_parent@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"fifo\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @setup_parent(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0, i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ putch(char);
void puth2(unsigned int i) {
  int pos;
  char c[] = "0123456789abcdef";
  for (pos = 4; pos != -4; pos -= 4) {
    putch(c[(i >> pos) & 0xF]);
  }
}


x86 assembly (clang, -O0):
<puth2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xedb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed9(%rip),%al
mov    %al,-0x10(%rbp)
movl   $0x4,-0x8(%rbp)
cmpl   $0xfffffffc,-0x8(%rbp)
je     1170 <puth2+0x60>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
and    $0xf,%eax
mov    %eax,%eax
movsbl -0x20(%rbp,%rax,1),%edi
call   1030 <putch@plt>
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x8(%rbp)
jmp    1141 <puth2+0x31>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puth2>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %edi,%eax
shr    $0x4,%eax
and    $0xf,%eax
lea    0xedb(%rip),%r14
movsbl (%rax,%r14,1),%edi
call   1030 <putch@plt>
and    $0xf,%ebx
movsbl (%rbx,%r14,1),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putch@plt>

LLVM IR (-O0):
@__const.puth2.c = [17 x i8] c"0123456789abcdef\00"
define void @puth2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [17 x i8]
store i32 %0, i32* %2
%5 = bitcast [17 x i8]* %4 to i8*
store i32 4, i32* %3
br label %6
6: ; preds = %18, %1
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, -4
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = lshr i32 %10, %11
%13 = and i32 %12, 15
%14 = zext i32 %13 to i64
%15 = getelementptr inbounds [17 x i8], [17 x i8]* %4, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = call i32 @putch(i8 signext %16)
br label %18
18: ; preds = %9
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 4
store i32 %20, i32* %3
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
@__const.puth2.c = [17 x i8] c"0123456789abcdef\00"
define void @puth2(i32 %0) {
%2 = lshr i32 %0, 4
%3 = and i32 %2, 15
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.puth2.c, i64 0, i64 %4
%6 = load i8, i8* %5
%7 = tail call i32 @putch(i8 signext %6)
%8 = and i32 %0, 15
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [17 x i8], [17 x i8]* @__const.puth2.c, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = tail call i32 @putch(i8 signext %11)
ret void
}
unsigned int cast_int_uint(int x) { return (unsigned int)x; }


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

x86 assembly (clang, -O2):
<cast_int_uint>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @cast_int_uint(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int close(int);
int can_socket_close(int socket) { return close(socket); }


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

x86 assembly (clang, -O2):
<can_socket_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @can_socket_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("hello world!\b\n\n"); }


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

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

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

LLVM IR (-O2):
@str = [15 x i8] c"hello world!\08\0A\00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ native_safe_halt();
void raw_safe_halt(void) { native_safe_halt(); }


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

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

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

LLVM IR (-O2):
define void @raw_safe_halt() {
%1 = tail call i32 (...) @native_safe_halt()
ret void
}
/* Type definitions */
struct Node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *get_formula(struct Node *);
int strcmp(char *, char *);
int cmp_trees(struct Node *a, struct Node *b) {
  int ret;
  char *f, *g;
  f = get_formula(a);
  g = get_formula(b);
  ret = strcmp(f, g);
  free(f);
  free(g);
  return (!ret);
}


x86 assembly (clang, -O0):
<cmp_trees>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <get_formula@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <get_formula@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1050 <strcmp@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_trees>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <get_formula@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <get_formula@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1050 <strcmp@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
test   %ebp,%ebp
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.Node = type { i32 }
define i32 @cmp_trees(%struct.Node* %0, %struct.Node* %1) {
%3 = alloca %struct.Node*
%4 = alloca %struct.Node*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store %struct.Node* %0, %struct.Node** %3
store %struct.Node* %1, %struct.Node** %4
%8 = load %struct.Node*, %struct.Node** %3
%9 = call i8* @get_formula(%struct.Node* %8)
store i8* %9, i8** %6
%10 = load %struct.Node*, %struct.Node** %4
%11 = call i8* @get_formula(%struct.Node* %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = call i32 @strcmp(i8* %12, i8* %13)
store i32 %14, i32* %5
%15 = load i8*, i8** %6
%16 = call i32 @free(i8* %15)
%17 = load i8*, i8** %7
%18 = call i32 @free(i8* %17)
%19 = load i32, i32* %5
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
%struct.Node = type { i32 }
define i32 @cmp_trees(%struct.Node* %0, %struct.Node* %1) {
%3 = tail call i8* @get_formula(%struct.Node* %0)
%4 = tail call i8* @get_formula(%struct.Node* %1)
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(1) %4)
%6 = tail call i32 @free(i8* %3)
%7 = tail call i32 @free(i8* %4)
%8 = icmp eq i32 %5, 0
%9 = zext i1 %8 to i32
ret i32 %9
}
long combine_bumper_vector(unsigned char b1, unsigned char b2,
                           unsigned char b3) {
  long num;
  num = b1 + (b2 * 256) + (b3 * 65536);
  return (num);
}


x86 assembly (clang, -O0):
<combine_bumper_vector>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
shl    $0x8,%ecx
add    %ecx,%eax
movzbl -0x3(%rbp),%ecx
shl    $0x10,%ecx
add    %ecx,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<combine_bumper_vector>:
mov    %edi,%eax
mov    %esi,%ecx
shl    $0x8,%rcx
or     %rax,%rcx
mov    %edx,%eax
shl    $0x10,%rax
or     %rcx,%rax
ret

LLVM IR (-O0):
define i64 @combine_bumper_vector(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i64
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = mul nsw i32 %11, 256
%13 = add nsw i32 %9, %12
%14 = load i8, i8* %6
%15 = zext i8 %14 to i32
%16 = mul nsw i32 %15, 65536
%17 = add nsw i32 %13, %16
%18 = sext i32 %17 to i64
store i64 %18, i64* %7
%19 = load i64, i64* %7
ret i64 %19
}

LLVM IR (-O2):
define i64 @combine_bumper_vector(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %0 to i64
%5 = zext i8 %1 to i64
%6 = shl nuw nsw i64 %5, 8
%7 = or i64 %6, %4
%8 = zext i8 %2 to i64
%9 = shl nuw nsw i64 %8, 16
%10 = or i64 %7, %9
ret i64 %10
}
/* Type definitions */
struct rtrb_table {
  int dummy;
};

/* Variables and functions */
void **rtrb_probe(struct rtrb_table *, void *);
void *rtrb_insert(struct rtrb_table *table, void *item) {
  void **p = rtrb_probe(table, item);
  return p == NULL || *p == item ? NULL : *p;
}


x86 assembly (clang, -O0):
<rtrb_insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <rtrb_probe@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114d <rtrb_insert+0x3d>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
cmp    -0x10(%rbp),%rax
jne    1158 <rtrb_insert+0x48>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1163 <rtrb_insert+0x53>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtrb_insert>:
push   %rbx
mov    %rsi,%rbx
call   1030 <rtrb_probe@plt>
test   %rax,%rax
je     112c <rtrb_insert+0x1c>
mov    (%rax),%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
cmovne %rcx,%rax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.rtrb_table = type { i32 }
define i8* @rtrb_insert(%struct.rtrb_table* %0, i8* %1) {
%3 = alloca %struct.rtrb_table*
%4 = alloca i8*
%5 = alloca i8**
store %struct.rtrb_table* %0, %struct.rtrb_table** %3
store i8* %1, i8** %4
%6 = load %struct.rtrb_table*, %struct.rtrb_table** %3
%7 = load i8*, i8** %4
%8 = call i8** @rtrb_probe(%struct.rtrb_table* %6, i8* %7)
store i8** %8, i8*** %5
%9 = load i8**, i8*** %5
%10 = icmp eq i8** %9, null
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = load i8*, i8** %12
%14 = load i8*, i8** %4
%15 = icmp eq i8* %13, %14
br i1 %15, label %16, label %17
16: ; preds = %11, %2
br label %20
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = load i8*, i8** %18
br label %20
20: ; preds = %17, %16
%21 = phi i8* [ null, %16 ], [ %19, %17 ]
ret i8* %21
}

LLVM IR (-O2):
%struct.rtrb_table = type { i32 }
define i8* @rtrb_insert(%struct.rtrb_table* %0, i8* %1) {
%3 = tail call i8** @rtrb_probe(%struct.rtrb_table* %0, i8* %1)
%4 = icmp eq i8** %3, null
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, %1
%8 = select i1 %7, i8* null, i8* %6
br label %9
9: ; preds = %5, %2
%10 = phi i8* [ null, %2 ], [ %8, %5 ]
ret i8* %10
}
void show_no_ops(void *data) { return; }


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

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

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

LLVM IR (-O2):
define void @show_no_ops(i8* nocapture %0) {
ret void
}