xunge/DecIR huggingface dataset:
int is_prime(int d) {
  int e = 2, f = 1;
  for (; e <= d / 2; e++) {
    if (d % e == 0) {
      return 0;
      f = 0;
      break;
    }
  }
  if (f) {
    return 1;
  }
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jg     1162 <is_prime+0x62>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    114f <is_prime+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    1173 <is_prime+0x73>
jmp    1154 <is_prime+0x54>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <is_prime+0x15>
cmpl   $0x0,-0x10(%rbp)
je     1173 <is_prime+0x73>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
mov    $0x1,%r8d
cmp    $0x4,%edi
jl     1137 <is_prime+0x37>
mov    %edi,%esi
shr    %esi
neg    %esi
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     113b <is_prime+0x3b>
lea    (%rsi,%rcx,1),%eax
add    $0x1,%eax
add    $0x1,%ecx
cmp    $0x1,%eax
jne    1120 <is_prime+0x20>
mov    %r8d,%eax
ret
xor    %r8d,%r8d
mov    %r8d,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp slt i32 %0, 4
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = lshr i32 %0, 1
br label %8
5: ; preds = %8
%6 = add nuw nsw i32 %9, 1
%7 = icmp eq i32 %9, %4
br i1 %7, label %12, label %8
8: ; preds = %3, %5
%9 = phi i32 [ %6, %5 ], [ 2, %3 ]
%10 = srem i32 %0, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %8, %5, %1
%13 = phi i32 [ 1, %1 ], [ 1, %5 ], [ 0, %8 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ kprintf(char *, int);
void isrHandle11() { kprintf("ISR %d.\n", 11); }


x86 assembly (clang, -O0):
<isrHandle11>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0xb,%esi
call   1030 <kprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<isrHandle11>:
lea    0xee9(%rip),%rdi
mov    $0xb,%esi
jmp    1030 <kprintf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle11() {
%1 = call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 11)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle11() {
%1 = tail call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 11)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void grid_check(int x, int y) { printf("grid check %d, %d\n", x, y); }


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"grid check %d, %d\0A\00"
define void @grid_check(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 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"grid check %d, %d\0A\00"
define void @grid_check(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ *tlog_syslog_priority_to_str(int);
bool tlog_syslog_priority_is_valid(int priority) {
  return tlog_syslog_priority_to_str(priority) != NULL;
}


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

x86 assembly (clang, -O2):
<tlog_syslog_priority_is_valid>:
push   %rax
call   1030 <tlog_syslog_priority_to_str@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @tlog_syslog_priority_is_valid(i32 %0) {
%2 = tail call i32* @tlog_syslog_priority_to_str(i32 %0)
%3 = icmp ne i32* %2, null
%4 = zext i1 %3 to i32
ret i32 %4
}
int main() {
  void *table[] = {&&l0, &&l1, &&l2};
  int in, out;
  if (in >= 0 && in <= 2) {
    goto *(table[in]);
  l0:
    out = 0;
    goto result;
  l1:
    out = 1;
    goto result;
  l2:
    out = 2;
    goto result;
  result:
    assert(in == out);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cd7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2cd4(%rip),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     119a <main+0x8a>
cmpl   $0x2,-0x24(%rbp)
jg     119a <main+0x8a>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rax
mov    %rax,-0x30(%rbp)
jmp    11a3 <main+0x93>
movl   $0x0,-0x28(%rbp)
jmp    1185 <main+0x75>
movl   $0x1,-0x28(%rbp)
jmp    1185 <main+0x75>
movl   $0x2,-0x28(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret
mov    -0x30(%rbp),%rax
jmp    *%rax

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

LLVM IR (-O0):
@__const.main.table = [3 x i8*] [i8* blockaddress(@main, %16), i8* blockaddress(@main, %17), i8* blockaddress(@main, %18)]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8*]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [3 x i8*]* %2 to i8*
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %25
8: ; preds = %0
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 2
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 %13
%15 = load i8*, i8** %14
br label %27
16: ; preds = %27
store i32 0, i32* %4
br label %19
17: ; preds = %27
store i32 1, i32* %4
br label %19
18: ; preds = %27
store i32 2, i32* %4
br label %19
19: ; preds = %18, %17, %16
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = icmp eq i32 %20, %21
%23 = zext i1 %22 to i32
%24 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %23)
br label %25
25: ; preds = %19, %8, %0
%26 = load i32, i32* %1
ret i32 %26
27: ; preds = %11
%28 = phi i8* [ %15, %11 ]
indirectbr i8* %28, [label %16, label %17, label %18]
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello world!\n\n\n");
  printf("Hola Mundo!\n\n\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"Hello world!\0A\0A\0A\00"
@.str.1 = [15 x i8] c"Hola Mundo!\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [15 x i8] c"Hello world!\0A\0A\00"
@str.2 = [14 x i8] c"Hola Mundo!\0A\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
void io_wait() {
  asm("jmp 1f\n"
      "1:jmp 2f\n"
      "2:");
}


x86 assembly (clang, -O0):
<io_wait>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <io_wait+0x9>
jmp    110e <io_wait+0xe>
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_wait>:
jmp    1102 <io_wait+0x2>
jmp    1104 <io_wait+0x4>
ret

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

LLVM IR (-O2):
define void @io_wait() {
tail call void asm sideeffect "jmp 1f\0A1:jmp 2f\0A2:", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int main() {
  int a;
  a = a + 1;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
float foo007(float a, double b, double c) { return (a * b + c); }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @foo007(float %0, double %1, double %2) {
%4 = alloca float
%5 = alloca double
%6 = alloca double
store float %0, float* %4
store double %1, double* %5
store double %2, double* %6
%7 = load float, float* %4
%8 = fpext float %7 to double
%9 = load double, double* %5
%10 = load double, double* %6
%11 = call double @llvm.fmuladd.f64(double %8, double %9, double %10)
%12 = fptrunc double %11 to float
ret float %12
}

LLVM IR (-O2):
define float @foo007(float %0, double %1, double %2) {
%4 = fpext float %0 to double
%5 = tail call double @llvm.fmuladd.f64(double %4, double %1, double %2)
%6 = fptrunc double %5 to float
ret float %6
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ stat(char const *, struct stat *);
int file_exists(const char *file) {
  struct stat file_stat;
  if (!stat(file, &file_stat))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<file_exists>:
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,%eax
jne    113e <file_exists+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1145 <file_exists+0x35>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @file_exists(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @stat(i8* %5, %struct.stat* %4)
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %1
store i32 1, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @file_exists(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
unsigned char is_power_of_two(int n) {
  if (n <= 0)
    return 0;
  int m;
  m = n & (n - 1);
  return m == 0 ? 1 : 0;
}


x86 assembly (clang, -O0):
<is_power_of_two>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     111a <is_power_of_two+0x1a>
movb   $0x0,-0x1(%rbp)
jmp    113b <is_power_of_two+0x3b>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_power_of_two>:
test   %edi,%edi
jle    110d <is_power_of_two+0xd>
lea    -0x1(%rdi),%eax
test   %eax,%edi
sete   %al
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define zeroext i8 @is_power_of_two(i32 %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 0, i8* %2
br label %18
8: ; preds = %1
%9 = load i32, i32* %3
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 1
%12 = and i32 %9, %11
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 1, i32 0
%17 = trunc i32 %16 to i8
store i8 %17, i8* %2
br label %18
18: ; preds = %8, %7
%19 = load i8, i8* %2
ret i8 %19
}

LLVM IR (-O2):
define zeroext i8 @is_power_of_two(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.ctpop.i32(i32 %0)
%5 = icmp ult i32 %4, 2
%6 = zext i1 %5 to i8
br label %7
7: ; preds = %1, %3
%8 = phi i8 [ %6, %3 ], [ 0, %1 ]
ret i8 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ __pid_t;

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int __kill(int /*<<< orphan*/, int);
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int killpg(__pid_t pgrp, int sig) {
  if (pgrp < 0) {
    __set_errno(EINVAL);
    return -1;
  }
  return __kill(-pgrp, sig);
}


x86 assembly (clang, -O0):
<killpg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1152 <killpg+0x32>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <killpg+0x42>
xor    %edi,%edi
sub    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <__kill@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<killpg>:
test   %edi,%edi
js     112b <killpg+0xb>
neg    %edi
jmp    1040 <__kill@plt>
push   %rax
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @killpg(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @EINVAL
%10 = call i32 @__set_errno(i32 %9)
store i32 -1, i32* %3
br label %16
11: ; preds = %2
%12 = load i32, i32* %4
%13 = sub nsw i32 0, %12
%14 = load i32, i32* %5
%15 = call i32 @__kill(i32 %13, i32 %14)
store i32 %15, i32* %3
br label %16
16: ; preds = %11, %8
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @killpg(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @EINVAL
%6 = tail call i32 @__set_errno(i32 %5)
br label %10
7: ; preds = %2
%8 = sub nsw i32 0, %0
%9 = tail call i32 @__kill(i32 %8, i32 %1)
br label %10
10: ; preds = %7, %4
%11 = phi i32 [ -1, %4 ], [ %9, %7 ]
ret i32 %11
}
/* Variables and functions */
int os_perf_callchain_smpl();
int perf_callchain_smpl(void) { return (os_perf_callchain_smpl()); }


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

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

LLVM IR (-O0):
define i32 @perf_callchain_smpl() {
%1 = call i32 (...) @os_perf_callchain_smpl()
ret i32 %1
}

LLVM IR (-O2):
define i32 @perf_callchain_smpl() {
%1 = tail call i32 (...) @os_perf_callchain_smpl()
ret i32 %1
}
void arch_Intr_Disable(void) { asm volatile("cli"); }


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

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

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

LLVM IR (-O2):
define void @arch_Intr_Disable() {
tail call void asm sideeffect "cli", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ max_heapify(void *, size_t, size_t, long long,
                               int (*)(void *, void *));
size_t build_max_heapify(void *arr, size_t size, size_t count,
                         int (*comp)(void *key1, void *key2)) {
  for (long long i = (count / 2); i >= 0; i--) {
    max_heapify(arr, size, count, i, comp);
  }
  return count;
}


x86 assembly (clang, -O0):
<build_max_heapify>:
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    -0x18(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jl     1169 <build_max_heapify+0x59>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1030 <max_heapify@plt>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
jmp    1134 <build_max_heapify+0x24>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_max_heapify>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%r13
mov    %rdx,%rbx
shr    %rbx
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
mov    %r14,%r8
call   1030 <max_heapify@plt>
add    $0xffffffffffffffff,%rbx
jb     1130 <build_max_heapify+0x20>
mov    %r12,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @build_max_heapify(i8* %0, i64 %1, i64 returned %2, i32 (i8*, i8*)* %3) {
%5 = lshr i64 %2, 1
br label %7
6: ; preds = %7
ret i64 %2
7: ; preds = %4, %7
%8 = phi i64 [ %5, %4 ], [ %10, %7 ]
%9 = tail call i32 @max_heapify(i8* %0, i64 %1, i64 %2, i64 %8, i32 (i8*, i8*)* %3)
%10 = add nsw i64 %8, -1
%11 = icmp eq i64 %8, 0
br i1 %11, label %6, label %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint_least16_t;
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t endian_16lo8(uint_least16_t word) { return (uint8_t)word; }


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

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

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

LLVM IR (-O2):
define i32 @endian_16lo8(i32 returned %0) {
ret i32 %0
}
void I2CMasterDisable(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000020))) &= ~(0x00000010);
}


x86 assembly (clang, -O0):
<I2CMasterDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%rcx
and    $0xffffffffffffffef,%rcx
mov    %rcx,0x20(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CMasterDisable>:
andq   $0xffffffffffffffef,0x20(%rdi)
ret

LLVM IR (-O0):
define void @I2CMasterDisable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add i64 %3, 32
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, -17
store volatile i64 %7, i64* %5
ret void
}

LLVM IR (-O2):
define void @I2CMasterDisable(i64 %0) {
%2 = add i64 %0, 32
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = and i64 %4, -17
store volatile i64 %5, i64* %3
ret void
}
void pari_malloc() {}


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

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

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

LLVM IR (-O2):
define void @pari_malloc() {
ret void
}
int test_greatestBitPos(int x) {
  unsigned mask = 1 << 31;
  if (x == 0)
    return 0;
  while (!(mask & x)) {
    mask = mask >> 1;
  }
  return mask;
}


x86 assembly (clang, -O0):
<test_greatestBitPos>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x80000000,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1124 <test_greatestBitPos+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1158 <test_greatestBitPos+0x58>
jmp    1129 <test_greatestBitPos+0x29>
mov    -0xc(%rbp),%eax
and    -0x8(%rbp),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1144 <test_greatestBitPos+0x44>
jmp    1152 <test_greatestBitPos+0x52>
mov    -0xc(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <test_greatestBitPos+0x29>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_greatestBitPos>:
test   %edi,%edi
je     1119 <test_greatestBitPos+0x19>
mov    $0x80000000,%ecx
nopl   0x0(%rax)
mov    %ecx,%eax
shr    %ecx
test   %edi,%eax
je     1110 <test_greatestBitPos+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @test_greatestBitPos(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ -2147483648, %1 ]
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, 0
%7 = lshr i32 %4, 1
br i1 %6, label %3, label %8
8: ; preds = %3, %1
%9 = phi i32 [ 0, %1 ], [ %4, %3 ]
ret i32 %9
}
/* Type definitions */
typedef size_t uint32_t;

/* Variables and functions */
void *memset_byte(void *s, int c, uint32_t n) {
  uint32_t i;
  char *b;
  b = (char *)s;
  for (i = 0; i < n; i++)
    b[i] = c;
  return s;
}


x86 assembly (clang, -O0):
<memset_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    114e <memset_byte+0x4e>
mov    -0xc(%rbp),%eax
mov    %al,%dl
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    111f <memset_byte+0x1f>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset_byte>:
push   %rbx
mov    %rdi,%rbx
test   %rdx,%rdx
je     1121 <memset_byte+0x11>
mov    %rbx,%rdi
call   1030 <memset@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @memset_byte(i8* returned writeonly %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
br label %7
7: ; preds = %5, %3
ret i8* %0
}
double notmain() {}


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

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

LLVM IR (-O0):
define double @notmain() {
%1 = alloca double
%2 = load double, double* %1
ret double %2
}

LLVM IR (-O2):
define double @notmain() {
ret double undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void convert(int num) {
  if (num / 2 == 1 || num / 2 == 0)
    printf("%d", num / 2);
  else
    convert(num / 2);
  printf("%d", num % 2);
}


x86 assembly (clang, -O0):
<convert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x1,%eax
je     1153 <convert+0x33>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
jne    1171 <convert+0x51>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
jmp    1183 <convert+0x63>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <convert@plt>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert>:
push   %rbx
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
mov    %eax,%esi
sar    %esi
and    $0xfffffffe,%eax
mov    %edi,%ebx
sub    %eax,%ebx
add    $0x1,%edi
cmp    $0x4,%edi
ja     1156 <convert+0x36>
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <printf@plt>
mov    %esi,%edi
call   1030 <convert@plt>
jmp    1147 <convert+0x27>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @convert(i32 %0) {
%2 = sdiv i32 %0, 2
%3 = srem i32 %0, 2
switch i32 %0, label %6 [
i32 -1, label %4
i32 3, label %4
i32 2, label %4
i32 1, label %4
i32 0, label %4
]
4: ; preds = %1, %1, %1, %1, %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %7
6: ; preds = %1
tail call void @convert(i32 %2)
br label %7
7: ; preds = %6, %4
%8 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
int test_imm_11int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x11 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_11int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1114112
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int read(int, char *, int);
int profile_clock(void *args) {
  int fd = *((int *)args);
  char buf;
  int ret = read(fd, &buf, 1);
  return ret;
}


x86 assembly (clang, -O0):
<profile_clock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0xd(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<profile_clock>:
push   %rax
mov    (%rdi),%edi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @profile_clock(i8* nocapture %0) {
%2 = alloca i8
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = call i32 @read(i32 %4, i8* %2, i32 1)
ret i32 %5
}
short sbasic(short *a, short b, short *c) { return a[0] = b + c[0] + c[1]; }


x86 assembly (clang, -O0):
<sbasic>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %rdx,-0x18(%rbp)
movswl -0xa(%rbp),%eax
mov    -0x18(%rbp),%rcx
movswl (%rcx),%ecx
add    %ecx,%eax
mov    -0x18(%rbp),%rcx
movswl 0x2(%rcx),%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    %ax,(%rcx)
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbasic>:
mov    %esi,%eax
add    (%rdx),%ax
add    0x2(%rdx),%ax
mov    %ax,(%rdi)
ret

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

LLVM IR (-O2):
define signext i16 @sbasic(i16* nocapture writeonly %0, i16 signext %1, i16* nocapture %2) {
%4 = load i16, i16* %2
%5 = add i16 %4, %1
%6 = getelementptr inbounds i16, i16* %2, i64 1
%7 = load i16, i16* %6
%8 = add i16 %5, %7
store i16 %8, i16* %0
ret i16 %8
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ shutdown(int, int);
void net_close(int fd) {
  shutdown(fd, 2);
  close(fd);
}


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

x86 assembly (clang, -O2):
<net_close>:
push   %rbx
mov    %edi,%ebx
mov    $0x2,%esi
call   1030 <shutdown@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <close@plt>

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

LLVM IR (-O2):
define void @net_close(i32 %0) {
%2 = tail call i32 @shutdown(i32 %0, i32 2)
%3 = tail call i32 @close(i32 %0)
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t decodeTimeout(uint16_t reg_val) {
  return (uint16_t)((reg_val & 0x00FF) << (uint16_t)((reg_val & 0xFF00) >> 8)) +
         1;
}


x86 assembly (clang, -O0):
<decodeTimeout>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
shl    %cl,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decodeTimeout>:
mov    %edi,%ecx
movzbl %cl,%eax
shr    $0x8,%ecx
shl    %cl,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @decodeTimeout(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = load i32, i32* %2
%6 = and i32 %5, 65280
%7 = ashr i32 %6, 8
%8 = shl i32 %4, %7
%9 = add nsw i32 %8, 1
ret i32 %9
}

LLVM IR (-O2):
define i32 @decodeTimeout(i32 %0) {
%2 = and i32 %0, 255
%3 = lshr i32 %0, 8
%4 = and i32 %3, 255
%5 = shl i32 %2, %4
%6 = add nsw i32 %5, 1
ret i32 %6
}
/* Variables and functions */
int mksym_i32();
void init_int_buff(int buff[], int len) {
  for (int i = 0; i < len; i++) {
    buff[i] = mksym_i32();
  }
}


x86 assembly (clang, -O0):
<init_int_buff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1154 <init_int_buff+0x44>
mov    $0x0,%al
call   1030 <mksym_i32@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <init_int_buff+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_int_buff>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1144 <init_int_buff+0x34>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <mksym_i32@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <init_int_buff+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @init_int_buff(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %16, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = call i32 (...) @mksym_i32()
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
store i32 %11, i32* %15
br label %16
16: ; preds = %10
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %6
19: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @init_int_buff(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %11, %7 ]
%9 = tail call i32 (...) @mksym_i32()
%10 = getelementptr inbounds i32, i32* %0, i64 %8
store i32 %9, i32* %10
%11 = add nuw nsw i64 %8, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %6, label %7
}
void __attribute((stdcall)) f7(foo) int foo;
{}


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

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

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

LLVM IR (-O2):
define void @f7(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sem_unget(int);
void sem_ungetp(int *p) {
  if (*p)
    sem_unget(*p);
}


x86 assembly (clang, -O0):
<sem_ungetp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
je     1134 <sem_ungetp+0x24>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <sem_unget@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_ungetp>:
mov    (%rdi),%edi
test   %edi,%edi
je     111b <sem_ungetp+0xb>
jmp    1030 <sem_unget@plt>
ret

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

LLVM IR (-O2):
define void @sem_ungetp(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @sem_unget(i32 %2)
br label %6
6: ; preds = %4, %1
ret void
}
void store1z(int *array) {
  array[200] = 0;
  array[201] = 0;
  array[202] = 0;
  array[203] = 0;
}


x86 assembly (clang, -O0):
<store1z>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,0x320(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x324(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x328(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x32c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<store1z>:
xorps  %xmm0,%xmm0
movups %xmm0,0x320(%rdi)
ret

LLVM IR (-O0):
define void @store1z(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 200
store i32 0, i32* %4
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 201
store i32 0, i32* %6
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 202
store i32 0, i32* %8
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 203
store i32 0, i32* %10
ret void
}

LLVM IR (-O2):
define void @store1z(i32* nocapture writeonly %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 200
%3 = bitcast i32* %2 to i8*
ret void
}
void instruc_33() {}


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

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

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

LLVM IR (-O2):
define void @instruc_33() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  int a = 10;
  printf("hello world! ");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"hello world! \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int read_word(const char *ptr, unsigned short *value) {
  *value = *(const unsigned short *)ptr;
  return sizeof(short);
}


x86 assembly (clang, -O0):
<read_word>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_word>:
movzwl (%rdi),%eax
mov    %ax,(%rsi)
mov    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @read_word(i8* nocapture %0, i16* nocapture writeonly %1) {
%3 = bitcast i8* %0 to i16*
%4 = load i16, i16* %3
store i16 %4, i16* %1
ret i32 2
}
int tax(int a, int x) { return a * (100 + x) / 100; }


x86 assembly (clang, -O0):
<tax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x64,%ecx
imul   %ecx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<tax>:
add    $0x64,%esi
imul   %edi,%esi
movslq %esi,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @tax(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 = add nsw i32 100, %6
%8 = mul nsw i32 %5, %7
%9 = sdiv i32 %8, 100
ret i32 %9
}

LLVM IR (-O2):
define i32 @tax(i32 %0, i32 %1) {
%3 = add nsw i32 %1, 100
%4 = mul nsw i32 %3, %0
%5 = sdiv i32 %4, 100
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ aaa();
int /*<<< orphan*/ www();
int main(void) {
  www();
  aaa();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @www()
%2 = tail call i32 (...) @aaa()
ret i32 0
}
/* Variables and functions */
size_t intlen(size_t);
size_t bulklen(size_t len) { return 1 + intlen(len) + 2 + len + 2; }


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

x86 assembly (clang, -O2):
<bulklen>:
push   %rbx
mov    %rdi,%rbx
call   1030 <intlen@plt>
add    %rbx,%rax
add    $0x5,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @bulklen(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @intlen(i64 %3)
%5 = add i64 1, %4
%6 = add i64 %5, 2
%7 = load i64, i64* %2
%8 = add i64 %6, %7
%9 = add i64 %8, 2
ret i64 %9
}

LLVM IR (-O2):
define i64 @bulklen(i64 %0) {
%2 = tail call i64 @intlen(i64 %0)
%3 = add i64 %0, 5
%4 = add i64 %3, %2
ret i64 %4
}
unsigned xrop3_254_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T | S;
  stk1 = D | stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_254_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_254_0_1>:
mov    %edi,%ecx
shl    $0x8,%ecx
lea    (%rcx,%rdi,1),%edx
mov    %esi,%eax
shl    $0x8,%eax
or     %eax,%ecx
or     %esi,%eax
or     $0xff,%ecx
not    %eax
or     %edx,%eax
and    %ecx,%eax
not    %edi
and    %esi,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_254_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = or i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %5
%26 = load i32, i32* %9
%27 = or i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = load i32, i32* %6
%30 = and i32 %28, %29
%31 = load i32, i32* %8
%32 = load i32, i32* %7
%33 = xor i32 %32, -1
%34 = and i32 %31, %33
%35 = or i32 %30, %34
%36 = load i32, i32* %7
%37 = load i32, i32* %6
%38 = xor i32 %37, -1
%39 = and i32 %36, %38
%40 = load i32, i32* %5
%41 = and i32 %39, %40
%42 = or i32 %35, %41
ret i32 %42
}

LLVM IR (-O2):
define i32 @xrop3_254_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = or i32 %4, %3
%6 = zext i8 %1 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %6
%9 = or i32 %4, %7
%10 = or i32 %9, 255
%11 = xor i32 %8, -1
%12 = or i32 %5, %11
%13 = and i32 %12, %10
%14 = xor i32 %3, -1
%15 = and i32 %14, %6
%16 = or i32 %13, %15
ret i32 %16
}
void _swap_unsigned(unsigned *i, unsigned *j) {
  unsigned tmp = *i;
  *i = *j;
  *j = tmp;
}


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

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

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

LLVM IR (-O2):
define void @_swap_unsigned(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}