xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ stdout;
void print_integer_in_field(int i, int width) {
  printf("%*d", width, i);
  fflush(stdout);
}


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

x86 assembly (clang, -O2):
<print_integer_in_field>:
push   %rax
mov    %edi,%edx
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
pop    %rax
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%*d\00"
@stdout = global i32 0
define void @print_integer_in_field(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%*d\00"
@stdout = global i32 0
define void @print_integer_in_field(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
ret void
}
int parent_deep(int *formula, int s) {
  int i;
  for (i = s; i > 0; --i)
    if (formula[i] < 0)
      break;
  return i;
}


x86 assembly (clang, -O0):
<parent_deep>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1145 <parent_deep+0x45>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jge    1132 <parent_deep+0x32>
jmp    1145 <parent_deep+0x45>
jmp    1137 <parent_deep+0x37>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1111 <parent_deep+0x11>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent_deep>:
mov    %esi,%eax
test   %esi,%esi
jle    1124 <parent_deep+0x24>
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%ecx
cmpl   $0x0,(%rdi,%rcx,4)
js     1124 <parent_deep+0x24>
lea    -0x1(%rax),%ecx
cmp    $0x1,%eax
mov    %ecx,%eax
jg     1110 <parent_deep+0x10>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @parent_deep(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
store i32 %6, i32* %5
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %5
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %10
br label %22
18: ; preds = %10
br label %19
19: ; preds = %18
%20 = load i32, i32* %5
%21 = add nsw i32 %20, -1
store i32 %21, i32* %5
br label %7
22: ; preds = %17, %7
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
define i32 @parent_deep(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2, %10
%5 = phi i32 [ %11, %10 ], [ %1, %2 ]
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = icmp slt i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %4
%11 = add nsw i32 %5, -1
%12 = icmp sgt i32 %5, 1
br i1 %12, label %4, label %13
13: ; preds = %10, %4, %2
%14 = phi i32 [ %1, %2 ], [ %5, %4 ], [ 0, %10 ]
ret i32 %14
}
int fibo(int n) {
  if (n <= 1)
    return 1;
  else
    return fibo(n - 1) + fibo(n - 2);
}


x86 assembly (clang, -O0):
<fibo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1131 <fibo+0x21>
movl   $0x1,-0x4(%rbp)
jmp    1154 <fibo+0x44>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fibo@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fibo@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibo>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmp    $0x2,%edi
jl     1145 <fibo+0x35>
mov    %edi,%ebx
add    $0x2,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    -0x3(%rbx),%edi
call   1030 <fibo@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
cmp    $0x3,%ebx
ja     1130 <fibo+0x20>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fibo(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fibo(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %4, 4
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i32 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void DriveTeslaModelS(double speed) {
  printf("Driving a Model S with %f km/h\n", speed);
}


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"Driving a Model S with %f km/h\0A\00"
define void @DriveTeslaModelS(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %3)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Driving a Model S with %f km/h\0A\00"
define void @DriveTeslaModelS(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), double %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ swap(int *, int *);
int main() {
  int a = 1, b = 2;
  swap(&a, &b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x1,0x4(%rsp)
movl   $0x2,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <swap@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 2, i32* %2
%5 = call i32 @swap(i32* %1, i32* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ glColor4dv(double *);
void Color4dv(double v[4]) { glColor4dv(v); }


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

x86 assembly (clang, -O2):
<Color4dv>:
jmp    1030 <glColor4dv@plt>

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

LLVM IR (-O2):
define void @Color4dv(double* %0) {
%2 = tail call i32 @glColor4dv(double* %0)
ret void
}
/* Variables and functions */
unsigned long millis();
void delay(unsigned long ms) {
  unsigned long start = millis();
  while (millis() - start < ms) {
  }
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <millis@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <millis@plt>
sub    -0x10(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1141 <delay+0x31>
jmp    1127 <delay+0x17>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <millis@plt>
mov    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <millis@plt>
sub    %rbx,%rax
cmp    %r14,%rax
jb     1130 <delay+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @delay(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = call i64 (...) @millis()
store i64 %4, i64* %3
br label %5
5: ; preds = %11, %1
%6 = call i64 (...) @millis()
%7 = load i64, i64* %3
%8 = sub i64 %6, %7
%9 = load i64, i64* %2
%10 = icmp ult i64 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %5
br label %5
12: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @delay(i64 %0) {
%2 = tail call i64 (...) @millis()
br label %3
3: ; preds = %3, %1
%4 = tail call i64 (...) @millis()
%5 = sub i64 %4, %2
%6 = icmp ult i64 %5, %0
br i1 %6, label %3, label %7
7: ; preds = %3
ret void
}
signed short signedshort_ignoring_unsignedint(signed short x, unsigned int y) {
  return x;
}


x86 assembly (clang, -O0):
<signedshort_ignoring_unsignedint>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @signedshort_ignoring_unsignedint(i16 signext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
store i16 %0, i16* %3
store i32 %1, i32* %4
%5 = load i16, i16* %3
ret i16 %5
}

LLVM IR (-O2):
define signext i16 @signedshort_ignoring_unsignedint(i16 returned signext %0, i32 %1) {
ret i16 %0
}
void parse_section(char *rules_string, int line_begin, char *section_name) {
  for (int i = 0; i < 3; i++) {
    section_name[i] = rules_string[line_begin + 1 + i];
  };
  section_name[3] = '\0';
}


x86 assembly (clang, -O0):
<parse_section>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    114c <parse_section+0x4c>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
add    -0x1c(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1116 <parse_section+0x16>
mov    -0x18(%rbp),%rax
movb   $0x0,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_section>:
lea    0x1(%rsi),%eax
cltq
mov    (%rdi,%rax,1),%al
mov    %al,(%rdx)
lea    0x2(%rsi),%eax
cltq
mov    (%rdi,%rax,1),%al
mov    %al,0x1(%rdx)
add    $0x3,%esi
movslq %esi,%rax
mov    (%rdi,%rax,1),%al
mov    %al,0x2(%rdx)
movb   $0x0,0x3(%rdx)
ret

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

LLVM IR (-O2):
define void @parse_section(i8* nocapture %0, i32 %1, i8* nocapture writeonly %2) {
%4 = add i32 %1, 1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
store i8 %7, i8* %2
%8 = add i32 %1, 2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = getelementptr inbounds i8, i8* %2, i64 1
store i8 %11, i8* %12
%13 = add i32 %1, 3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = load i8, i8* %15
%17 = getelementptr inbounds i8, i8* %2, i64 2
store i8 %16, i8* %17
%18 = getelementptr inbounds i8, i8* %2, i64 3
store i8 0, i8* %18
ret void
}
/* Variables and functions */
int strlen(const char *src) {
  int i = 0;
  while (src[i++] != 0)
    continue;
  return i;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1133 <strlen+0x33>
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmpb   $0x0,(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %4, %2 ], [ 0, %1 ]
%4 = add nuw i64 %3, 1
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %4 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ StabilizationDesiredHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void StabilizationDesiredUpdated() {
  UAVObjUpdated(StabilizationDesiredHandle());
}


x86 assembly (clang, -O0):
<StabilizationDesiredUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <StabilizationDesiredHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<StabilizationDesiredUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <StabilizationDesiredHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @StabilizationDesiredUpdated() {
%1 = call i32 (...) @StabilizationDesiredHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @StabilizationDesiredUpdated() {
%1 = tail call i32 (...) @StabilizationDesiredHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
int clamp(int i) {
  int iRes = i;
  if (i > 255)
    iRes = 255;
  else if (i < 0)
    iRes = 0;
  return iRes;
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xff,-0x4(%rbp)
jle    1126 <clamp+0x26>
movl   $0xff,-0x8(%rbp)
jmp    113c <clamp+0x3c>
cmpl   $0x0,-0x4(%rbp)
jge    1137 <clamp+0x37>
movl   $0x0,-0x8(%rbp)
jmp    113c <clamp+0x3c>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clamp>:
xor    %ecx,%ecx
test   %edi,%edi
cmovns %edi,%ecx
cmp    $0xff,%ecx
mov    $0xff,%eax
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @clamp(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = select i1 %2, i32 %0, i32 0
%4 = icmp ult i32 %3, 255
%5 = select i1 %4, i32 %3, i32 255
ret i32 %5
}
/* Variables and functions */
scalar_t__ errno;
void reset_errno() { errno = 0; }


x86 assembly (clang, -O0):
<reset_errno>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_errno>:
mov    0x2ed9(%rip),%rax
movq   $0x0,(%rax)
ret

LLVM IR (-O0):
@errno = global i64 0
define void @reset_errno() {
store i64 0, i64* @errno
ret void
}

LLVM IR (-O2):
@errno = global i64 0
define void @reset_errno() {
store i64 0, i64* @errno
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_set_construct();
int /*<<< orphan*/ test_set_extend();
int /*<<< orphan*/ test_set_is_full();
int /*<<< orphan*/ test_set_push();
int main() {
  printf("Set module running tests\n");
  test_set_construct();
  test_set_is_full();
  test_set_extend();
  test_set_push();
  printf("Set module all tests pass\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <test_set_construct@plt>
mov    $0x0,%al
call   1060 <test_set_is_full@plt>
mov    $0x0,%al
call   1070 <test_set_extend@plt>
mov    $0x0,%al
call   1030 <test_set_push@plt>
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <test_set_construct@plt>
xor    %eax,%eax
call   1060 <test_set_is_full@plt>
xor    %eax,%eax
call   1070 <test_set_extend@plt>
xor    %eax,%eax
call   1040 <test_set_push@plt>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Set module running tests\0A\00"
@.str.1 = [27 x i8] c"Set module all tests pass\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @test_set_construct()
%4 = call i32 (...) @test_set_is_full()
%5 = call i32 (...) @test_set_extend()
%6 = call i32 (...) @test_set_push()
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [25 x i8] c"Set module running tests\00"
@str.2 = [26 x i8] c"Set module all tests pass\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @test_set_construct()
%3 = tail call i32 (...) @test_set_is_full()
%4 = tail call i32 (...) @test_set_extend()
%5 = tail call i32 (...) @test_set_push()
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
int cmp(const void *x, const void *y) {
  const int *ix = (const int *)x;
  const int *iy = (const int *)y;
  return *ix - *iy;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
void RTDbgSymbolFree(void) {}


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

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

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

LLVM IR (-O2):
define void @RTDbgSymbolFree() {
ret void
}
void test8() { int bob; }


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

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

LLVM IR (-O0):
define void @test8() {
%1 = alloca i32
ret void
}

LLVM IR (-O2):
define void @test8() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
void read_into_array(int a[], int size) {
  int i;
  for (i = 0; i < size; i++) {
    scanf("%d", &a[i]);
  }
}


x86 assembly (clang, -O0):
<read_into_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115b <read_into_array+0x4b>
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeb8(%rip),%rdi
call   1030 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <read_into_array+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_into_array>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1145 <read_into_array+0x35>
mov    %rdi,%rbx
mov    %esi,%r15d
lea    0xeda(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r15
jne    1130 <read_into_array+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @read_into_array(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
uint32_t readInt(FILE *file) {
  uint32_t c1 = (uint32_t)(getc(file));
  uint32_t c2 = (uint32_t)(getc(file) << 8);
  uint32_t c3 = (uint32_t)(getc(file) << 16);
  uint32_t c4 = (uint32_t)(getc(file) << 24);
  return (c1 | c2 | c3 | c4);
}


x86 assembly (clang, -O0):
<readInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
shl    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
shl    $0x10,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
shl    $0x18,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
or     -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readInt>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <getc@plt>
mov    %eax,%r14d
mov    %r15,%rdi
call   1030 <getc@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
mov    %r15,%rdi
call   1030 <getc@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
mov    %r15,%rdi
call   1030 <getc@plt>
shl    $0x18,%eax
or     %ebx,%eax
or     %r14d,%ebp
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @readInt(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %2
%7 = load i32*, i32** %2
%8 = call i32 @getc(i32* %7)
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = call i32 @getc(i32* %9)
%11 = shl i32 %10, 8
store i32 %11, i32* %4
%12 = load i32*, i32** %2
%13 = call i32 @getc(i32* %12)
%14 = shl i32 %13, 16
store i32 %14, i32* %5
%15 = load i32*, i32** %2
%16 = call i32 @getc(i32* %15)
%17 = shl i32 %16, 24
store i32 %17, i32* %6
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = or i32 %18, %19
%21 = load i32, i32* %5
%22 = or i32 %20, %21
%23 = load i32, i32* %6
%24 = or i32 %22, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @readInt(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = tail call i32 @getc(i32* %0)
%4 = shl i32 %3, 8
%5 = tail call i32 @getc(i32* %0)
%6 = shl i32 %5, 16
%7 = tail call i32 @getc(i32* %0)
%8 = shl i32 %7, 24
%9 = or i32 %4, %2
%10 = or i32 %9, %6
%11 = or i32 %10, %8
ret i32 %11
}
int getint(arrayptr, num_cols, row, col)
int *arrayptr;
short num_cols;
short row, col;
{
  int value;
  int position;
  position = row * num_cols + col;
  value = *(arrayptr + position);
  return (value);
}


x86 assembly (clang, -O0):
<getint>:
push   %rbp
mov    %rsp,%rbp
mov    %ecx,%eax
mov    %edx,%ecx
mov    %si,%dx
mov    %rdi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %cx,-0xc(%rbp)
mov    %ax,-0xe(%rbp)
movswl -0xc(%rbp),%eax
movswl -0xa(%rbp),%ecx
imul   %ecx,%eax
movswl -0xe(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getint>:
movswl %dx,%eax
movswl %si,%edx
imul   %eax,%edx
movswl %cx,%eax
add    %edx,%eax
cltq
mov    (%rdi,%rax,4),%eax
ret

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

LLVM IR (-O2):
define i32 @getint(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %2, 16
%6 = ashr exact i32 %5, 16
%7 = shl i32 %1, 16
%8 = ashr exact i32 %7, 16
%9 = mul nsw i32 %6, %8
%10 = shl i32 %3, 16
%11 = ashr exact i32 %10, 16
%12 = add nsw i32 %9, %11
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
ret i32 %15
}
int increment(int *a) { *a = *a + 1; }


x86 assembly (clang, -O0):
<increment>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<increment>:
addl   $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define i32 @increment(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, 1
store i32 %3, i32* %0
ret i32 undef
}
/* Variables and functions */
unsigned char UCHAR_MAX;
unsigned char decToBcd(unsigned char dec) {
  if (dec > 99) {
    return UCHAR_MAX;
  }
  return (((dec / 10) << 4) + (dec % 10));
}


x86 assembly (clang, -O0):
<decToBcd>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movzbl -0x2(%rbp),%eax
cmp    $0x63,%eax
jle    1128 <decToBcd+0x28>
mov    0x2ed2(%rip),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
jmp    114e <decToBcd+0x4e>
movzbl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
movzbl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%eax
add    %edx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decToBcd>:
mov    %edi,%eax
cmp    $0x64,%al
jb     1110 <decToBcd+0x10>
mov    0x2ee3(%rip),%rax
mov    (%rax),%al
ret
movzbl %al,%ecx
imul   $0xcd,%ecx,%ecx
shr    $0xb,%ecx
mov    %ecx,%edx
shl    $0x4,%dl
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
or     %dl,%al
ret

LLVM IR (-O0):
@UCHAR_MAX = global i8 0
define zeroext i8 @decToBcd(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp sgt i32 %5, 99
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i8, i8* @UCHAR_MAX
store i8 %8, i8* %2
br label %19
9: ; preds = %1
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = sdiv i32 %11, 10
%13 = shl i32 %12, 4
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = srem i32 %15, 10
%17 = add nsw i32 %13, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %2
br label %19
19: ; preds = %9, %7
%20 = load i8, i8* %2
ret i8 %20
}

LLVM IR (-O2):
@UCHAR_MAX = global i8 0
define zeroext i8 @decToBcd(i8 zeroext %0) {
%2 = icmp ugt i8 %0, 99
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = load i8, i8* @UCHAR_MAX
br label %10
5: ; preds = %1
%6 = udiv i8 %0, 10
%7 = shl nuw i8 %6, 4
%8 = urem i8 %0, 10
%9 = or i8 %7, %8
br label %10
10: ; preds = %5, %3
%11 = phi i8 [ %4, %3 ], [ %9, %5 ]
ret i8 %11
}
void float_interpolator(float *s, float *e, float t, float *r) {
  r[0] = s[0] + (e[0] - s[0]) * t;
}


x86 assembly (clang, -O0):
<float_interpolator>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
subss  (%rax),%xmm0
movss  -0x14(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_interpolator>:
movss  (%rdi),%xmm1
movss  (%rsi),%xmm2
subss  %xmm1,%xmm2
mulss  %xmm0,%xmm2
addss  %xmm1,%xmm2
movss  %xmm2,(%rdx)
ret

LLVM IR (-O0):
define void @float_interpolator(float* %0, float* %1, float %2, float* %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float
%8 = alloca float*
store float* %0, float** %5
store float* %1, float** %6
store float %2, float* %7
store float* %3, float** %8
%9 = load float*, float** %5
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
%12 = load float*, float** %6
%13 = getelementptr inbounds float, float* %12, i64 0
%14 = load float, float* %13
%15 = load float*, float** %5
%16 = getelementptr inbounds float, float* %15, i64 0
%17 = load float, float* %16
%18 = fsub float %14, %17
%19 = load float, float* %7
%20 = call float @llvm.fmuladd.f32(float %18, float %19, float %11)
%21 = load float*, float** %8
%22 = getelementptr inbounds float, float* %21, i64 0
store float %20, float* %22
ret void
}

LLVM IR (-O2):
define void @float_interpolator(float* nocapture %0, float* nocapture %1, float %2, float* nocapture writeonly %3) {
%5 = load float, float* %0
%6 = load float, float* %1
%7 = fsub float %6, %5
%8 = tail call float @llvm.fmuladd.f32(float %7, float %2, float %5)
store float %8, float* %3
ret void
}
void e(void) {}


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

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

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

LLVM IR (-O2):
define void @e() {
ret void
}
/* Variables and functions */
int f364(int *);
int f365(int *p) { return f364(p); }


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

x86 assembly (clang, -O2):
<f365>:
jmp    1030 <f364@plt>

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

LLVM IR (-O2):
define i32 @f365(i32* %0) {
%2 = tail call i32 @f364(i32* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ hex2dec(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  FILE *in;
  hex2dec(stdin);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <hex2dec@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdin
%4 = tail call i32 @hex2dec(i32 %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ writel(int /*<<< orphan*/, void *);
void write_clkgr0(uint32_t val) { writel(val, (void *)0xb0000000 + (0x20)); }


x86 assembly (clang, -O0):
<write_clkgr0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xb0000000,%esi
add    $0x20,%rsi
call   1030 <writel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_clkgr0>:
mov    $0xb0000020,%esi
jmp    1030 <writel@plt>

LLVM IR (-O0):
define void @write_clkgr0(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @writel(i32 %3, i8* getelementptr (i8, i8* inttoptr (i64 2952790016 to i8*), i64 32))
ret void
}

LLVM IR (-O2):
define void @write_clkgr0(i32 %0) {
%2 = tail call i32 @writel(i32 %0, i8* inttoptr (i64 2952790048 to i8*))
ret void
}
/* Variables and functions */
int pathcon_nm9_f0(double const **, double **, int *, double *, int);
int pathcon_nm9(const double **arg, double **res, int *iw, double *w, int mem) {
  return pathcon_nm9_f0(arg, res, iw, w, mem);
}


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

x86 assembly (clang, -O2):
<pathcon_nm9>:
jmp    1030 <pathcon_nm9_f0@plt>

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

LLVM IR (-O2):
define i32 @pathcon_nm9(double** %0, double** %1, i32* %2, double* %3, i32 %4) {
%6 = tail call i32 @pathcon_nm9_f0(double** %0, double** %1, i32* %2, double* %3, i32 %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ errnoexit(char *);
int /*<<< orphan*/ exit(int);
void error(char *msg) {
  errnoexit(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <errnoexit@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
call   1030 <errnoexit@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
define void @error(i8* %0) {
%2 = tail call i32 @errnoexit(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
unsigned xrop3_144_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = D ^ S;
  stk2 = ~stk2;
  stk1 = T & stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


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

x86 assembly (clang, -O2):
<xrop3_144_0_1>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
and    %eax,%ecx
movzbl %cl,%ecx
not    %eax
and    %esi,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @xrop3_144_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = and i32 %4, 255
%8 = and i32 %7, %6
%9 = xor i32 %4, -1
%10 = and i32 %9, %5
%11 = or i32 %8, %10
ret i32 %11
}
int have_capabilities(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @have_capabilities() {
ret i32 0
}
void set_bit(int nr, int *addr) { *(addr + (nr >> 5)) |= (1 << (nr & 0x1f)); }


x86 assembly (clang, -O0):
<set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sar    $0x5,%ecx
movslq %ecx,%rcx
or     (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
sar    $0x5,%ecx
movslq %ecx,%rcx
or     %eax,(%rsi,%rcx,4)
ret

LLVM IR (-O0):
define void @set_bit(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 = and i32 %5, 31
%7 = shl i32 1, %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %3
%10 = ashr i32 %9, 5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %8, i64 %11
%13 = load i32, i32* %12
%14 = or i32 %13, %7
store i32 %14, i32* %12
ret void
}

LLVM IR (-O2):
define void @set_bit(i32 %0, i32* nocapture %1) {
%3 = and i32 %0, 31
%4 = shl nuw i32 1, %3
%5 = ashr i32 %0, 5
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %1, i64 %6
%8 = load i32, i32* %7
%9 = or i32 %8, %4
store i32 %9, i32* %7
ret void
}
/* Variables and functions */
double pow(double, double);
double rq_rate_compounding_to_discount(double r, double days,
                                       double days_in_comp_period) {
  return 1.0 / pow(1.0 + r, days / days_in_comp_period);
}


x86 assembly (clang, -O0):
<rq_rate_compounding_to_discount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  0xed1(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
divsd  -0x18(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xeb2(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rq_rate_compounding_to_discount>:
push   %rax
addsd  0xee7(%rip),%xmm0
divsd  %xmm2,%xmm1
call   1030 <pow@plt>
movsd  0xed6(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rq_rate_compounding_to_discount(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = fadd double 1.000000e+00, %7
%9 = load double, double* %5
%10 = load double, double* %6
%11 = fdiv double %9, %10
%12 = call double @pow(double %8, double %11)
%13 = fdiv double 1.000000e+00, %12
ret double %13
}

LLVM IR (-O2):
define double @rq_rate_compounding_to_discount(double %0, double %1, double %2) {
%4 = fadd double %0, 1.000000e+00
%5 = fdiv double %1, %2
%6 = tail call double @pow(double %4, double %5)
%7 = fdiv double 1.000000e+00, %6
ret double %7
}
void UARTFIFOEnable(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x0000002C))) |= 0x00000010;
}


x86 assembly (clang, -O0):
<UARTFIFOEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2c(%rax),%rcx
or     $0x10,%rcx
mov    %rcx,0x2c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTFIFOEnable>:
orq    $0x10,0x2c(%rdi)
ret

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

LLVM IR (-O2):
define void @UARTFIFOEnable(i64 %0) {
%2 = add i64 %0, 44
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = or i64 %4, 16
store volatile i64 %5, i64* %3
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int log(int);
double ssd_to_psnr(uint64_t ssd, uint64_t denom) {
  return -10 * log((double)ssd / (denom * 255 * 255)) / log(10);
}


x86 assembly (clang, -O0):
<ssd_to_psnr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
imul   $0xff,-0x8(%rbp),%eax
imul   $0xff,%eax,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
imul   $0xfffffff6,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    $0xa,%edi
call   1030 <log@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssd_to_psnr>:
push   %rbx
cvtsi2sd %edi,%xmm0
imul   $0xfe01,%esi,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
add    %eax,%eax
lea    (%rax,%rax,4),%ebx
neg    %ebx
mov    $0xa,%edi
call   1030 <log@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @ssd_to_psnr(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 = sitofp i32 %5 to double
%7 = load i32, i32* %4
%8 = mul nsw i32 %7, 255
%9 = mul nsw i32 %8, 255
%10 = sitofp i32 %9 to double
%11 = fdiv double %6, %10
%12 = fptosi double %11 to i32
%13 = call i32 @log(i32 %12)
%14 = mul nsw i32 -10, %13
%15 = call i32 @log(i32 10)
%16 = sdiv i32 %14, %15
%17 = sitofp i32 %16 to double
ret double %17
}

LLVM IR (-O2):
define double @ssd_to_psnr(i32 %0, i32 %1) {
%3 = sitofp i32 %0 to double
%4 = mul i32 %1, 65025
%5 = sitofp i32 %4 to double
%6 = fdiv double %3, %5
%7 = fptosi double %6 to i32
%8 = tail call i32 @log(i32 %7)
%9 = mul nsw i32 %8, -10
%10 = tail call i32 @log(i32 10)
%11 = sdiv i32 %9, %10
%12 = sitofp i32 %11 to double
ret double %12
}