xunge/DecIR huggingface dataset:
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};

/* Variables and functions */
int spi_disable_blockprotect_generic(struct flashrom_flashctx *, int, int,
                                     int /*<<< orphan*/, int);
int spi_disable_blockprotect_at25f(struct flashrom_flashctx *flash) {
  return spi_disable_blockprotect_generic(flash, 0x0C, 1 << 7, 0, 0xFF);
}


x86 assembly (clang, -O0):
<spi_disable_blockprotect_at25f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xc,%esi
mov    $0x80,%edx
xor    %ecx,%ecx
mov    $0xff,%r8d
call   1030 <spi_disable_blockprotect_generic@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_disable_blockprotect_at25f>:
mov    $0xc,%esi
mov    $0x80,%edx
xor    %ecx,%ecx
mov    $0xff,%r8d
jmp    1030 <spi_disable_blockprotect_generic@plt>

LLVM IR (-O0):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_disable_blockprotect_at25f(%struct.flashrom_flashctx* %0) {
%2 = alloca %struct.flashrom_flashctx*
store %struct.flashrom_flashctx* %0, %struct.flashrom_flashctx** %2
%3 = load %struct.flashrom_flashctx*, %struct.flashrom_flashctx** %2
%4 = call i32 @spi_disable_blockprotect_generic(%struct.flashrom_flashctx* %3, i32 12, i32 128, i32 0, i32 255)
ret i32 %4
}

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define i32 @spi_disable_blockprotect_at25f(%struct.flashrom_flashctx* %0) {
%2 = tail call i32 @spi_disable_blockprotect_generic(%struct.flashrom_flashctx* %0, i32 12, i32 128, i32 0, i32 255)
ret i32 %2
}
/* Variables and functions */
int random();
int random_parent() { return random() % 500; }


x86 assembly (clang, -O0):
<random_parent>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <random@plt>
mov    $0x1f4,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_parent>:
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
cltq
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x1f4,%ecx,%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @random_parent() {
%1 = call i32 (...) @random()
%2 = srem i32 %1, 500
ret i32 %2
}

LLVM IR (-O2):
define i32 @random_parent() {
%1 = tail call i32 (...) @random()
%2 = srem i32 %1, 500
ret i32 %2
}
/* Variables and functions */
int seteuid(int);
int setuid(int);
int setreuid(int ruid, int euid) {
  if (ruid != -1)
    if (setuid(ruid) == -1)
      return (-1);
  if (euid != -1)
    if (seteuid(euid) == -1)
      return (-1);
}


x86 assembly (clang, -O0):
<setreuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
je     115a <setreuid+0x3a>
mov    -0x8(%rbp),%edi
call   1030 <setuid@plt>
cmp    $0xffffffff,%eax
jne    1155 <setreuid+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    1186 <setreuid+0x66>
jmp    115a <setreuid+0x3a>
cmpl   $0xffffffff,-0xc(%rbp)
je     1186 <setreuid+0x66>
mov    -0xc(%rbp),%edi
call   1040 <seteuid@plt>
cmp    $0xffffffff,%eax
jne    1181 <setreuid+0x61>
movl   $0xffffffff,-0x4(%rbp)
jmp    1186 <setreuid+0x66>
jmp    1186 <setreuid+0x66>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setreuid>:
push   %rbx
mov    %esi,%ebx
cmp    $0xffffffff,%edi
je     1145 <setreuid+0x25>
call   1030 <setuid@plt>
cmp    $0xffffffff,%ebx
je     113e <setreuid+0x1e>
cmp    $0xffffffff,%eax
je     113e <setreuid+0x1e>
mov    %ebx,%edi
call   1040 <seteuid@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
cmp    $0xffffffff,%ebx
jne    1137 <setreuid+0x17>
jmp    113e <setreuid+0x1e>

LLVM IR (-O0):
define i32 @setreuid(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 ne i32 %6, -1
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i32, i32* %4
%10 = call i32 @setuid(i32 %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 -1, i32* %3
br label %23
13: ; preds = %8
br label %14
14: ; preds = %13, %2
%15 = load i32, i32* %5
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i32, i32* %5
%19 = call i32 @seteuid(i32 %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 -1, i32* %3
br label %23
22: ; preds = %17
br label %23
23: ; preds = %12, %21, %22, %14
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @setreuid(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, -1
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i32 @setuid(i32 %0)
%6 = icmp eq i32 %5, -1
%7 = icmp eq i32 %1, -1
%8 = or i1 %7, %6
br i1 %8, label %13, label %11
9: ; preds = %2
%10 = icmp eq i32 %1, -1
br i1 %10, label %13, label %11
11: ; preds = %4, %9
%12 = tail call i32 @seteuid(i32 %1)
br label %13
13: ; preds = %11, %4, %9
ret i32 -1
}
/* Variables and functions */
scalar_t__ scanf(char *, int *);
int /*<<< orphan*/ stop_at_ten(int);
int main(void) {
  int i;
  while (scanf("%d", &i) != 0)
    stop_at_ten(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
je     1156 <main+0x36>
mov    -0x8(%rbp),%edi
call   1030 <stop_at_ten@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     1169 <main+0x49>
lea    0xebf(%rip),%r14
lea    0x4(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    0x4(%rsp),%edi
call   1030 <stop_at_ten@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %6, %0
%4 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @stop_at_ten(i32 %7)
br label %3
9: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %0, %5
%6 = load i32, i32* %1
%7 = call i32 @stop_at_ten(i32 %6)
%8 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5, %0
ret i32 0
}
/* Type definitions */
struct block_iter {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ block_iter_eat_line(struct block_iter *);
void block_iter_move_down(struct block_iter *bi, int count) {
  while (count--)
    block_iter_eat_line(bi);
}


x86 assembly (clang, -O0):
<block_iter_move_down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     1141 <block_iter_move_down+0x31>
mov    -0x8(%rbp),%rdi
call   1030 <block_iter_eat_line@plt>
jmp    111f <block_iter_move_down+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<block_iter_move_down>:
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
je     112d <block_iter_move_down+0x1d>
mov    %esi,%ebx
mov    %rdi,%r14
nopl   (%rax)
mov    %r14,%rdi
call   1030 <block_iter_eat_line@plt>
add    $0xffffffff,%ebx
jne    1120 <block_iter_move_down+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
%struct.block_iter = type { i32 }
define void @block_iter_move_down(%struct.block_iter* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %1, %2 ]
%6 = add nsw i32 %5, -1
%7 = tail call i32 @block_iter_eat_line(%struct.block_iter* %0)
%8 = icmp eq i32 %6, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
float Sleef_tanhf_u10(float x) { return __builtin_tanhf(x); }


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

x86 assembly (clang, -O2):
<Sleef_tanhf_u10>:
jmp    1030 <tanhf@plt>

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

LLVM IR (-O2):
define float @Sleef_tanhf_u10(float %0) {
%2 = tail call float @tanhf(float %0)
ret float %2
}
void closeDMX() {}


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

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

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

LLVM IR (-O2):
define void @closeDMX() {
ret void
}
/* Variables and functions */
scalar_t__ exists(char *);
const char *scan_pm_wlan() {
  if (exists("/sys/bus/platform/drivers/gta02-pm-wlan/gta02-pm-wlan.0"))
    return "/sys/bus/platform/drivers/gta02-pm-wlan/gta02-pm-wlan.0";
  return NULL;
}


x86 assembly (clang, -O0):
<scan_pm_wlan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <exists@plt>
cmp    $0x0,%rax
je     113e <scan_pm_wlan+0x2e>
lea    0xecb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1146 <scan_pm_wlan+0x36>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_pm_wlan>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <exists@plt>
test   %rax,%rax
cmovne %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [56 x i8] c"/sys/bus/platform/drivers/gta02-pm-wlan/gta02-pm-wlan.0\00"
define i8* @scan_pm_wlan() {
%1 = alloca i8*
%2 = call i64 @exists(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8** %1
br label %6
5: ; preds = %0
store i8* null, i8** %1
br label %6
6: ; preds = %5, %4
%7 = load i8*, i8** %1
ret i8* %7
}

LLVM IR (-O2):
@.str = [56 x i8] c"/sys/bus/platform/drivers/gta02-pm-wlan/gta02-pm-wlan.0\00"
define i8* @scan_pm_wlan() {
%1 = tail call i64 @exists(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* null, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
int g(int i, int j) {
  int k = i != j;
  return k;
}


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

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

LLVM IR (-O0):
define i32 @g(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* %4
%8 = icmp ne i32 %6, %7
%9 = zext i1 %8 to i32
store i32 %9, i32* %5
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
define i32 @g(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int allowedOp(int op) {
  assert(68 == 69 - 1 && 69 == 70 - 1 && 70 == 71 - 1 && 67 == 68 - 1);
  return op == 63 || (op >= 67 && op <= 71);
}


x86 assembly (clang, -O0):
<allowedOp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%al
cmpl   $0x3f,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1153 <allowedOp+0x43>
xor    %eax,%eax
cmpl   $0x43,-0x4(%rbp)
mov    %al,-0x6(%rbp)
jl     114d <allowedOp+0x3d>
cmpl   $0x47,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allowedOp>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
call   1030 <assert@plt>
cmp    $0x3f,%ebx
sete   %al
add    $0xffffffbd,%ebx
cmp    $0x5,%ebx
setb   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @allowedOp(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @assert(i32 1)
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 63
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sge i32 %7, 67
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp sle i32 %10, 71
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ false, %6 ], [ %11, %9 ]
br label %14
14: ; preds = %12, %1
%15 = phi i1 [ true, %1 ], [ %13, %12 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @allowedOp(i32 %0) {
%2 = tail call i32 @assert(i32 1)
%3 = icmp eq i32 %0, 63
%4 = add i32 %0, -67
%5 = icmp ult i32 %4, 5
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void junk_() { printf("lower case, _ "); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"lower case, _ \00"
define void @junk_() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"lower case, _ \00"
define void @junk_() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ pfq_fetchb_common();
int /*<<< orphan*/ wait(int, int /*<<< orphan*/);
uint8_t pfq_fetchb(void) {
  uint8_t ret;
  ret = pfq_fetchb_common();
  wait(1, 0);
  return ret;
}


x86 assembly (clang, -O0):
<pfq_fetchb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <pfq_fetchb_common@plt>
mov    %eax,-0x4(%rbp)
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <wait@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfq_fetchb>:
push   %rbx
xor    %eax,%eax
call   1030 <pfq_fetchb_common@plt>
mov    %eax,%ebx
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <wait@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @pfq_fetchb() {
%1 = alloca i32
%2 = call i32 (...) @pfq_fetchb_common()
store i32 %2, i32* %1
%3 = call i32 @wait(i32 1, i32 0)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @pfq_fetchb() {
%1 = tail call i32 (...) @pfq_fetchb_common()
%2 = tail call i32 @wait(i32 1, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, size_t);
size_t strnlen(char const *, size_t);
char *stpncpy(char *restrict whither, const char *restrict whence,
              size_t maxlen) {
  size_t n = strnlen(whence, maxlen);
  memcpy(whither, whence, n);
  memset(whither + n, 0, maxlen - n);
  return whither + n;
}


x86 assembly (clang, -O0):
<stpncpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strnlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <memcpy@plt>
mov    -0x8(%rbp),%rdi
add    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rdx
sub    -0x20(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
add    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stpncpy>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <strnlen@plt>
mov    %rax,%r12
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1050 <memcpy@plt>
add    %r12,%rbx
sub    %r12,%r15
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r15,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @stpncpy(i8* noalias %0, i8* noalias %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i64 @strnlen(i8* %8, i64 %9)
store i64 %10, i64* %7
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = load i64, i64* %7
%14 = call i32 @memcpy(i8* %11, i8* %12, i64 %13)
%15 = load i8*, i8** %4
%16 = load i64, i64* %7
%17 = getelementptr inbounds i8, i8* %15, i64 %16
%18 = load i64, i64* %6
%19 = load i64, i64* %7
%20 = sub i64 %18, %19
%21 = call i32 @memset(i8* %17, i32 0, i64 %20)
%22 = load i8*, i8** %4
%23 = load i64, i64* %7
%24 = getelementptr inbounds i8, i8* %22, i64 %23
ret i8* %24
}

LLVM IR (-O2):
define i8* @stpncpy(i8* noalias %0, i8* noalias %1, i64 %2) {
%4 = tail call i64 @strnlen(i8* %1, i64 %2)
%5 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %4)
%6 = getelementptr inbounds i8, i8* %0, i64 %4
%7 = sub i64 %2, %4
%8 = tail call i32 @memset(i8* %6, i32 0, i64 %7)
ret i8* %6
}
int foo(int time, int n) {
#pragma omp parallel for default(shared) schedule(dynamic, 1) reduction(+ : time)
  for (int i = 1; i < n; ++i)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1130 <foo+0x30>
jmp    1122 <foo+0x22>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <foo+0x11>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo(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 1, i32* %5
br label %6
6: ; preds = %11, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %6
br label %11
11: ; preds = %10
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
store i32 %13, i32* %5
br label %6
14: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
ret i32 0
}
int hash(char *sp) {
  unsigned h, g;
  for (h = 0; *sp != '\0'; sp++) {
    h = (h << 4) + (unsigned)(*sp);
    if (g = h & 0xf0000000) {
      h = (h ^ g >> 24) ^ g;
    }
    return (h % 113);
  }
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1165 <hash+0x65>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xf0000000,%eax
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     1156 <hash+0x56>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
shr    $0x18,%ecx
xor    %ecx,%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x71,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
movsbl (%rdi),%ecx
test   %ecx,%ecx
je     113e <hash+0x3e>
mov    %ecx,%edx
and    $0xf0000000,%edx
mov    %edx,%esi
shr    $0x18,%esi
mov    %ecx,%eax
and    $0xfffffff,%eax
xor    %esi,%eax
test   %edx,%edx
cmove  %ecx,%eax
imul   $0x21fb7813,%rax,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x6,%edx
imul   $0x71,%edx,%ecx
sub    %ecx,%eax
ret
ret

LLVM IR (-O0):
define i32 @hash(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %6
6: ; preds = %31, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %34
11: ; preds = %6
%12 = load i32, i32* %4
%13 = shl i32 %12, 4
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = add i32 %13, %16
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = and i32 %18, -268435456
store i32 %19, i32* %5
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %11
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = lshr i32 %23, 24
%25 = xor i32 %22, %24
%26 = load i32, i32* %5
%27 = xor i32 %25, %26
store i32 %27, i32* %4
br label %28
28: ; preds = %21, %11
%29 = load i32, i32* %4
%30 = urem i32 %29, 113
store i32 %30, i32* %2
br label %34
31: ; No predecessors!
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %3
br label %6
34: ; preds = %28, %6
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = icmp eq i8 %2, 0
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = and i32 %3, -268435456
%7 = icmp eq i32 %6, 0
%8 = lshr exact i32 %6, 24
%9 = and i32 %3, 268435455
%10 = xor i32 %9, %8
%11 = select i1 %7, i32 %3, i32 %10
%12 = urem i32 %11, 113
br label %13
13: ; preds = %1, %5
%14 = phi i32 [ %12, %5 ], [ undef, %1 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
testDiv() { printf("%d / %d = %d\n", 11, 4, 11 / 4); }


x86 assembly (clang, -O0):
<testDiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0xb,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testDiv>:
lea    0xee9(%rip),%rdi
mov    $0xb,%esi
mov    $0x4,%edx
mov    $0x2,%ecx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%d / %d = %d\0A\00"
define i32 @testDiv() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 11, i32 4, i32 2)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d / %d = %d\0A\00"
define i32 @testDiv() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 11, i32 4, i32 2)
ret i32 undef
}
int test_imm_BDuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xBD << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BDuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 189
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void cleanup() {}


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

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

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

LLVM IR (-O2):
define void @cleanup() {
ret void
}
int doubleComp(double *a1, double *a2) {
  double loc = *a1;
  double loc2 = *a2;
  if (loc < loc2) {
    return -1;
  } else if (loc == loc2) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<doubleComp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1146 <doubleComp+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    1174 <doubleComp+0x74>
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jne    1168 <doubleComp+0x68>
jp     1168 <doubleComp+0x68>
movl   $0x0,-0x4(%rbp)
jmp    1174 <doubleComp+0x74>
jmp    116d <doubleComp+0x6d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubleComp>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movapd %xmm0,%xmm2
cmpneqsd %xmm1,%xmm2
movq   %xmm2,%rcx
and    $0x1,%ecx
ucomisd %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @doubleComp(double* %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca double*
%6 = alloca double
%7 = alloca double
store double* %0, double** %4
store double* %1, double** %5
%8 = load double*, double** %4
%9 = load double, double* %8
store double %9, double* %6
%10 = load double*, double** %5
%11 = load double, double* %10
store double %11, double* %7
%12 = load double, double* %6
%13 = load double, double* %7
%14 = fcmp olt double %12, %13
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 -1, i32* %3
br label %23
16: ; preds = %2
%17 = load double, double* %6
%18 = load double, double* %7
%19 = fcmp oeq double %17, %18
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 0, i32* %3
br label %23
21: ; preds = %16
br label %22
22: ; preds = %21
store i32 1, i32* %3
br label %23
23: ; preds = %22, %20, %15
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @doubleComp(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = fcmp olt double %3, %4
%6 = fcmp une double %3, %4
%7 = zext i1 %6 to i32
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
/* Variables and functions */
int rand();
int nopStat0(void) { return rand(); }


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

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

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

LLVM IR (-O2):
define i32 @nopStat0() {
%1 = tail call i32 (...) @rand()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
void ADCComparatorConfigure(unsigned long ulBase, unsigned long ulComp,
                            unsigned long ulConfig) {
  DEBUG_ASSERT((ulBase == 0x40038000) || (ulBase == 0x40039000));
  DEBUG_ASSERT(ulComp < 8);
  (*((volatile unsigned long *)(ulBase + 0x00000E00 + (ulComp * 4)))) =
      ulConfig;
}


x86 assembly (clang, -O0):
<ADCComparatorConfigure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x1,%al
cmpq   $0x40038000,-0x8(%rbp)
40
mov    %al,-0x19(%rbp)
je     1145 <ADCComparatorConfigure+0x35>
cmpq   $0x40039000,-0x8(%rbp)
40
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
cmpq   $0x8,-0x10(%rbp)
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    $0xe00,%rax
mov    -0x10(%rbp),%rdx
shl    $0x2,%rdx
add    %rdx,%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCComparatorConfigure>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rdi,%rax
and    $0xffffffffffffefff,%rax
xor    %edi,%edi
cmp    $0x40038000,%rax
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x8,%r15
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    %r14,0xe00(%rbx,%r15,4)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ADCComparatorConfigure(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = icmp eq i64 %7, 1073971200
br i1 %8, label %12, label %9
9: ; preds = %3
%10 = load i64, i64* %4
%11 = icmp eq i64 %10, 1073975296
br label %12
12: ; preds = %9, %3
%13 = phi i1 [ true, %3 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
%15 = call i32 @DEBUG_ASSERT(i32 %14)
%16 = load i64, i64* %5
%17 = icmp ult i64 %16, 8
%18 = zext i1 %17 to i32
%19 = call i32 @DEBUG_ASSERT(i32 %18)
%20 = load i64, i64* %6
%21 = load i64, i64* %4
%22 = add i64 %21, 3584
%23 = load i64, i64* %5
%24 = mul i64 %23, 4
%25 = add i64 %22, %24
%26 = inttoptr i64 %25 to i64*
store volatile i64 %20, i64* %26
ret void
}

LLVM IR (-O2):
define void @ADCComparatorConfigure(i64 %0, i64 %1, i64 %2) {
%4 = and i64 %0, -4097
%5 = icmp eq i64 %4, 1073971200
%6 = zext i1 %5 to i32
%7 = tail call i32 @DEBUG_ASSERT(i32 %6)
%8 = icmp ult i64 %1, 8
%9 = zext i1 %8 to i32
%10 = tail call i32 @DEBUG_ASSERT(i32 %9)
%11 = add i64 %0, 3584
%12 = shl i64 %1, 2
%13 = add i64 %11, %12
%14 = inttoptr i64 %13 to i64*
store volatile i64 %2, i64* %14
ret void
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ wgmem_error(char *, ...);
extern void *wg_malloc(size_t size) {
  void *result;
  if (!size) {
    wgmem_error("Error mallocing 0 bytes.\n");
  }
  result = malloc(size);
  if (!result) {
    wgmem_error("Error while mallocing %u bytes.\n", size);
  }
  return result;
}


x86 assembly (clang, -O0):
<wg_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1145 <wg_malloc+0x25>
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <wgmem_error@plt>
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116f <wg_malloc+0x4f>
mov    -0x8(%rbp),%rsi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <wgmem_error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wg_malloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rdi,%rdi
jne    113a <wg_malloc+0x1a>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <wgmem_error@plt>
mov    %r14,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115b <wg_malloc+0x3b>
lea    0xec9(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <wgmem_error@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Error mallocing 0 bytes.\0A\00"
@.str.1 = [33 x i8] c"Error while mallocing %u bytes.\0A\00"
define i8* @wg_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp ne i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 (i8*, ...) @wgmem_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i64, i64* %2
%10 = call i8* @malloc(i64 %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = load i64, i64* %2
%15 = call i32 (i8*, ...) @wgmem_error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i64 %14)
br label %16
16: ; preds = %13, %8
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@.str = [26 x i8] c"Error mallocing 0 bytes.\0A\00"
@.str.1 = [33 x i8] c"Error while mallocing %u bytes.\0A\00"
define noalias i8* @wg_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, ...) @wgmem_error(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = tail call i8* @malloc(i64 %0)
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @wgmem_error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i64 %0)
br label %10
10: ; preds = %8, %5
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ ___exit(int);
int exit(int status) {
  ___exit(status);
  return -1;
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <___exit@plt>
movl   $0xffffffff,-0x4(%rbp)

x86 assembly (clang, -O2):
<exit>:
push   %rax
call   1030 <___exit@plt>

LLVM IR (-O0):
define i32 @exit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @___exit(i32 %4)
store i32 -1, i32* %2
unreachable
}

LLVM IR (-O2):
define i32 @exit(i32 %0) {
%2 = tail call i32 @___exit(i32 %0)
unreachable
}
void dummy_int(void) {}


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

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

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

LLVM IR (-O2):
define void @dummy_int() {
ret void
}
void view_pushANumber(void) { int toBeEntered = 0; }


x86 assembly (clang, -O0):
<view_pushANumber>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @view_pushANumber() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ f(int);
main() {
  f(3);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
call   1030 <f@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
call   1030 <f@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 3)
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 3)
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ usleep(unsigned long);
void delay(unsigned long ms) {
  usleep((ms * 1000));
  return;
}


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

x86 assembly (clang, -O2):
<delay>:
imul   $0x3e8,%rdi,%rdi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @delay(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 %3, 1000
%5 = call i32 @usleep(i64 %4)
ret void
}

LLVM IR (-O2):
define void @delay(i64 %0) {
%2 = mul i64 %0, 1000
%3 = tail call i32 @usleep(i64 %2)
ret void
}
void __DELETE_java_lang_Class(void *me, void *client_data) {}


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

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

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

LLVM IR (-O2):
define void @__DELETE_java_lang_Class(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Type definitions */
struct sockaddr_in {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ recvpktal(int, int /*<<< orphan*/ *, struct sockaddr_in *);
void *recvpkta(int sfd, struct sockaddr_in *rmt_saddr) {
  recvpktal(sfd, NULL, rmt_saddr);
}


x86 assembly (clang, -O0):
<recvpkta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <recvpktal@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recvpkta>:
mov    %rsi,%rdx
xor    %esi,%esi
jmp    1030 <recvpktal@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
define i8* @recvpkta(i32 %0, %struct.sockaddr_in* %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.sockaddr_in*
store i32 %0, i32* %4
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %5
%6 = load i32, i32* %4
%7 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%8 = call i32 @recvpktal(i32 %6, i32* null, %struct.sockaddr_in* %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
define noalias i8* @recvpkta(i32 %0, %struct.sockaddr_in* %1) {
%3 = tail call i32 @recvpktal(i32 %0, i32* null, %struct.sockaddr_in* %1)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void println(char *text) { printf("%s\n", text); }


x86 assembly (clang, -O0):
<println>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<println>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @println(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @println(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void smash_tilde(char *str) {
  for (; *str != '\0'; str++) {
    if (*str == '~')
      *str = '-';
    if (*str == '\'')
      *str = '`';
  }
  return;
}


x86 assembly (clang, -O0):
<smash_tilde>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115c <smash_tilde+0x5c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7e,%eax
jne    112f <smash_tilde+0x2f>
mov    -0x8(%rbp),%rax
movb   $0x2d,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    1146 <smash_tilde+0x46>
mov    -0x8(%rbp),%rax
movb   $0x60,(%rax)
jmp    114b <smash_tilde+0x4b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <smash_tilde+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<smash_tilde>:
jmp    1118 <smash_tilde+0x18>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x60,%cl
mov    %cl,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x27,%al
je     1110 <smash_tilde+0x10>
mov    $0x2d,%cl
cmp    $0x7e,%al
je     1112 <smash_tilde+0x12>
test   %al,%al
jne    1114 <smash_tilde+0x14>
ret

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

LLVM IR (-O2):
define void @smash_tilde(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %9, %8 ]
%4 = load i8, i8* %3
switch i8 %4, label %8 [
i8 0, label %10
i8 126, label %6
i8 39, label %5
]
5: ; preds = %2
br label %6
6: ; preds = %2, %5
%7 = phi i8 [ 96, %5 ], [ 45, %2 ]
store i8 %7, i8* %3
br label %8
8: ; preds = %6, %2
%9 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
10: ; preds = %2
ret void
}
void f(void) {
  struct Y {};
}


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

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

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

LLVM IR (-O2):
define void @f() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int t, km;
  scanf("%d %d", &t, &km);
  printf("%.3lf\n", (t * km) / 12.0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xeaa(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    (%rsp),%eax
imul   0x4(%rsp),%eax
cvtsi2sd %eax,%xmm0
divsd  0xeb7(%rip),%xmm0
cvttsd2si %xmm0,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [7 x i8] c"%.3lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = mul nsw i32 %5, %6
%8 = sitofp i32 %7 to double
%9 = fdiv double %8, 1.200000e+01
%10 = fptosi double %9 to i32
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [7 x i8] c"%.3lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = mul nsw i32 %7, %6
%9 = sitofp i32 %8 to double
%10 = fdiv double %9, 1.200000e+01
%11 = fptosi double %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}
int sum(int a, int b) {
  int c, d;
  return a + b;
}


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

x86 assembly (clang, -O2):
<sum>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @sum(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
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @sum(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
void av_get_bits_per_sample() {}


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

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

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

LLVM IR (-O2):
define void @av_get_bits_per_sample() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f1();
main() { f1(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f1()
ret i32 0
}
char *assert_pass() {
  do {
    if (!(0 == 0))
      return "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/"
             "tests/test_asserts.c"
             ":"
             "23"
             ": "
             "0 == 0";
  } while (0);
  return 0;
}


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

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

LLVM IR (-O0):
define i8* @assert_pass() {
br label %1
1: ; preds = %0
br label %2
2: ; preds = %1
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @assert_pass() {
ret i8* null
}
int test_imm_4Buint16_reg(unsigned short val) {
  return ((val) & (-0x4B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_4Buint16_reg>:
test   $0xffb5,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_4Buint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -75
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
long int daycount2JD(long int daycount) { return (daycount + 2440588L); }


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

x86 assembly (clang, -O2):
<daycount2JD>:
lea    0x253d8c(%rdi),%rax
ret

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

LLVM IR (-O2):
define i64 @daycount2JD(i64 %0) {
%2 = add nsw i64 %0, 2440588
ret i64 %2
}
/* Type definitions */
struct ADrawTag {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int, scalar_t__,
                           unsigned int);
int /*<<< orphan*/ getPsFile(struct ADrawTag *);
void PsFilledCircle(struct ADrawTag *ctx, unsigned int x, unsigned int y,
                    unsigned int r) {
  fprintf(getPsFile(ctx),
          "newpath "
          "%d %d %d 0 360 arc "
          "closepath "
          "fill\n",
          x, 0 - y, r);
}


x86 assembly (clang, -O0):
<PsFilledCircle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getPsFile@plt>
mov    %eax,%edi
mov    -0xc(%rbp),%edx
xor    %eax,%eax
sub    -0x10(%rbp),%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    -0x14(%rbp),%r8d
lea    0xea9(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PsFilledCircle>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%ebp
call   1040 <getPsFile@plt>
neg    %ebx
lea    0xec7(%rip),%rsi
mov    %eax,%edi
mov    %ebp,%edx
mov    %rbx,%rcx
mov    %r14d,%r8d
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
%struct.ADrawTag = type { i32 }
@.str = [43 x i8] c"newpath %d %d %d 0 360 arc closepath fill\0A\00"
define void @PsFilledCircle(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.ADrawTag*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.ADrawTag* %0, %struct.ADrawTag** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.ADrawTag*, %struct.ADrawTag** %5
%10 = call i32 @getPsFile(%struct.ADrawTag* %9)
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = sub i32 0, %12
%14 = zext i32 %13 to i64
%15 = load i32, i32* %8
%16 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %11, i64 %14, i32 %15)
ret void
}

LLVM IR (-O2):
%struct.ADrawTag = type { i32 }
@.str = [43 x i8] c"newpath %d %d %d 0 360 arc closepath fill\0A\00"
define void @PsFilledCircle(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @getPsFile(%struct.ADrawTag* %0)
%6 = sub i32 0, %2
%7 = zext i32 %6 to i64
%8 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %1, i64 %7, i32 %3)
ret void
}