xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ floor(float);
int Remainder(int X, int Y) {
  return X - (Y * (int)floor(((float)X) / ((float)Y)));
}


x86 assembly (clang, -O0):
<Remainder>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
call   1030 <floor@plt>
mov    -0x10(%rbp),%ecx
mov    %rax,%rdx
mov    -0xc(%rbp),%eax
imul   %edx,%ecx
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Remainder>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
cvtsi2ss %edi,%xmm0
cvtsi2ss %esi,%xmm1
divss  %xmm1,%xmm0
call   1030 <floor@plt>
imul   %ebx,%eax
sub    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Remainder(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 = load i32, i32* %3
%8 = sitofp i32 %7 to float
%9 = load i32, i32* %4
%10 = sitofp i32 %9 to float
%11 = fdiv float %8, %10
%12 = call i64 @floor(float %11)
%13 = trunc i64 %12 to i32
%14 = mul nsw i32 %6, %13
%15 = sub nsw i32 %5, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @Remainder(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to float
%4 = sitofp i32 %1 to float
%5 = fdiv float %3, %4
%6 = tail call i64 @floor(float %5)
%7 = trunc i64 %6 to i32
%8 = mul nsw i32 %7, %1
%9 = sub nsw i32 %0, %8
ret i32 %9
}
void gtk_container_check_resize() {}


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

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

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

LLVM IR (-O2):
define void @gtk_container_check_resize() {
ret void
}
long pagesize(void) {
  static long retval = 0;
  if (retval)
    return retval;
  retval = 4096;
  return retval;
}


x86 assembly (clang, -O0):
<pagesize>:
push   %rbp
mov    %rsp,%rbp
cmpq   $0x0,0x2f1c(%rip)
je     1122 <pagesize+0x22>
mov    0x2f0f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1138 <pagesize+0x38>
movq   $0x1000,0x2efb(%rip)
mov    0x2ef4(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pagesize>:
cmpb   $0x0,0x2f21(%rip)
jne    1110 <pagesize+0x10>
movb   $0x1,0x2f18(%rip)
mov    $0x1000,%eax
ret

LLVM IR (-O0):
@pagesize.retval = internal global i64 0
define i64 @pagesize() {
%1 = alloca i64
%2 = load i64, i64* @pagesize.retval
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = load i64, i64* @pagesize.retval
store i64 %5, i64* %1
br label %8
6: ; preds = %0
store i64 4096, i64* @pagesize.retval
%7 = load i64, i64* @pagesize.retval
store i64 %7, i64* %1
br label %8
8: ; preds = %6, %4
%9 = load i64, i64* %1
ret i64 %9
}

LLVM IR (-O2):
@pagesize.retval = internal unnamed_addr global i1 false
define i64 @pagesize() {
%1 = load i1, i1* @pagesize.retval
br i1 %1, label %3, label %2
2: ; preds = %0
store i1 true, i1* @pagesize.retval
br label %3
3: ; preds = %0, %2
ret i64 4096
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void nb_put_char(char ch) { putchar(ch); }


x86 assembly (clang, -O0):
<nb_put_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nb_put_char>:
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @nb_put_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @putchar(i8 signext %3)
ret void
}

LLVM IR (-O2):
define void @nb_put_char(i8 signext %0) {
%2 = tail call i32 @putchar(i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glNormal3bv(char *);
void Normal3bv(signed char v[3]) { glNormal3bv(v); }


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

x86 assembly (clang, -O2):
<Normal3bv>:
jmp    1030 <glNormal3bv@plt>

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

LLVM IR (-O2):
define void @Normal3bv(i8* %0) {
%2 = tail call i32 @glNormal3bv(i8* %0)
ret void
}
float fscalar(float a, float b) {
  float result = ((a + b) / (a - b)) * (a * b) / (a / b);
  return result;
}


x86 assembly (clang, -O0):
<fscalar>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
subss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  -0x4(%rbp),%xmm1
divss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fscalar>:
movaps %xmm0,%xmm2
addss  %xmm1,%xmm2
movaps %xmm0,%xmm3
subss  %xmm1,%xmm3
unpcklps %xmm0,%xmm2
mulss  %xmm1,%xmm0
unpcklps %xmm1,%xmm3
divps  %xmm3,%xmm2
mulss  %xmm2,%xmm0
shufps $0x55,%xmm2,%xmm2
divss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @fscalar(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = load float, float* %4
%8 = fadd float %6, %7
%9 = load float, float* %3
%10 = load float, float* %4
%11 = fsub float %9, %10
%12 = fdiv float %8, %11
%13 = load float, float* %3
%14 = load float, float* %4
%15 = fmul float %13, %14
%16 = fmul float %12, %15
%17 = load float, float* %3
%18 = load float, float* %4
%19 = fdiv float %17, %18
%20 = fdiv float %16, %19
store float %20, float* %5
%21 = load float, float* %5
ret float %21
}

LLVM IR (-O2):
define float @fscalar(float %0, float %1) {
%3 = fadd float %0, %1
%4 = fsub float %0, %1
%5 = fmul float %0, %1
%6 = insertelement <2 x float> poison, float %0, i64 1
%7 = insertelement <2 x float> %6, float %3, i64 0
%8 = insertelement <2 x float> poison, float %1, i64 1
%9 = insertelement <2 x float> %8, float %4, i64 0
%10 = fdiv <2 x float> %7, %9
%11 = extractelement <2 x float> %10, i64 0
%12 = fmul float %5, %11
%13 = extractelement <2 x float> %10, i64 1
%14 = fdiv float %12, %13
ret float %14
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isupper(int);
void t_isupper_0xa6() {
  Assert_real((isupper(166) == 0),
              "/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/ctype/test_isupper.c",
              835, ("isupper should be 0 for 0xa6"));
}


x86 assembly (clang, -O0):
<t_isupper_0xa6>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa6,%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x343,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isupper_0xa6>:
push   %rax
mov    $0xa6,%edi
call   1030 <isupper@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x343,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 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/ctype/test_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0xa6\00"
define void @t_isupper_0xa6() {
%1 = call i64 @isupper(i32 166)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 835, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 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/ctype/test_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0xa6\00"
define void @t_isupper_0xa6() {
%1 = tail call i64 @isupper(i32 166)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 835, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Este es mi lugar !!!");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"Este es mi lugar !!!\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Este es mi lugar !!!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0xe7() {
  Assert_real((isspace(231) == 0),
              "/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/ctype/test_isspace.c",
              1160, ("isspace should be 0 for 0xe7"));
}


x86 assembly (clang, -O0):
<t_isspace_0xe7>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe7,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x488,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isspace_0xe7>:
push   %rax
mov    $0xe7,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x488,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 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/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0xe7\00"
define void @t_isspace_0xe7() {
%1 = call i64 @isspace(i32 231)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1160, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 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/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0xe7\00"
define void @t_isspace_0xe7() {
%1 = tail call i64 @isspace(i32 231)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1160, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
extern int GetScreenBpp() {
  int retval;
  asm("int $0x40" : "=a"(retval) : "a"(61), "b"(2));
  return retval;
}


x86 assembly (clang, -O0):
<GetScreenBpp>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    $0x3d,%eax
mov    $0x2,%ebx
int    $0x40
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetScreenBpp>:
push   %rbx
mov    $0x3d,%eax
mov    $0x2,%ebx
int    $0x40
pop    %rbx
ret

LLVM IR (-O0):
define i32 @GetScreenBpp() {
%1 = alloca i32
%2 = call i32 asm "int $$0x40", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 61, i32 2)
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @GetScreenBpp() {
%1 = tail call i32 asm "int $$0x40", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 61, i32 2)
ret i32 %1
}
/* Variables and functions */
scalar_t__ isspace(int);
bool blank_string(char *s) {
  while (isspace((int)*s))
    s++;
  return *s == '\0';
}


x86 assembly (clang, -O0):
<blank_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1143 <blank_string+0x33>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <blank_string+0xc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blank_string>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx),%edi
call   1030 <isspace@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1120 <blank_string+0x10>
xor    %eax,%eax
cmpb   $0x0,-0x1(%rbx)
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @blank_string(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %9, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = call i64 @isspace(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
br label %3
12: ; preds = %3
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @blank_string(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %8, %2 ]
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = tail call i64 @isspace(i32 %5)
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %7, label %9, label %2
9: ; preds = %2
%10 = load i8, i8* %3
%11 = icmp eq i8 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}
void copy_segments(struct task_struct *p, struct mm_struct *mm) {}


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

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

LLVM IR (-O0):
%struct.task_struct = type opaque
%struct.mm_struct = type opaque
define void @copy_segments(%struct.task_struct* %0, %struct.mm_struct* %1) {
%3 = alloca %struct.task_struct*
%4 = alloca %struct.mm_struct*
store %struct.task_struct* %0, %struct.task_struct** %3
store %struct.mm_struct* %1, %struct.mm_struct** %4
ret void
}

LLVM IR (-O2):
%struct.task_struct = type opaque
%struct.mm_struct = type opaque
define void @copy_segments(%struct.task_struct* nocapture %0, %struct.mm_struct* nocapture %1) {
ret void
}
float Maxf(float x, float y) { return x > y ? x : y; }


x86 assembly (clang, -O0):
<Maxf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    112c <Maxf+0x2c>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1136 <Maxf+0x36>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Maxf>:
maxss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @Maxf(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SYS_getpid;
int /*<<< orphan*/ syscall(int /*<<< orphan*/);
pid_t getpid(void) { return syscall(SYS_getpid); }


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

x86 assembly (clang, -O2):
<getpid>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@SYS_getpid = global i32 0
define i32 @getpid() {
%1 = load i32, i32* @SYS_getpid
%2 = call i32 @syscall(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@SYS_getpid = global i32 0
define i32 @getpid() {
%1 = load i32, i32* @SYS_getpid
%2 = tail call i32 @syscall(i32 %1)
ret i32 %2
}
/* Variables and functions */
int open_thread_files(int);
int open_processor_files() {
  int any_processor;
  int any_thread;
  int processor;
  any_processor = 0;
  processor = 1;
  do {
    any_thread = open_thread_files(processor);
    any_processor = any_processor || any_thread;
    processor = processor + 1;
  } while (any_thread);
  return any_processor;
}


x86 assembly (clang, -O0):
<open_processor_files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <open_thread_files@plt>
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0xd(%rbp)
jne    114a <open_processor_files+0x3a>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1126 <open_processor_files+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_processor_files>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <open_thread_files@plt>
or     %eax,%ebp
setne  %cl
add    $0x1,%ebx
mov    $0x0,%ebp
mov    %cl,%bpl
test   %eax,%eax
jne    1120 <open_processor_files+0x10>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @open_processor_files() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
br label %4
4: ; preds = %17, %0
%5 = load i32, i32* %3
%6 = call i32 @open_thread_files(i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %1
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br label %12
12: ; preds = %9, %4
%13 = phi i1 [ true, %4 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
store i32 %14, i32* %1
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %17
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 0
br i1 %19, label %4, label %20
20: ; preds = %17
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
define i32 @open_processor_files() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %8, %1 ]
%3 = phi i32 [ 1, %0 ], [ %9, %1 ]
%4 = tail call i32 @open_thread_files(i32 %3)
%5 = icmp ne i32 %2, 0
%6 = icmp ne i32 %4, 0
%7 = select i1 %5, i1 true, i1 %6
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %3, 1
br i1 %6, label %1, label %10
10: ; preds = %1
ret i32 %8
}
void do_at_tests_callee() {
  int buffer1 = 10;
  int buffer2 = 11;
  int buffer3 = 12;
  int i = 7;
  int buffer4 = 13;
  int buffer5 = 14;
  int buffer6 = 15;
  i++;
  i++;
}


x86 assembly (clang, -O0):
<do_at_tests_callee>:
push   %rbp
mov    %rsp,%rbp
movl   $0xa,-0x4(%rbp)
movl   $0xb,-0x8(%rbp)
movl   $0xc,-0xc(%rbp)
movl   $0x7,-0x10(%rbp)
movl   $0xd,-0x14(%rbp)
movl   $0xe,-0x18(%rbp)
movl   $0xf,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @do_at_tests_callee() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 10, i32* %1
store i32 11, i32* %2
store i32 12, i32* %3
store i32 7, i32* %4
store i32 13, i32* %5
store i32 14, i32* %6
store i32 15, i32* %7
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
ret void
}

LLVM IR (-O2):
define void @do_at_tests_callee() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int main(void) {
  int *space = malloc(100);
  free(space);
  free(space);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 100)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @free(i32* %3)
%5 = load i32*, i32** %1
%6 = call i32 @free(i32* %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 100)
%2 = tail call i32 @free(i32* %1)
%3 = tail call i32 @free(i32* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ help();
int main(int argc, char **argv) {
  help();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @help()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __assert(char const *, char const *, int);
int /*<<< orphan*/ dump_backtrace();
int /*<<< orphan*/ printf(char *);
void assert_with_backtrace(const char *msg, const char *file, int line) {
  printf("Assertion failed!\n");
  dump_backtrace();
  __assert(msg, file, line);
}


x86 assembly (clang, -O0):
<assert_with_backtrace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <dump_backtrace@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <__assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_with_backtrace>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <dump_backtrace@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <__assert@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Assertion failed!\0A\00"
define void @assert_with_backtrace(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @dump_backtrace()
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @__assert(i8* %9, i8* %10, i32 %11)
ret void
}

LLVM IR (-O2):
@str = [18 x i8] c"Assertion failed!\00"
define void @assert_with_backtrace(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (...) @dump_backtrace()
%6 = tail call i32 @__assert(i8* %0, i8* %1, i32 %2)
ret void
}
void atmel_put_base_addr(struct tpm_vendor_specific *vendor) {}


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

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

LLVM IR (-O0):
%struct.tpm_vendor_specific = type opaque
define void @atmel_put_base_addr(%struct.tpm_vendor_specific* %0) {
%2 = alloca %struct.tpm_vendor_specific*
store %struct.tpm_vendor_specific* %0, %struct.tpm_vendor_specific** %2
ret void
}

LLVM IR (-O2):
%struct.tpm_vendor_specific = type opaque
define void @atmel_put_base_addr(%struct.tpm_vendor_specific* nocapture %0) {
ret void
}
void single_open(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<single_open>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<single_open>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.single_open = [12 x i8] c"single_open\00"
define void @single_open() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.single_open, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.single_open = [12 x i8] c"single_open\00"
define void @single_open() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.single_open, i64 0, i64 0))
ret void
}
imm0reg1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{
  if (22 <= r1)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<imm0reg1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movswl -0x8(%rbp),%ecx
mov    $0x16,%eax
cmp    %ecx,%eax
jg     113c <imm0reg1+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1143 <imm0reg1+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imm0reg1>:
xor    %eax,%eax
cmp    $0x16,%si
setge  %al
ret

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

LLVM IR (-O2):
define i32 @imm0reg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture readnone %5) {
%7 = trunc i32 %1 to i16
%8 = icmp sgt i16 %7, 21
%9 = zext i1 %8 to i32
ret i32 %9
}
int fz_mul255(int a, int b) {
  int x = a * b + 128;
  x += x >> 8;
  return x >> 8;
}


x86 assembly (clang, -O0):
<fz_mul255>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
add    $0x80,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fz_mul255>:
imul   %esi,%edi
lea    0x80(%rdi),%eax
sar    $0x8,%eax
add    %edi,%eax
add    $0x80,%eax
sar    $0x8,%eax
ret

LLVM IR (-O0):
define i32 @fz_mul255(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 = mul nsw i32 %6, %7
%9 = add nsw i32 %8, 128
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = ashr i32 %10, 8
%12 = load i32, i32* %5
%13 = add nsw i32 %12, %11
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = ashr i32 %14, 8
ret i32 %15
}

LLVM IR (-O2):
define i32 @fz_mul255(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = add nsw i32 %3, 128
%5 = ashr i32 %4, 8
%6 = add nsw i32 %5, %4
%7 = ashr i32 %6, 8
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int main() {
  const char *world = "World!";
  printf("Hello %s\n", world);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"World!\00"
@.str.1 = [10 x i8] c"Hello %s\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int max(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int a, b;
  printf("Enter two numbers: ");
  scanf("%d %d", &a, &b);
  printf("Max: %d\n", max(a, b));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <max@plt>
mov    %eax,%esi
lea    0xeac(%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    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <max@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Enter two numbers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [9 x i8] c"Max: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 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 @max(i32 %5, i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"Enter two numbers: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [9 x i8] c"Max: %d\0A\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 ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 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 @max(i32 %7, i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 0
}
void SHA1_Update(void) {}


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

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

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

LLVM IR (-O2):
define void @SHA1_Update() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GetInt(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("Usage: getint number\n");
    exit(2);
  }
  printf("Result: %ld\n", GetInt(argv[1]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1168 <main+0x38>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <GetInt@plt>
mov    %eax,%esi
lea    0xe98(%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
cmp    $0x2,%edi
jne    1163 <main+0x23>
mov    0x8(%rsi),%rdi
call   1050 <GetInt@plt>
lea    0xeaa(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Usage: getint number\0A\00"
@.str.1 = [13 x i8] c"Result: %ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 2)
unreachable
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @GetInt(i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"Result: %ld\0A\00"
@str = [21 x i8] c"Usage: getint number\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 2)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @GetInt(i8* %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int randInt(int min, int max) {
  srand((unsigned)time(NULL));
  return min + rand() % (max - min + 1);
}


x86 assembly (clang, -O0):
<randInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randInt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @randInt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i64 @time(i32* null)
%6 = trunc i64 %5 to i32
%7 = call i32 @srand(i32 %6)
%8 = load i32, i32* %3
%9 = call i32 (...) @rand()
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = sub nsw i32 %10, %11
%13 = add nsw i32 %12, 1
%14 = srem i32 %9, %13
%15 = add nsw i32 %8, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @randInt(i32 %0, i32 %1) {
%3 = tail call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32 (...) @rand()
%7 = sub i32 1, %0
%8 = add i32 %7, %1
%9 = srem i32 %6, %8
%10 = add nsw i32 %9, %0
ret i32 %10
}
/* Variables and functions */
scalar_t__ StatSumDouble(double *, int, int);
double StatAvgDouble(double a[], int n, int s) {
  return (double)StatSumDouble(a, n, s) / (double)n;
}


x86 assembly (clang, -O0):
<StatAvgDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <StatSumDouble@plt>
cvtsi2sd %rax,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StatAvgDouble>:
push   %rbx
mov    %esi,%ebx
call   1030 <StatSumDouble@plt>
cvtsi2sd %rax,%xmm0
cvtsi2sd %ebx,%xmm1
divsd  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @StatAvgDouble(double* %0, i32 %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32
store double* %0, double** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i64 @StatSumDouble(double* %7, i32 %8, i32 %9)
%11 = sitofp i64 %10 to double
%12 = load i32, i32* %5
%13 = sitofp i32 %12 to double
%14 = fdiv double %11, %13
ret double %14
}

LLVM IR (-O2):
define double @StatAvgDouble(double* %0, i32 %1, i32 %2) {
%4 = tail call i64 @StatSumDouble(double* %0, i32 %1, i32 %2)
%5 = sitofp i64 %4 to double
%6 = sitofp i32 %1 to double
%7 = fdiv double %5, %6
ret double %7
}
/* Variables and functions */
int strlen(char const *);
char const *strrchr(char const *, char);
int ad_utils_is_directory(const char *path) {
  return (strrchr(path, '/') - path) == (strlen(path) - 1);
}


x86 assembly (clang, -O0):
<ad_utils_is_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1040 <strrchr@plt>
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ad_utils_is_directory>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1040 <strrchr@plt>
mov    %rax,%r14
sub    %rbx,%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
movslq %eax,%rcx
xor    %eax,%eax
cmp    %rcx,%r14
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @ad_utils_is_directory(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @strrchr(i8* %3, i8 signext 47)
%5 = load i8*, i8** %2
%6 = ptrtoint i8* %4 to i64
%7 = ptrtoint i8* %5 to i64
%8 = sub i64 %6, %7
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* %9)
%11 = sub nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = icmp eq i64 %8, %12
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @ad_utils_is_directory(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = ptrtoint i8* %2 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = tail call i32 @strlen(i8* %0)
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = icmp eq i64 %5, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
int fits_bits(int x, int n) {
  int s = ~((1 << (n - 1)) - 1);
  x &= s;
  return !x || x == s;
}


x86 assembly (clang, -O0):
<fits_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
xor    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0xd(%rbp)
je     1144 <fits_bits+0x44>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fits_bits>:
lea    -0x1(%rsi),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
and    %eax,%edi
sete   %cl
cmp    %eax,%edi
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @fits_bits(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* %4
%7 = sub nsw i32 %6, 1
%8 = shl i32 1, %7
%9 = sub nsw i32 %8, 1
%10 = xor i32 %9, -1
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = and i32 %12, %11
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %2
%17 = load i32, i32* %3
%18 = load i32, i32* %5
%19 = icmp eq i32 %17, %18
br label %20
20: ; preds = %16, %2
%21 = phi i1 [ true, %2 ], [ %19, %16 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @fits_bits(i32 %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = shl nsw i32 -1, %3
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, 0
%7 = icmp eq i32 %5, %4
%8 = or i1 %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}
void stop_clocks(void) {}


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

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

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

LLVM IR (-O2):
define void @stop_clocks() {
ret void
}
int sendNotification(const char *title, const char *message, int timeout,
                     int priority, const char *img) {
  title = title;
  message = message;
  timeout = timeout;
  priority = priority;
  img = img;
  return 0;
}


x86 assembly (clang, -O0):
<sendNotification>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @sendNotification(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i32 %3, i8* nocapture readnone %4) {
ret i32 0
}
void foo(unsigned long *start, unsigned long *end) {
  unsigned long *temp = end - 1;
  while (end > start)
    *end-- = *temp--;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffff8,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jbe    114f <foo+0x4f>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xfffffffffffffff8,%rdx
mov    %rdx,-0x10(%rbp)
mov    %rcx,(%rax)
jmp    1118 <foo+0x18>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    %rdi,%rsi
jbe    1123 <foo+0x23>
cs nopw 0x0(%rax,%rax,1)
nop
mov    -0x8(%rsi),%rax
mov    %rax,(%rsi)
lea    -0x8(%rsi),%rax
mov    %rax,%rsi
cmp    %rdi,%rax
ja     1110 <foo+0x10>
ret

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

LLVM IR (-O2):
define void @foo(i64* readnone %0, i64* %1) {
%3 = icmp ugt i64* %1, %0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i64* [ %6, %4 ], [ %1, %2 ]
%6 = getelementptr inbounds i64, i64* %5, i64 -1
%7 = load i64, i64* %6
store i64 %7, i64* %5
%8 = icmp ugt i64* %6, %0
br i1 %8, label %4, label %9
9: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ output(char *, int);
int /*<<< orphan*/ sscanf(char const *, char *, int *);
void printCPUxClockInfo(const char *cmd) {
  int id;
  sscanf(cmd + 7, "%d", &id);
  output("CPU%d Clock Frequency\t0\t0\tMHz\n", id);
}


x86 assembly (clang, -O0):
<printCPUxClockInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x7,%rdi
lea    0xec5(%rip),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <sscanf@plt>
mov    -0xc(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <output@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printCPUxClockInfo>:
push   %rax
add    $0x7,%rdi
lea    0xed4(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1040 <sscanf@plt>
mov    0x4(%rsp),%esi
lea    0xec2(%rip),%rdi
call   1030 <output@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [31 x i8] c"CPU%d Clock Frequency\090\090\09MHz\0A\00"
define void @printCPUxClockInfo(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 7
%6 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = call i32 @output(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [31 x i8] c"CPU%d Clock Frequency\090\090\09MHz\0A\00"
define void @printCPUxClockInfo(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = getelementptr inbounds i8, i8* %0, i64 7
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @output(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern int _num_pes(void) { printf("\nOpenSHMEM Analyzer\n"); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"\0AOpenSHMEM Analyzer\0A\00"
define i32 @_num_pes() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define i32 @_num_pes() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret i32 undef
}