xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ power_1(double *, double *, double const *);
void softshell_value(const double r, const double *p, double *f) {
  double x = p[0] / r;
  power_1(f, &x, &p[1]);
}


x86 assembly (clang, -O0):
<softshell_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
add    $0x8,%rdx
lea    -0x20(%rbp),%rsi
call   1030 <power_1@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softshell_value>:
push   %rax
mov    %rsi,%rax
movsd  (%rdi),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
lea    0x8(%rdi),%rdx
mov    %rsp,%rsi
mov    %rax,%rdi
call   1030 <power_1@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @softshell_value(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = bitcast double* %4 to i8*
%6 = load double, double* %1
%7 = fdiv double %6, %0
store double %7, double* %4
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = call i32 @power_1(double* %2, double* %4, double* %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Permuta(int *, int, int /*<<< orphan*/);
void ListP(int n[], int num) { Permuta(n, num, 0); }


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

x86 assembly (clang, -O2):
<ListP>:
xor    %edx,%edx
jmp    1030 <Permuta@plt>

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

LLVM IR (-O2):
define void @ListP(i32* %0, i32 %1) {
%3 = tail call i32 @Permuta(i32* %0, i32 %1, i32 0)
ret void
}
int test_imm_A9uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xA9 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A9uint64_highword_mem>:
testb  $0xa9,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A9uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 725849473024
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void uDMAControlBaseSet(void *pControlTable) {

  ;
  ;
  (*((volatile unsigned long *)(0x400FF000 + 0x00000008))) =
      (unsigned long)pControlTable;
}


x86 assembly (clang, -O0):
<uDMAControlBaseSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x400ff008,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDMAControlBaseSet>:
mov    %rdi,0x400ff008
40
ret

LLVM IR (-O0):
define void @uDMAControlBaseSet(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
store volatile i64 %4, i64* inttoptr (i64 1074786312 to i64*)
ret void
}

LLVM IR (-O2):
define void @uDMAControlBaseSet(i8* %0) {
%2 = ptrtoint i8* %0 to i64
store volatile i64 %2, i64* inttoptr (i64 1074786312 to i64*)
ret void
}
int icmp(const void *p1, const void *p2) {
  int i1 = *((int *)p1);
  int i2 = *((int *)p2);
  if (i1 < i2) {
    return -1;
  } else if (i1 > i2) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<icmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1136 <icmp+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <icmp+0x5a>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    114e <icmp+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    115a <icmp+0x5a>
jmp    1153 <icmp+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<icmp>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @icmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp slt i32 %4, %6
%8 = icmp sgt i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
unsigned long gf2_matrix_times(unsigned long *mat, unsigned long vec) {
  unsigned long sum;
  sum = (unsigned long)0;
  while (vec) {
    if (vec & (unsigned long)1)
      sum ^= *mat;
    vec >>= 1;
    mat++;
  }
  return sum;
}


x86 assembly (clang, -O0):
<gf2_matrix_times>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115d <gf2_matrix_times+0x5d>
mov    -0x10(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
je     1140 <gf2_matrix_times+0x40>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
xor    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <gf2_matrix_times+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf2_matrix_times>:
xor    %eax,%eax
test   %rsi,%rsi
jne    1123 <gf2_matrix_times+0x23>
ret
nopl   0x0(%rax,%rax,1)
mov    %rsi,%rcx
shr    %rcx
add    $0x8,%rdi
cmp    $0x1,%rsi
mov    %rcx,%rsi
jbe    1107 <gf2_matrix_times+0x7>
test   $0x1,%sil
je     1110 <gf2_matrix_times+0x10>
xor    (%rdi),%rax
jmp    1110 <gf2_matrix_times+0x10>

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

LLVM IR (-O2):
define i64 @gf2_matrix_times(i64* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %18, label %4
4: ; preds = %2, %13
%5 = phi i64 [ %14, %13 ], [ 0, %2 ]
%6 = phi i64 [ %15, %13 ], [ %1, %2 ]
%7 = phi i64* [ %16, %13 ], [ %0, %2 ]
%8 = and i64 %6, 1
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %4
%11 = load i64, i64* %7
%12 = xor i64 %11, %5
br label %13
13: ; preds = %10, %4
%14 = phi i64 [ %12, %10 ], [ %5, %4 ]
%15 = lshr i64 %6, 1
%16 = getelementptr inbounds i64, i64* %7, i64 1
%17 = icmp ult i64 %6, 2
br i1 %17, label %18, label %4
18: ; preds = %13, %2
%19 = phi i64 [ 0, %2 ], [ %14, %13 ]
ret i64 %19
}
/* Variables and functions */
int /*<<< orphan*/ init_table();
int /*<<< orphan*/ yyparse();
int main() {
  init_table();
  yyparse();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @init_table()
%2 = tail call i32 (...) @yyparse()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) { printf("Usage: prime_finder [N]\n"); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"Usage: prime_finder [N]\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"Usage: prime_finder [N]\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
__attribute__((always_)) void write64(volatile void *addr, uint64_t value) {
  *((volatile uint64_t *)(addr)) = value;
}


x86 assembly (clang, -O0):
<write64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write64>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @write64(i8* %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store volatile i32 %1, i32* %3
ret void
}
unsigned short inw(unsigned short _port) {
  unsigned short ret;
  asm volatile("inw %1, %0" : "=a"(ret) : "dN"(_port));
  return ret;
}


x86 assembly (clang, -O0):
<inw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw>:
mov    %edi,%edx
in     (%dx),%ax
ret

LLVM IR (-O0):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i16 asm sideeffect "inw $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = tail call i16 asm sideeffect "inw $1, $0", "={ax},{dx}N,~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i16 %2
}
/* Variables and functions */
float chartofloat(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char const *argv[]) {
  char b[4] = {0x29, 0x5c, 0xef, 0x3f};
  float a = chartofloat(b);
  printf("%f\n", a);
  printf("%s\n", b + 4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec4(%rip),%eax
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1040 <chartofloat@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    -0x14(%rbp),%rsi
add    $0x4,%rsi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x3fef5c29,0x4(%rsp)
3f
lea    0x4(%rsp),%rdi
call   1050 <chartofloat@plt>
cvtss2sd %xmm0,%xmm0
lea    0xeb2(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0x8(%rsp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.b = [4 x i8] c")\\\EF?"
@.str = [4 x i8] c"%f\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4 x i8]
%7 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [4 x i8]* %6 to i8*
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%10 = call float @chartofloat(i8* %9)
store float %10, float* %7
%11 = load float, float* %7
%12 = fpext float %11 to double
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %12)
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds i8, i8* %14, i64 4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 1072651305, i32* %3
%5 = call float @chartofloat(i8* %4)
%6 = fpext float %5 to double
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %6)
%8 = getelementptr inbounds i32, i32* %3, i64 1
%9 = bitcast i32* %8 to i8*
%10 = call i32 @puts(i8* %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ calcula_target(int *, int *, int *);
int /*<<< orphan*/ dist(int *);
void inky(int pacman[3], int red[3], int target[2]) {
  dist(pacman);
  calcula_target(red, pacman, target);
}


x86 assembly (clang, -O0):
<inky>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <dist@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <calcula_target@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inky>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <dist@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <calcula_target@plt>

LLVM IR (-O0):
define void @inky(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
%8 = call i32 @dist(i32* %7)
%9 = load i32*, i32** %5
%10 = load i32*, i32** %4
%11 = load i32*, i32** %6
%12 = call i32 @calcula_target(i32* %9, i32* %10, i32* %11)
ret void
}

LLVM IR (-O2):
define void @inky(i32* %0, i32* %1, i32* %2) {
%4 = tail call i32 @dist(i32* %0)
%5 = tail call i32 @calcula_target(i32* %1, i32* %0, i32* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ accept_grades();
int main(int argc, char **argv) {
  accept_grades();
  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 <accept_grades@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <accept_grades@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 (...) @accept_grades()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @accept_grades()
ret i32 0
}
int nan_eq_return(double x) {
  volatile double y = x;
  volatile double z = y;
  return y == z;
}


x86 assembly (clang, -O0):
<nan_eq_return>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nan_eq_return>:
movsd  %xmm0,-0x10(%rsp)
movsd  -0x10(%rsp),%xmm0
movsd  %xmm0,-0x8(%rsp)
movsd  -0x10(%rsp),%xmm0
cmpeqsd -0x8(%rsp),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @nan_eq_return(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
store volatile double %5, double* %3
%6 = load volatile double, double* %3
store volatile double %6, double* %4
%7 = load volatile double, double* %3
%8 = load volatile double, double* %4
%9 = fcmp oeq double %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @nan_eq_return(double %0) {
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %2 to i8*
store volatile double %0, double* %2
%5 = bitcast double* %3 to i8*
%6 = load volatile double, double* %2
store volatile double %6, double* %3
%7 = load volatile double, double* %2
%8 = load volatile double, double* %3
%9 = fcmp oeq double %7, %8
%10 = zext i1 %9 to i32
ret i32 %10
}
int SizeDWMov(int x) {
  if (x == 0)
    return 6;
  else if (x < 256)
    return 7;
  else
    return 10;
}


x86 assembly (clang, -O0):
<SizeDWMov>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <SizeDWMov+0x1d>
movl   $0x6,-0x4(%rbp)
jmp    113d <SizeDWMov+0x3d>
cmpl   $0x100,-0x8(%rbp)
jge    1136 <SizeDWMov+0x36>
movl   $0x7,-0x4(%rbp)
jmp    113d <SizeDWMov+0x3d>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SizeDWMov>:
xor    %eax,%eax
cmp    $0x100,%edi
setge  %al
test   %edi,%edi
lea    0x7(%rax,%rax,2),%ecx
mov    $0x6,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @SizeDWMov(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = icmp slt i32 %0, 256
%4 = select i1 %3, i32 7, i32 10
%5 = select i1 %2, i32 6, i32 %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(
      stderr,
      "Usage:  encode [ -f ] pchk-file gen-file source-file encoded-file\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [67 x i8] c"Usage: encode [ -f ] pchk-file gen-file source-file encoded-file\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [67 x i8] c"Usage: encode [ -f ] pchk-file gen-file source-file encoded-file\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ WRITE_REG32(unsigned long, unsigned long);
int DMAL_WriteUInt32(unsigned long phys_addr, unsigned long data) {
  WRITE_REG32(phys_addr, data);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @DMAL_WriteUInt32(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 = call i32 @WRITE_REG32(i64 %5, i64 %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @DMAL_WriteUInt32(i64 %0, i64 %1) {
%3 = tail call i32 @WRITE_REG32(i64 %0, i64 %1)
ret i32 0
}
/* Variables and functions */
int pool_alloc_get_size(int, int);
int pool_size_calc(void) { return pool_alloc_get_size(4, 1) != 20; }


x86 assembly (clang, -O0):
<pool_size_calc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
mov    $0x1,%esi
call   1030 <pool_alloc_get_size@plt>
cmp    $0x14,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pool_size_calc>:
push   %rax
mov    $0x4,%edi
mov    $0x1,%esi
call   1030 <pool_alloc_get_size@plt>
xor    %ecx,%ecx
cmp    $0x14,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @pool_size_calc() {
%1 = call i32 @pool_alloc_get_size(i32 4, i32 1)
%2 = icmp ne i32 %1, 20
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @pool_size_calc() {
%1 = tail call i32 @pool_alloc_get_size(i32 4, i32 1)
%2 = icmp ne i32 %1, 20
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct ThreadQueue {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct ThreadQueue *);
int /*<<< orphan*/ threadqueue_exit(struct ThreadQueue *);
void threadqueue_free(struct ThreadQueue *tq) {
  threadqueue_exit(tq);
  free(tq);
}


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

x86 assembly (clang, -O2):
<threadqueue_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <threadqueue_exit@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.ThreadQueue = type { i32 }
define void @threadqueue_free(%struct.ThreadQueue* %0) {
%2 = alloca %struct.ThreadQueue*
store %struct.ThreadQueue* %0, %struct.ThreadQueue** %2
%3 = load %struct.ThreadQueue*, %struct.ThreadQueue** %2
%4 = call i32 @threadqueue_exit(%struct.ThreadQueue* %3)
%5 = load %struct.ThreadQueue*, %struct.ThreadQueue** %2
%6 = call i32 @free(%struct.ThreadQueue* %5)
ret void
}

LLVM IR (-O2):
%struct.ThreadQueue = type { i32 }
define void @threadqueue_free(%struct.ThreadQueue* %0) {
%2 = tail call i32 @threadqueue_exit(%struct.ThreadQueue* %0)
%3 = tail call i32 @free(%struct.ThreadQueue* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
void output(char *pbase, int n, int s) {
  int i;
  for (i = 0; i < n; i++) {
    printf("%d. %s\n", i, pbase);
    pbase += s;
  }
}


x86 assembly (clang, -O0):
<output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1167 <output+0x57>
mov    -0x14(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <output+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %esi,%esi
jle    1148 <output+0x38>
mov    %esi,%r14d
mov    %rdi,%rbx
movslq %edx,%r12
xor    %ebp,%ebp
lea    0xed2(%rip),%r15
xchg   %ax,%ax
mov    %r15,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
add    %r12,%rbx
add    $0x1,%ebp
cmp    %ebp,%r14d
jne    1130 <output+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d. %s\0A\00"
define void @output(i8* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = sext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i32 [ 0, %5 ], [ %12, %7 ]
%9 = phi i8* [ %0, %5 ], [ %11, %7 ]
%10 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %8, i8* %9)
%11 = getelementptr inbounds i8, i8* %9, i64 %6
%12 = add nuw nsw i32 %8, 1
%13 = icmp eq i32 %12, %1
br i1 %13, label %14, label %7
14: ; preds = %7, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void free_cb(const void *data, size_t datalen __attribute__((unused)),
             void *extra __attribute__((unused))) {
  free((void *)(intptr_t)data);
}


x86 assembly (clang, -O0):
<free_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_cb>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_cb(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i64
%9 = inttoptr i64 %8 to i8*
%10 = call i32 @free(i8* %9)
ret void
}

LLVM IR (-O2):
define void @free_cb(i8* nocapture %0, i64 %1, i8* nocapture readnone %2) {
%4 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
size_t strlen(const char *str) {
  size_t answer = 0;
  while (*str) {
    ++answer;
    ++str;
  }
  return answer;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113a <strlen+0x3a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add i64 %5, 1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %7, %4 ]
ret i64 %12
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int hashword(int *, int, int /*<<< orphan*/);
int getBroadcastChannelIndex(uint16_t slotNumber, uint16_t broadcastSchedID,
                             int nChannels) {
  uint16_t channelNumber;
  uint32_t x[3];
  x[0] = (uint32_t)slotNumber;
  x[1] = broadcastSchedID << 16;
  x[2] = 0;
  channelNumber = hashword(x, 3, 0) % nChannels;
  return (channelNumber);
}


x86 assembly (clang, -O0):
<getBroadcastChannelIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x10,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x1c(%rbp),%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1030 <hashword@plt>
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getBroadcastChannelIndex>:
push   %rbx
sub    $0x10,%rsp
mov    %edx,%ebx
mov    %edi,0x4(%rsp)
shl    $0x10,%esi
mov    %esi,0x8(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x3,%esi
xor    %edx,%edx
call   1030 <hashword@plt>
cltd
idiv   %ebx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getBroadcastChannelIndex(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [3 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = shl i32 %11, 16
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 1
store i32 %12, i32* %13
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 2
store i32 0, i32* %14
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %8, i64 0, i64 0
%16 = call i32 @hashword(i32* %15, i32 3, i32 0)
%17 = load i32, i32* %6
%18 = srem i32 %16, %17
store i32 %18, i32* %7
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
define i32 @getBroadcastChannelIndex(i32 %0, i32 %1, i32 %2) {
%4 = alloca [3 x i32]
%5 = bitcast [3 x i32]* %4 to i8*
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 0
store i32 %0, i32* %6
%7 = shl i32 %1, 16
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 1
store i32 %7, i32* %8
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %4, i64 0, i64 2
store i32 0, i32* %9
%10 = call i32 @hashword(i32* %6, i32 3, i32 0)
%11 = srem i32 %10, %2
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ win_to_utf8(char *, char *);
void fromwin(char *str) {
  char buf[255 * 2];
  win_to_utf8(str, buf);
  strcpy(str, buf);
}


x86 assembly (clang, -O0):
<fromwin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1040 <win_to_utf8@plt>
mov    -0x8(%rbp),%rdi
lea    -0x210(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fromwin>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rsi
call   1040 <win_to_utf8@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @fromwin(i8* %0) {
%2 = alloca i8*
%3 = alloca [510 x i8]
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds [510 x i8], [510 x i8]* %3, i64 0, i64 0
%6 = call i32 @win_to_utf8(i8* %4, i8* %5)
%7 = load i8*, i8** %2
%8 = getelementptr inbounds [510 x i8], [510 x i8]* %3, i64 0, i64 0
%9 = call i32 @strcpy(i8* %7, i8* %8)
ret void
}

LLVM IR (-O2):
define void @fromwin(i8* %0) {
%2 = alloca [510 x i8]
%3 = getelementptr inbounds [510 x i8], [510 x i8]* %2, i64 0, i64 0
%4 = call i32 @win_to_utf8(i8* %0, i8* %3)
%5 = call i32 @strcpy(i8* %0, i8* %3)
ret void
}
void foo_1_2_1_1_2_2_2_2_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_2_1_1_2_2_2_2_2() {
ret void
}
/* Variables and functions */
void *_kmalloc(unsigned int, int /*<<< orphan*/, int /*<<< orphan*/);
void *kmalloc(unsigned size) { return _kmalloc(size, 0, 0); }


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

x86 assembly (clang, -O2):
<kmalloc>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <_kmalloc@plt>

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

LLVM IR (-O2):
define i8* @kmalloc(i32 %0) {
%2 = tail call i8* @_kmalloc(i32 %0, i32 0, i32 0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ SSL_Warning(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void SSL_Error(char *custom_string) {
  SSL_Warning(custom_string);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<SSL_Error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <SSL_Warning@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<SSL_Error>:
push   %rax
call   1030 <SSL_Warning@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @SSL_Error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @SSL_Warning(i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @SSL_Error(i8* %0) {
%2 = tail call i32 @SSL_Warning(i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
double get_centroid(double xp, double xm, int dim) { return 0.5 * (xp + xm); }


x86 assembly (clang, -O0):
<get_centroid>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xedd(%rip),%xmm0
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_centroid>:
addsd  %xmm1,%xmm0
mulsd  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @get_centroid(double %0, double %1, i32 %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i32
store double %0, double* %4
store double %1, double* %5
store i32 %2, i32* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fadd double %7, %8
%10 = fmul double 5.000000e-01, %9
ret double %10
}

LLVM IR (-O2):
define double @get_centroid(double %0, double %1, i32 %2) {
%4 = fadd double %0, %1
%5 = fmul double %4, 5.000000e-01
ret double %5
}
__attribute__((aarch64_vector_pcs)) void f_local_vpcs(void) {}


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

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

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

LLVM IR (-O2):
define void @f_local_vpcs() {
ret void
}
char *Sys_Cwd(void) {
  static char cwd[256];
  char *result = getcwd(cwd, sizeof(cwd) - 1);
  if (result != cwd)
    return ((void *)0);
  cwd[256 - 1] = 0;
  return cwd;
}


x86 assembly (clang, -O0):
<Sys_Cwd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0x2f21(%rip),%rdi
mov    $0xff,%esi
mov    $0x0,%al
call   1030 <getcwd@plt>
cltq
mov    %rax,-0x10(%rbp)
lea    0x2f08(%rip),%rax
cmp    %rax,-0x10(%rbp)
je     114f <Sys_Cwd+0x3f>
movq   $0x0,-0x8(%rbp)
jmp    1161 <Sys_Cwd+0x51>
movb   $0x0,0x2fe9(%rip)
lea    0x2ee3(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sys_Cwd>:
push   %rbx
lea    0x2f28(%rip),%rbx
mov    $0xff,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <getcwd@plt>
cltq
cmp    %rbx,%rax
je     1132 <Sys_Cwd+0x22>
xor    %ebx,%ebx
jmp    1139 <Sys_Cwd+0x29>
movb   $0x0,0x3006(%rip)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@Sys_Cwd.cwd = internal global [256 x i8] zeroinitializer
define i8* @Sys_Cwd() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i32 (i8*, i64, ...) bitcast (i32 (...)* @getcwd to i32 (i8*, i64, ...)*)(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Sys_Cwd.cwd, i64 0, i64 0), i64 255)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = icmp ne i8* %6, getelementptr inbounds ([256 x i8], [256 x i8]* @Sys_Cwd.cwd, i64 0, i64 0)
br i1 %7, label %8, label %9
8: ; preds = %0
store i8* null, i8** %1
br label %10
9: ; preds = %0
store i8 0, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Sys_Cwd.cwd, i64 0, i64 255)
store i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Sys_Cwd.cwd, i64 0, i64 0), i8** %1
br label %10
10: ; preds = %9, %8
%11 = load i8*, i8** %1
ret i8* %11
}

LLVM IR (-O2):
@Sys_Cwd.cwd = internal global [256 x i8] zeroinitializer
define i8* @Sys_Cwd() {
%1 = tail call i32 (i8*, i64, ...) bitcast (i32 (...)* @getcwd to i32 (i8*, i64, ...)*)(i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Sys_Cwd.cwd, i64 0, i64 0), i64 255)
%2 = sext i32 %1 to i64
%3 = inttoptr i64 %2 to i8*
%4 = icmp eq i8* %3, getelementptr inbounds ([256 x i8], [256 x i8]* @Sys_Cwd.cwd, i64 0, i64 0)
br i1 %4, label %5, label %6
5: ; preds = %0
store i8 0, i8* getelementptr inbounds ([256 x i8], [256 x i8]* @Sys_Cwd.cwd, i64 0, i64 255)
br label %6
6: ; preds = %0, %5
%7 = phi i8* [ getelementptr inbounds ([256 x i8], [256 x i8]* @Sys_Cwd.cwd, i64 0, i64 0), %5 ], [ null, %0 ]
ret i8* %7
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *,
                           char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vsnprintf(char *, int, char const *, int /*<<< orphan*/);
void vreportf(const char *prefix, const char *suffix, const char *fmt,
              va_list params) {
  char msg[4096];
  vsnprintf(msg, sizeof(msg), fmt, params);
  fprintf(stderr, "%s%s%s\n", prefix, msg, suffix);
}


x86 assembly (clang, -O0):
<vreportf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    -0x1020(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x1000,%esi
call   1030 <vsnprintf@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    -0x1020(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe8f(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vreportf>:
push   %r15
push   %r14
push   %rbx
sub    $0x1000,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x1000,%esi
call   1030 <vsnprintf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1040 <fprintf@plt>
add    $0x1000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%s%s%s\0A\00"
define void @vreportf(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [4096 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @vsnprintf(i8* %10, i32 4096, i8* %11, i32 %12)
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %5
%16 = getelementptr inbounds [4096 x i8], [4096 x i8]* %9, i64 0, i64 0
%17 = load i8*, i8** %6
%18 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16, i8* %17)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s%s%s\0A\00"
define void @vreportf(i8* %0, i8* %1, i8* nocapture %2, i32 %3) {
%5 = alloca [4096 x i8]
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%7 = call i32 @vsnprintf(i8* %6, i32 4096, i8* %2, i32 %3)
%8 = load i32, i32* @stderr
%9 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %6, i8* %1)
ret void
}
unsigned int gcc_current_sp(void) {
  register unsigned sp __asm("sp");
  return sp;
}


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

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

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

LLVM IR (-O2):
define i32 @gcc_current_sp() {
ret i32 undef
}
void revstr(char *c, int length) {
  char temp;
  if (length == 1 || length == 0)
    return;
  temp = c[0];
  c[0] = c[length - 1];
  c[length - 1] = temp;
  revstr(c + 1, length - 2);
}


x86 assembly (clang, -O0):
<revstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     1133 <revstr+0x23>
cmpl   $0x0,-0xc(%rbp)
jne    1138 <revstr+0x28>
jmp    117d <revstr+0x6d>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    -0xc(%rbp),%esi
sub    $0x2,%esi
call   1030 <revstr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<revstr>:
cmp    $0x2,%esi
jb     1143 <revstr+0x43>
movslq %esi,%rsi
lea    (%rsi,%rdi,1),%rcx
add    $0xffffffffffffffff,%rcx
add    $0xfffffffffffffffe,%rsi
mov    %rsi,%rdx
nopw   0x0(%rax,%rax,1)
movzbl (%rdi),%r8d
movzbl (%rcx),%eax
mov    %al,(%rdi)
mov    %r8b,(%rcx)
add    $0x1,%rdi
add    $0xffffffffffffffff,%rcx
add    $0xfffffffffffffffe,%rdx
test   $0xfffffffe,%esi
mov    %rdx,%rsi
jne    1120 <revstr+0x20>
ret

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

LLVM IR (-O2):
define void @revstr(i8* nocapture %0, i32 %1) {
%3 = icmp ult i32 %1, 2
br i1 %3, label %17, label %4
4: ; preds = %2
%5 = sext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ %5, %4 ], [ %14, %6 ]
%8 = phi i8* [ %0, %4 ], [ %13, %6 ]
%9 = load i8, i8* %8
%10 = add nsw i64 %7, -1
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
store i8 %12, i8* %8
store i8 %9, i8* %11
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = add nsw i64 %7, -2
%15 = and i64 %14, 4294967294
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %6
17: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void bconffree(void *ptr) { free((char *)ptr); }


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

x86 assembly (clang, -O2):
<bconffree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @bconffree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int char_to_int(char ch) { return ch - '0'; }


x86 assembly (clang, -O0):
<char_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_to_int>:
lea    -0x30(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @char_to_int(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 48
ret i32 %5
}

LLVM IR (-O2):
define i32 @char_to_int(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
ret i32 %3
}
int clk_7x30_init(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @clk_7x30_init() {
ret i32 0
}

LLVM IR (-O2):
define i32 @clk_7x30_init() {
ret i32 0
}