xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
main() {
  int a, b;
  printf("Enter values of a and b");
  scanf(" %d %d ", &a, &b);
  printf("a = %d b = %d", a, b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Enter values of a and b\00"
@.str.1 = [8 x i8] c" %d %d \00"
@.str.2 = [14 x i8] c"a = %d b = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Enter values of a and b\00"
@.str.1 = [8 x i8] c" %d %d \00"
@.str.2 = [14 x i8] c"a = %d b = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8)
ret i32 0
}
/* Variables and functions */
int bs_format_size(char *);
unsigned int bs_format_byte_size(char *format) {
  return bs_format_size(format) / 8;
}


x86 assembly (clang, -O0):
<bs_format_byte_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <bs_format_size@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bs_format_byte_size>:
push   %rax
call   1030 <bs_format_size@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovs  %ecx,%eax
sar    $0x3,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bs_format_byte_size(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @bs_format_size(i8* %3)
%5 = sdiv i32 %4, 8
ret i32 %5
}

LLVM IR (-O2):
define i32 @bs_format_byte_size(i8* %0) {
%2 = tail call i32 @bs_format_size(i8* %0)
%3 = sdiv i32 %2, 8
ret i32 %3
}
fle(float x, float y) {
  if (x <= y)
    return 13;
  else
    return 140;
}


x86 assembly (clang, -O0):
<fle>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     112d <fle+0x2d>
movl   $0xd,-0x4(%rbp)
jmp    1134 <fle+0x34>
movl   $0x8c,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fle>:
ucomiss %xmm0,%xmm1
mov    $0x8c,%ecx
mov    $0xd,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fle(float %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = load float, float* %5
%8 = fcmp ole float %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 13, i32* %3
br label %11
10: ; preds = %2
store i32 140, i32* %3
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @fle(float %0, float %1) {
%3 = fcmp ugt float %0, %1
%4 = select i1 %3, i32 140, i32 13
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ n;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, unsigned int *, int);
unsigned int get_dev_random() {
  int fd;
  unsigned int n = 0;
  fd = open("/dev/random", O_RDONLY);
  if (fd > 0) {
    read(fd, &n, sizeof(n));
  }
  close(fd);
  return n;
}


x86 assembly (clang, -O0):
<get_dev_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
call   1050 <open@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1172 <get_dev_random+0x42>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1040 <read@plt>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_dev_random>:
push   %rbp
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%esi
lea    0xeb5(%rip),%rdi
call   1050 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    116d <get_dev_random+0x3d>
lea    0x4(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1040 <read@plt>
mov    0x4(%rsp),%ebp
jmp    116f <get_dev_random+0x3f>
xor    %ebp,%ebp
mov    %ebx,%edi
call   1030 <close@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"/dev/random\00"
@O_RDONLY = global i32 0
define i32 @get_dev_random() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
%3 = load i32, i32* @O_RDONLY
%4 = call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* %1
%9 = call i32 @read(i32 %8, i32* %2, i32 4)
br label %10
10: ; preds = %7, %0
%11 = load i32, i32* %1
%12 = call i32 @close(i32 %11)
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [12 x i8] c"/dev/random\00"
@O_RDONLY = global i32 0
define i32 @get_dev_random() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @read(i32 %4, i32* %1, i32 4)
%8 = load i32, i32* %1
br label %9
9: ; preds = %6, %0
%10 = phi i32 [ %8, %6 ], [ 0, %0 ]
%11 = tail call i32 @close(i32 %4)
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_109() {
  Assert_real((isqrt(109) == 10),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              550, ("Integer square root of 109 should be 10"));
}


x86 assembly (clang, -O0):
<t_sqrt_109>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6d,%edi
call   1030 <isqrt@plt>
cmp    $0xa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x226,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_109>:
push   %rax
mov    $0x6d,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x226,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 109 should be 10\00"
define void @t_sqrt_109() {
%1 = call i32 @isqrt(i32 109)
%2 = icmp eq i32 %1, 10
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 550, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 109 should be 10\00"
define void @t_sqrt_109() {
%1 = tail call i32 @isqrt(i32 109)
%2 = icmp eq i32 %1, 10
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 550, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned int get_number_of_partitions(int clusters) {
  unsigned int min = clusters * 20;
  return min;
}


x86 assembly (clang, -O0):
<get_number_of_partitions>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x14,-0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_number_of_partitions>:
shl    $0x2,%edi
lea    (%rdi,%rdi,4),%eax
ret

LLVM IR (-O0):
define i32 @get_number_of_partitions(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %4, 20
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @get_number_of_partitions(i32 %0) {
%2 = mul nsw i32 %0, 20
ret i32 %2
}
int find(int *p, int lgt, int xt) {
  int i;
  for (i = 0; i < lgt; i++) {
    if ((*(p + i)) == xt)
      return i + 1;
  }
  return -1;
}


x86 assembly (clang, -O0):
<find>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1156 <find+0x56>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1143 <find+0x43>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115d <find+0x5d>
jmp    1148 <find+0x48>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <find+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find>:
mov    $0xffffffff,%eax
test   %esi,%esi
jle    111e <find+0x1e>
mov    %esi,%esi
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edx,(%rdi,%rcx,4)
je     111f <find+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1110 <find+0x10>
ret
add    $0x1,%ecx
mov    %ecx,%eax
ret

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

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


x86 assembly (clang, -O0):
<do_295>:
push   %rbp
mov    %rsp,%rbp
mov    $0x127,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @do_295() {
ret i32 295
}

LLVM IR (-O2):
define i32 @do_295() {
ret i32 295
}
/* Variables and functions */
int StatCovMomentFloat(float *, float *, int, int, int, int);
double StatCovFloat(float a[], float b[], int n, int s) {
  return StatCovMomentFloat(a, b, n, s, 1, 1) / (n - 1);
}


x86 assembly (clang, -O0):
<StatCovFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    $0x1,%r9d
mov    %r9d,%r8d
call   1030 <StatCovMomentFloat@plt>
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StatCovFloat>:
push   %rbx
mov    %edx,%ebx
mov    $0x1,%r8d
mov    $0x1,%r9d
call   1030 <StatCovMomentFloat@plt>
add    $0xffffffff,%ebx
cltd
idiv   %ebx
cvtsi2sd %eax,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @StatCovFloat(float* %0, float* %1, i32 %2, i32 %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca i32
%8 = alloca i32
store float* %0, float** %5
store float* %1, float** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load float*, float** %5
%10 = load float*, float** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @StatCovMomentFloat(float* %9, float* %10, i32 %11, i32 %12, i32 1, i32 1)
%14 = load i32, i32* %7
%15 = sub nsw i32 %14, 1
%16 = sdiv i32 %13, %15
%17 = sitofp i32 %16 to double
ret double %17
}

LLVM IR (-O2):
define double @StatCovFloat(float* %0, float* %1, i32 %2, i32 %3) {
%5 = tail call i32 @StatCovMomentFloat(float* %0, float* %1, i32 %2, i32 %3, i32 1, i32 1)
%6 = add nsw i32 %2, -1
%7 = sdiv i32 %5, %6
%8 = sitofp i32 %7 to double
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x;
  printf("x = %d\n", x);
  int y = x * 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%esi
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
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 = [8 x i8] c"x = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %1
%6 = mul nsw i32 %5, 2
store i32 %6, i32* %2
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"x = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 undef)
ret i32 0
}
int min__(int a, int b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<min__>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <min__+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <min__+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min__>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @min__(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 = icmp slt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @min__(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
void *dlsym() { return 0; }


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

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

LLVM IR (-O0):
define i8* @dlsym() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @dlsym() {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strup(char *);
int main() {
  char string[256];
  int x;
  printf("Enter a string (max 256 chars): ");
  scanf("%s", string);
  strup(string);
  printf("\n%s\n", string);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x100(%rbp),%rsi
lea    0xeca(%rip),%rdi
call   1050 <scanf@plt>
lea    -0x100(%rbp),%rdi
call   1040 <strup@plt>
lea    -0x100(%rbp),%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1040 <strup@plt>
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Enter a string (max 256 chars): \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"\0A%s\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%7 = call i32 @strup(i8* %6)
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Enter a string (max 256 chars): \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [5 x i8] c"\0A%s\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @strup(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_error();
int id(int);
void main() {
  int input = 5;
  int result = id(input);
  if (result != 5) {
    __VERIFIER_error();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <id@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     114b <main+0x2b>
mov    $0x0,%al
call   1030 <__VERIFIER_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1040 <id@plt>
cmp    $0x5,%eax
jne    1132 <main+0x12>
pop    %rax
ret
xor    %eax,%eax
pop    %rcx
jmp    1030 <__VERIFIER_error@plt>

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @id(i32 5)
%2 = icmp eq i32 %1, 5
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @__VERIFIER_error()
br label %5
5: ; preds = %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, float);
int /*<<< orphan*/ mstpar(char *, char *, float *);
int /*<<< orphan*/ stderr;
void subr(float *x) {
  float lon;
  mstpar("lon", "f", &lon);
  fprintf(stderr, "*x= %13.5f\n", lon);
  *x = lon;
}


x86 assembly (clang, -O0):
<subr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
lea    0xeca(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <mstpar@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
movss  -0xc(%rbp),%xmm0
lea    0xeae(%rip),%rsi
call   1040 <fprintf@plt>
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subr>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xed1(%rip),%rdi
lea    0xece(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1030 <mstpar@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
movss  0xc(%rsp),%xmm0
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
movss  0xc(%rsp),%xmm0
movss  %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"lon\00"
@.str.1 = [2 x i8] c"f\00"
@stderr = global i32 0
@.str.2 = [12 x i8] c"*x= %13.5f\0A\00"
define void @subr(float* %0) {
%2 = alloca float*
%3 = alloca float
store float* %0, float** %2
%4 = call i32 @mstpar(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), float* %3)
%5 = load i32, i32* @stderr
%6 = load float, float* %3
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), float %6)
%8 = load float, float* %3
%9 = load float*, float** %2
store float %8, float* %9
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"lon\00"
@.str.1 = [2 x i8] c"f\00"
@stderr = global i32 0
@.str.2 = [12 x i8] c"*x= %13.5f\0A\00"
define void @subr(float* nocapture writeonly %0) {
%2 = alloca float
%3 = bitcast float* %2 to i8*
%4 = call i32 @mstpar(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), float* %2)
%5 = load i32, i32* @stderr
%6 = load float, float* %2
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), float %6)
%8 = load float, float* %2
store float %8, float* %0
ret void
}
void multi_lt() {
  register int out0 = 0;
  register int in1 = 1;
  asm("foo %1,%0" : "=r,r"(out0) : "r,<r"(in1));
  asm("foo %1,%0" : "=r,r"(out0) : "r,r<"(in1));
}


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

LLVM IR (-O0):
LLVM IR (-O2):
define void @multi_lt() {
%1 = tail call i32 asm "foo $1,$0", "=r|r,r|<r,~{dirflag},~{fpsr},~{flags}"(i32 1)
%2 = tail call i32 asm "foo $1,$0", "=r|r,r|r<,~{dirflag},~{fpsr},~{flags}"(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func();
int main() {
  func();
  *((int *)0) = 5;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @func()
unreachable
}
void INT_Excep_PERIA_INTA245(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIA_INTA245() {
ret void
}
void caller_1_2_1_1_2_2_2() {}


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

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

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

LLVM IR (-O2):
define void @caller_1_2_1_1_2_2_2() {
ret void
}
int test_imm_E0uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xE0 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_E0uint64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 224
%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_E0uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 224
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void ebur128_get_version(int *major, int *minor, int *patch) {
  *major = 1;
  *minor = 0;
  *patch = 3;
}


x86 assembly (clang, -O0):
<ebur128_get_version>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x3,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ebur128_get_version>:
movl   $0x1,(%rdi)
movl   $0x0,(%rsi)
movl   $0x3,(%rdx)
ret

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

LLVM IR (-O2):
define void @ebur128_get_version(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
store i32 1, i32* %0
store i32 0, i32* %1
store i32 3, i32* %2
ret void
}
/* Type definitions */
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ cin;

/* Variables and functions */
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int server_accept(int server) {
  struct sockaddr_in cin;
  memset(&cin, 0, sizeof(cin));
  socklen_t sin_size = sizeof(cin);
  return accept(server, (struct sockaddr *)&cin, &sin_size);
}


x86 assembly (clang, -O0):
<server_accept>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
movl   $0x4,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <accept@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<server_accept>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
movl   $0x4,0xc(%rsp)
lea    0xc(%rsp),%rdx
mov    %ebx,%edi
mov    %r14,%rsi
call   1040 <accept@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @server_accept(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
store i32 %0, i32* %2
%5 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 4)
store i32 4, i32* %4
%6 = load i32, i32* %2
%7 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%8 = call i32 @accept(i32 %6, %struct.sockaddr* %7, i32* %4)
ret i32 %8
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @server_accept(i32 %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = bitcast %struct.sockaddr_in* %2 to i8*
%5 = call i32 @memset(%struct.sockaddr_in* %2, i32 0, i32 4)
%6 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%7 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%8 = call i32 @accept(i32 %0, %struct.sockaddr* %7, i32* %3)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int help_relay(int argc, char **argv) {
  printf("\n\033[1mrelay [arguments]\033[0m\n"
         "  arguments:\n"
         "    port <port>                  set relay hub port\n"
         "    show                         show the relay rules\n"
         "    add [ip1:]port1 [ip2:]port2  relay the packets between port1 and "
         "port2\n"
         "    del [ip1:]port1 [ip2:]port2  delete the relay rule\n"
         "    del <id>                     delete the relay rule\n");
  return 1;
}


x86 assembly (clang, -O0):
<help_relay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [332 x i8] c"\0A\1B[1mrelay [arguments]\1B[0m\0A arguments:\0A port <port> set relay hub port\0A show show the relay rules\0A add [ip1:]port1 [ip2:]port2 relay the packets between port1 and port2\0A del [ip1:]port1 [ip2:]port2 delete the relay rule\0A del <id> delete the relay rule\0A\00"
define i32 @help_relay(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([332 x i8], [332 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@str = [331 x i8] c"\0A\1B[1mrelay [arguments]\1B[0m\0A arguments:\0A port <port> set relay hub port\0A show show the relay rules\0A add [ip1:]port1 [ip2:]port2 relay the packets between port1 and port2\0A del [ip1:]port1 [ip2:]port2 delete the relay rule\0A del <id> delete the relay rule\00"
define i32 @help_relay(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([331 x i8], [331 x i8]* @str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
int ax2ro(double *, double *, int);
int ho2ax(double *, double *, int);
int ho2ro(double *ho, double *ro, int p) {
  double ax[4];
  int trash;
  trash = ho2ax(ho, ax, p);
  trash = ax2ro(ax, ro, p);
  return 1;
}


x86 assembly (clang, -O0):
<ho2ro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <ho2ax@plt>
mov    %eax,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <ax2ro@plt>
mov    %eax,-0x44(%rbp)
mov    $0x1,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ho2ro>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rsp,%r15
mov    %r15,%rsi
call   1030 <ho2ax@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <ax2ro@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @ho2ro(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
%7 = alloca [4 x double]
%8 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%9 = load double*, double** %4
%10 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 0
%11 = load i32, i32* %6
%12 = call i32 @ho2ax(double* %9, double* %10, i32 %11)
store i32 %12, i32* %8
%13 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 0
%14 = load double*, double** %5
%15 = load i32, i32* %6
%16 = call i32 @ax2ro(double* %13, double* %14, i32 %15)
store i32 %16, i32* %8
ret i32 1
}

LLVM IR (-O2):
define i32 @ho2ro(double* %0, double* %1, i32 %2) {
%4 = alloca [4 x double]
%5 = bitcast [4 x double]* %4 to i8*
%6 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 0
%7 = call i32 @ho2ax(double* %0, double* %6, i32 %2)
%8 = call i32 @ax2ro(double* %6, double* %1, i32 %2)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ l6480_send_cmd(int, int, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
void l6480_cmd_hardhiz(void) {
  l6480_send_cmd(0xA8, 1, 0, 0);
  return;
}


x86 assembly (clang, -O0):
<l6480_cmd_hardhiz>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa8,%edi
mov    $0x1,%esi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <l6480_send_cmd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<l6480_cmd_hardhiz>:
mov    $0xa8,%edi
mov    $0x1,%esi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <l6480_send_cmd@plt>

LLVM IR (-O0):
define void @l6480_cmd_hardhiz() {
%1 = call i32 @l6480_send_cmd(i32 168, i32 1, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @l6480_cmd_hardhiz() {
%1 = tail call i32 @l6480_send_cmd(i32 168, i32 1, i32 0, i32 0)
ret void
}
/* Type definitions */
struct mg_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mg_printf(struct mg_connection *, char *, char const *);
void redirect_to(struct mg_connection *conn, const char *dest) {
  mg_printf(conn,
            "HTTP/1.1 302 Found\r\n"
            "Expires: Thu, 01-Jan-1970 00:00:01 GMT\r\n"
            "Cache: no-cache\r\n"
            "max-age: 0\r\n"
            "s-maxage: 0\r\n"
            "Cache-Control: no-cache, no-store, must-revalidate\r\n"
            "Location: "
            "/"
            "%s\r\n\r\n",
            dest);
}


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

x86 assembly (clang, -O2):
<redirect_to>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <mg_printf@plt>

LLVM IR (-O0):
%struct.mg_connection = type { i32 }
@.str = [172 x i8] c"HTTP/1.1 302 Found\0D\0AExpires: Thu, 01-Jan-1970 00:00:01 GMT\0D\0ACache: no-cache\0D\0Amax-age: 0\0D\0As-maxage: 0\0D\0ACache-Control: no-cache, no-store, must-revalidate\0D\0ALocation: /%s\0D\0A\0D\0A\00"
define void @redirect_to(%struct.mg_connection* %0, i8* %1) {
%3 = alloca %struct.mg_connection*
%4 = alloca i8*
store %struct.mg_connection* %0, %struct.mg_connection** %3
store i8* %1, i8** %4
%5 = load %struct.mg_connection*, %struct.mg_connection** %3
%6 = load i8*, i8** %4
%7 = call i32 @mg_printf(%struct.mg_connection* %5, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
%struct.mg_connection = type { i32 }
@.str = [172 x i8] c"HTTP/1.1 302 Found\0D\0AExpires: Thu, 01-Jan-1970 00:00:01 GMT\0D\0ACache: no-cache\0D\0Amax-age: 0\0D\0As-maxage: 0\0D\0ACache-Control: no-cache, no-store, must-revalidate\0D\0ALocation: /%s\0D\0A\0D\0A\00"
define void @redirect_to(%struct.mg_connection* %0, i8* %1) {
%3 = tail call i32 @mg_printf(%struct.mg_connection* %0, i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int dobro(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d", dobro(4));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <dobro@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @dobro(i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
double log(int);
double rand_uni();
double rand_expo(double lambda) {
  double u;
  do {
    u = rand_uni();
  } while (u == 0);
  return (log(1 - u) / -lambda);
}


x86 assembly (clang, -O0):
<rand_expo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand_uni@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1156 <rand_expo+0x36>
jp     1156 <rand_expo+0x36>
jmp    112d <rand_expo+0xd>
movsd  0xea2(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log@plt>
movsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_expo>:
sub    $0x18,%rsp
movapd %xmm0,(%rsp)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <rand_uni@plt>
ucomisd 0xec9(%rip),%xmm0
jne    1143 <rand_expo+0x23>
jnp    1130 <rand_expo+0x10>
movsd  0xeb5(%rip),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1040 <log@plt>
movapd (%rsp),%xmm1
xorpd  0xeab(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @rand_expo(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
br label %4
4: ; preds = %6, %1
%5 = call double (...) @rand_uni()
store double %5, double* %3
br label %6
6: ; preds = %4
%7 = load double, double* %3
%8 = fcmp oeq double %7, 0.000000e+00
br i1 %8, label %4, label %9
9: ; preds = %6
%10 = load double, double* %3
%11 = fsub double 1.000000e+00, %10
%12 = fptosi double %11 to i32
%13 = call double @log(i32 %12)
%14 = load double, double* %2
%15 = fneg double %14
%16 = fdiv double %13, %15
ret double %16
}

LLVM IR (-O2):
define double @rand_expo(double %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call double (...) @rand_uni()
%4 = fcmp oeq double %3, 0.000000e+00
br i1 %4, label %2, label %5
5: ; preds = %2
%6 = fsub double 1.000000e+00, %3
%7 = fptosi double %6 to i32
%8 = tail call double @log(i32 %7)
%9 = fneg double %0
%10 = fdiv double %8, %9
ret double %10
}
int bar(int i, int j) {
  while (i < j) {
    i = i + 1;
    j = j - 1;
  }
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    112d <bar+0x2d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110a <bar+0xa>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @bar(i32 %0, i32 %1) {
ret i32 undef
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
uint8_t fdsGet_4033(uint16_t addr) {
  (void)addr;
  return 0x80;
}


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

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

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

LLVM IR (-O2):
define i32 @fdsGet_4033(i32 %0) {
ret i32 128
}
/* Variables and functions */
int /*<<< orphan*/ fs_path_op(void *, void *, void *, int);
void file_list(unsigned char *dir, unsigned char *list) {
  ;
  ;
  ;
  fs_path_op((void *)dir, (void *)0, (void *)list, 1);
}


x86 assembly (clang, -O0):
<file_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%esi
mov    $0x1,%ecx
call   1030 <fs_path_op@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_list>:
mov    %rsi,%rdx
xor    %esi,%esi
mov    $0x1,%ecx
jmp    1030 <fs_path_op@plt>

LLVM IR (-O0):
define void @file_list(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @fs_path_op(i8* %5, i8* null, i8* %6, i32 1)
ret void
}

LLVM IR (-O2):
define void @file_list(i8* %0, i8* %1) {
%3 = tail call i32 @fs_path_op(i8* %0, i8* null, i8* %1, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned long);
int /*<<< orphan*/ put8(int);
void test_m32_imm32(void *_m32, unsigned long imm32) {
  unsigned long *m32 = (unsigned long *)_m32;
  put8(0xF7);
  put8(0x05);
  put32((unsigned int)m32);
  put32(imm32);
}


x86 assembly (clang, -O0):
<test_m32_imm32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0xf7,%edi
call   1030 <put8@plt>
mov    $0x5,%edi
call   1030 <put8@plt>
mov    -0x18(%rbp),%rax
mov    %eax,%eax
mov    %eax,%edi
call   1040 <put32@plt>
mov    -0x10(%rbp),%rdi
call   1040 <put32@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_m32_imm32>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0xf7,%edi
call   1030 <put8@plt>
mov    $0x5,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
call   1040 <put32@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @test_m32_imm32(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i64*
store i64* %7, i64** %5
%8 = call i32 @put8(i32 247)
%9 = call i32 @put8(i32 5)
%10 = load i64*, i64** %5
%11 = ptrtoint i64* %10 to i32
%12 = zext i32 %11 to i64
%13 = call i32 @put32(i64 %12)
%14 = load i64, i64* %4
%15 = call i32 @put32(i64 %14)
ret void
}

LLVM IR (-O2):
define void @test_m32_imm32(i8* %0, i64 %1) {
%3 = tail call i32 @put8(i32 247)
%4 = tail call i32 @put8(i32 5)
%5 = ptrtoint i8* %0 to i64
%6 = and i64 %5, 4294967295
%7 = tail call i32 @put32(i64 %6)
%8 = tail call i32 @put32(i64 %1)
ret void
}
int neil(long a, long b) { return -(a != b); }


x86 assembly (clang, -O0):
<neil>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<neil>:
xor    %eax,%eax
cmp    %rsi,%rdi
setne  %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @neil(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ne i64 %5, %6
%8 = zext i1 %7 to i32
%9 = sub nsw i32 0, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @neil(i64 %0, i64 %1) {
%3 = icmp ne i64 %0, %1
%4 = sext i1 %3 to i32
ret i32 %4
}
double Km2Nm(const double valueKmh) { return valueKmh / 1.852; }


x86 assembly (clang, -O0):
<Km2Nm>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Km2Nm>:
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @Km2Nm(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 1.852000e+00
ret double %4
}

LLVM IR (-O2):
define double @Km2Nm(double %0) {
%2 = fdiv double %0, 1.852000e+00
ret double %2
}
void plugin_cleanup(void) { return; }


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

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

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

LLVM IR (-O2):
define void @plugin_cleanup() {
ret void
}
int test_imm_5Fuint16_reg(unsigned short val) {
  return ((val) & (-0x5F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_5Fuint16_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, -95
%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_5Fuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -95
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ error(int, char *);
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *safe_alloc(size_t count) {
  void *ptr = malloc(count);
  if (!ptr)
    error(2, "Failed to allocate memory");
  memset(ptr, 0, count);
  return ptr;
}


x86 assembly (clang, -O0):
<safe_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1165 <safe_alloc+0x35>
mov    $0x2,%edi
lea    0xea0(%rip),%rsi
call   1050 <error@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_alloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1155 <safe_alloc+0x25>
lea    0xeb5(%rip),%rsi
mov    $0x2,%edi
call   1050 <error@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Failed to allocate memory\00"
define i8* @safe_alloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @error(i32 2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
%12 = load i64, i64* %2
%13 = call i32 @memset(i8* %11, i32 0, i64 %12)
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [26 x i8] c"Failed to allocate memory\00"
define i8* @safe_alloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i32 2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int /*<<< orphan*/ printf(char *);
void foo() {
  printf("foo");
  bar();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <bar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <bar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
define void @foo() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @bar()
ret void
}