xunge/DecIR huggingface dataset:
double updateRatio(double newRatio) {
  static double ratio = 1.0;
  double oldRatio = ratio;
  ratio = newRatio;
  return oldRatio;
}


x86 assembly (clang, -O0):
<updateRatio>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0x2f0f(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,0x2efd(%rip)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<updateRatio>:
movsd  0x2f18(%rip),%xmm1
movsd  %xmm0,0x2f10(%rip)
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
@updateRatio.ratio = internal global double 1.000000e+00
define double @updateRatio(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* @updateRatio.ratio
store double %4, double* %3
%5 = load double, double* %2
store double %5, double* @updateRatio.ratio
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
@updateRatio.ratio = internal unnamed_addr global double 1.000000e+00
define double @updateRatio(double %0) {
%2 = load double, double* @updateRatio.ratio
store double %0, double* @updateRatio.ratio
ret double %2
}
char *printemission(int e) {
  char *c;
  switch (e) {
  case 0:
    c = "WP";
    break;
  case 1:
    c = "DP";
    break;
  default:
    c = "NULL";
    break;
  }
  return c;
}


x86 assembly (clang, -O0):
<printemission>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     112b <printemission+0x2b>
jmp    111a <printemission+0x1a>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     113b <printemission+0x3b>
jmp    114b <printemission+0x4b>
lea    0xece(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1156 <printemission+0x56>
lea    0xec1(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    1156 <printemission+0x56>
lea    0xeb4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<printemission>:
cmp    $0x1,%edi
lea    0xef9(%rip),%rax
lea    0xef5(%rip),%rcx
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee2(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [3 x i8] c"WP\00"
@.str.1 = [3 x i8] c"DP\00"
@.str.2 = [5 x i8] c"NULL\00"
define i8* @printemission(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %7 [
i32 0, label %5
i32 1, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %3
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %8
7: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"WP\00"
@.str.1 = [3 x i8] c"DP\00"
@.str.2 = [5 x i8] c"NULL\00"
define i8* @printemission(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ add_binding(char *, char *);
int /*<<< orphan*/ remove_binding(char *);
void cmd_bind(const char *pf, char **args) {
  if (args[1])
    add_binding(args[0], args[1]);
  else
    remove_binding(args[0]);
}


x86 assembly (clang, -O0):
<cmd_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1158 <cmd_bind+0x38>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1040 <add_binding@plt>
jmp    1164 <cmd_bind+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <remove_binding@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_bind>:
mov    (%rsi),%rdi
mov    0x8(%rsi),%rsi
test   %rsi,%rsi
je     1131 <cmd_bind+0x11>
jmp    1040 <add_binding@plt>
jmp    1030 <remove_binding@plt>

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

LLVM IR (-O2):
define void @cmd_bind(i8* nocapture readnone %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
%6 = load i8*, i8** %1
br i1 %5, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @add_binding(i8* %6, i8* %4)
br label %11
9: ; preds = %2
%10 = tail call i32 @remove_binding(i8* %6)
br label %11
11: ; preds = %9, %7
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *at_alloc(size_t size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<at_alloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @at_alloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
int ge_it(int suc, int value) { return suc >= value; }


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

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

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

LLVM IR (-O2):
define i32 @ge_it(i32 %0, i32 %1) {
%3 = icmp sge i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
unsigned num_repeats(const unsigned test, const unsigned num) {
  unsigned result = num;
  while (result < test)
    result = (result * 10) + num;
  return test == result;
}


x86 assembly (clang, -O0):
<num_repeats>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    112b <num_repeats+0x2b>
imul   $0xa,-0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1110 <num_repeats+0x10>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_repeats>:
cmp    %edi,%esi
jae    111c <num_repeats+0x1c>
mov    %esi,%ecx
cs nopw 0x0(%rax,%rax,1)
lea    (%rcx,%rcx,4),%eax
lea    (%rsi,%rax,2),%ecx
cmp    %edi,%ecx
jb     1110 <num_repeats+0x10>
jmp    111e <num_repeats+0x1e>
mov    %esi,%ecx
xor    %eax,%eax
cmp    %edi,%ecx
sete   %al
ret

LLVM IR (-O0):
define i32 @num_repeats(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 = %11, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp ult i32 %8, %9
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i32, i32* %5
%13 = mul i32 %12, 10
%14 = load i32, i32* %4
%15 = add i32 %13, %14
store i32 %15, i32* %5
br label %7
16: ; preds = %7
%17 = load i32, i32* %3
%18 = load i32, i32* %5
%19 = icmp eq i32 %17, %18
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @num_repeats(i32 %0, i32 %1) {
%3 = icmp ult i32 %1, %0
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = mul i32 %5, 10
%7 = add i32 %6, %1
%8 = icmp ult i32 %7, %0
br i1 %8, label %4, label %9
9: ; preds = %4, %2
%10 = phi i32 [ %1, %2 ], [ %7, %4 ]
%11 = icmp eq i32 %10, %0
%12 = zext i1 %11 to i32
ret i32 %12
}
void uppercase(ch) char *ch;
{ (*ch) = isupper(*ch) ? (*ch) : toupper(*ch); }


x86 assembly (clang, -O0):
<uppercase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isupper@plt>
cmp    $0x0,%eax
je     1150 <uppercase+0x30>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    115f <uppercase+0x3f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uppercase>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%ebp
mov    %ebp,%edi
call   1040 <isupper@plt>
test   %eax,%eax
jne    113d <uppercase+0x1d>
mov    %ebp,%edi
call   1030 <toupper@plt>
mov    %eax,%ebp
mov    %bpl,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @uppercase(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = call i32 @isupper(i32 %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
br label %17
12: ; preds = %1
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = call i32 @toupper(i32 %15)
br label %17
17: ; preds = %12, %8
%18 = phi i32 [ %11, %8 ], [ %16, %12 ]
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %2
store i8 %19, i8* %20
ret void
}

LLVM IR (-O2):
define void @uppercase(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = tail call i32 @isupper(i32 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @toupper(i32 %3)
br label %8
8: ; preds = %1, %6
%9 = phi i32 [ %7, %6 ], [ %3, %1 ]
%10 = trunc i32 %9 to i8
store i8 %10, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const);
void dumpCharArray(const char *rawData, size_t size) {
  for (int j = 0; j < size; j++) {
    printf("%c", rawData[j]);
  }
}


x86 assembly (clang, -O0):
<dumpCharArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    115b <dumpCharArray+0x4b>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
lea    0xebc(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <dumpCharArray+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpCharArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1146 <dumpCharArray+0x36>
mov    %rsi,%r12
mov    %rdi,%r14
xor    %ebx,%ebx
lea    0xed4(%rip),%r15
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <dumpCharArray+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @dumpCharArray(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %8)
%10 = add nuw i64 %6, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %4, label %5
}
/* Variables and functions */
int semget(int, int, int /*<<< orphan*/);
int mysem_open(int key) { return semget(key, 1, 0); }


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

x86 assembly (clang, -O2):
<mysem_open>:
mov    $0x1,%esi
xor    %edx,%edx
jmp    1030 <semget@plt>

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

LLVM IR (-O2):
define i32 @mysem_open(i32 %0) {
%2 = tail call i32 @semget(i32 %0, i32 1, i32 0)
ret i32 %2
}
void UARTDMADisable(unsigned int baseAdd, unsigned int flags) {
  (*((volatile unsigned int *)(baseAdd + (0x8)))) =
      (flags & ((0x00000001u) | (0x000000C0u)));
}


x86 assembly (clang, -O0):
<UARTDMADisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
and    $0xc1,%ecx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTDMADisable>:
and    $0xc1,%esi
add    $0x8,%edi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @UARTDMADisable(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 = and i32 %5, 193
%7 = load i32, i32* %3
%8 = add i32 %7, 8
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
store volatile i32 %6, i32* %10
ret void
}

LLVM IR (-O2):
define void @UARTDMADisable(i32 %0, i32 %1) {
%3 = and i32 %1, 193
%4 = add i32 %0, 8
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
store volatile i32 %3, i32* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int x;
  x = 5;
  x = x * 4;
  x = x / 2;
  x = x - 3 + 2;
  if (x >= 7)
    x = x / 3;
  else
    x = x * 3;
  assert(x == 3);
  return x;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x3,%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jl     1166 <main+0x56>
mov    -0x8(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    116d <main+0x5d>
imul   $0x3,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x3,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 4
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = sdiv i32 %5, 2
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 3
%9 = add nsw i32 %8, 2
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = icmp sge i32 %10, 7
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 3
store i32 %14, i32* %2
br label %18
15: ; preds = %0
%16 = load i32, i32* %2
%17 = mul nsw i32 %16, 3
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* %2
%20 = icmp eq i32 %19, 3
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ minHeapFixdown(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ swap(int, int);
void minHeapDeleteNumber(int a[], int n) {
  swap(a[0], a[n - 1]);
  minHeapFixdown(a, 0, n - 1);
}


x86 assembly (clang, -O0):
<minHeapDeleteNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
call   1040 <swap@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <minHeapFixdown@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minHeapDeleteNumber>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%edi
movslq %esi,%rax
lea    -0x1(%rsi),%ebp
mov    -0x4(%rbx,%rax,4),%esi
call   1040 <swap@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <minHeapFixdown@plt>

LLVM IR (-O0):
define void @minHeapDeleteNumber(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 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = sub nsw i32 %9, 1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i32, i32* %8, i64 %11
%13 = load i32, i32* %12
%14 = call i32 @swap(i32 %7, i32 %13)
%15 = load i32*, i32** %3
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 1
%18 = call i32 @minHeapFixdown(i32* %15, i32 0, i32 %17)
ret void
}

LLVM IR (-O2):
define void @minHeapDeleteNumber(i32* %0, i32 %1) {
%3 = load i32, i32* %0
%4 = add nsw i32 %1, -1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = tail call i32 @swap(i32 %3, i32 %7)
%9 = tail call i32 @minHeapFixdown(i32* %0, i32 0, i32 %4)
ret void
}
void sorwakeup(so) struct SLIRPsocket *so;
{}


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

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

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

LLVM IR (-O2):
%struct.SLIRPsocket = type opaque
define void @sorwakeup(%struct.SLIRPsocket* nocapture %0) {
ret void
}
long idfEquilikely(long a, long b, double u) {
  return (a + (long)(u * (b - a + 1)));
}


x86 assembly (clang, -O0):
<idfEquilikely>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rcx
sub    -0x8(%rbp),%rcx
add    $0x1,%rcx
cvtsi2sd %rcx,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<idfEquilikely>:
sub    %rdi,%rsi
add    $0x1,%rsi
cvtsi2sd %rsi,%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @idfEquilikely(i64 %0, i64 %1, double %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca double
store i64 %0, i64* %4
store i64 %1, i64* %5
store double %2, double* %6
%7 = load i64, i64* %4
%8 = load double, double* %6
%9 = load i64, i64* %5
%10 = load i64, i64* %4
%11 = sub nsw i64 %9, %10
%12 = add nsw i64 %11, 1
%13 = sitofp i64 %12 to double
%14 = fmul double %8, %13
%15 = fptosi double %14 to i64
%16 = add nsw i64 %7, %15
ret i64 %16
}

LLVM IR (-O2):
define i64 @idfEquilikely(i64 %0, i64 %1, double %2) {
%4 = sub i64 1, %0
%5 = add i64 %4, %1
%6 = sitofp i64 %5 to double
%7 = fmul double %6, %2
%8 = fptosi double %7 to i64
%9 = add nsw i64 %8, %0
ret i64 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_barrier_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_barrier_wait(int /*<<< orphan*/ *);
void *child1(void *arg) {
  pthread_barrier_wait((pthread_barrier_t *)arg);
  return NULL;
}


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

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

LLVM IR (-O0):
define i8* @child1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = call i32 @pthread_barrier_wait(i32* %4)
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @child1(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @pthread_barrier_wait(i32* %2)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ treeify(int *, size_t, size_t);
void insert(int value, size_t pos, int *base, size_t nmemb) {
  if (pos >= nmemb >> 1 && pos < nmemb) {
    base[pos] = value;
    treeify(base, nmemb, pos);
  }
}


x86 assembly (clang, -O0):
<insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
shr    $0x1,%rcx
cmp    %rcx,%rax
jb     1169 <insert+0x59>
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1169 <insert+0x59>
mov    -0x4(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <treeify@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert>:
cmp    %rcx,%rsi
jae    1134 <insert+0x24>
mov    %rsi,%rax
mov    %rcx,%rsi
shr    %rsi
cmp    %rax,%rsi
ja     1134 <insert+0x24>
mov    %edi,(%rdx,%rax,4)
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %rax,%rdx
jmp    1030 <treeify@plt>
ret

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

LLVM IR (-O2):
define void @insert(i32 %0, i64 %1, i32* %2, i64 %3) {
%5 = lshr i64 %3, 1
%6 = icmp ule i64 %5, %1
%7 = icmp ult i64 %1, %3
%8 = and i1 %7, %6
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = getelementptr inbounds i32, i32* %2, i64 %1
store i32 %0, i32* %10
%11 = tail call i32 @treeify(i32* %2, i64 %3, i64 %1)
br label %12
12: ; preds = %9, %4
ret void
}
/* Variables and functions */
void glmXor3s(bool out[3], const bool x[3], bool y) {
  for (size_t i = 0; i < 3; ++i)
    out[i] = x[i] != y;
}


x86 assembly (clang, -O0):
<glmXor3s>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x3,-0x20(%rbp)
jae    1154 <glmXor3s+0x54>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%edx
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1117 <glmXor3s+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmXor3s>:
xor    %eax,%eax
cmp    %edx,(%rsi)
setne  %al
mov    %eax,(%rdi)
xor    %eax,%eax
cmp    %edx,0x4(%rsi)
setne  %al
mov    %eax,0x4(%rdi)
xor    %eax,%eax
cmp    %edx,0x8(%rsi)
setne  %al
mov    %eax,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @glmXor3s(i32* nocapture writeonly %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, %2
%6 = zext i1 %5 to i32
store i32 %6, i32* %0
%7 = getelementptr inbounds i32, i32* %1, i64 1
%8 = load i32, i32* %7
%9 = icmp ne i32 %8, %2
%10 = zext i1 %9 to i32
%11 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %10, i32* %11
%12 = getelementptr inbounds i32, i32* %1, i64 2
%13 = load i32, i32* %12
%14 = icmp ne i32 %13, %2
%15 = zext i1 %14 to i32
%16 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %15, i32* %16
ret void
}
/* Variables and functions */
size_t pbbase64_encoded_length(size_t);
size_t pbbase64_char_array_size_for_encoding(size_t length) {
  return pbbase64_encoded_length(length) + 1;
}


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

x86 assembly (clang, -O2):
<pbbase64_char_array_size_for_encoding>:
push   %rax
call   1030 <pbbase64_encoded_length@plt>
add    $0x1,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @pbbase64_char_array_size_for_encoding(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @pbbase64_encoded_length(i64 %3)
%5 = add i64 %4, 1
ret i64 %5
}

LLVM IR (-O2):
define i64 @pbbase64_char_array_size_for_encoding(i64 %0) {
%2 = tail call i64 @pbbase64_encoded_length(i64 %0)
%3 = add i64 %2, 1
ret i64 %3
}
void break6() {}


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

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

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

LLVM IR (-O2):
define void @break6() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PicoCSettingsHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void PicoCSettingsRequestUpdate() {
  UAVObjRequestUpdate(PicoCSettingsHandle());
}


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

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

LLVM IR (-O0):
define void @PicoCSettingsRequestUpdate() {
%1 = call i32 (...) @PicoCSettingsHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @PicoCSettingsRequestUpdate() {
%1 = tail call i32 (...) @PicoCSettingsHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
/* Type definitions */
struct siphash {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ siphash24_compress(char const *, int /*<<< orphan*/,
                                      struct siphash *);
int /*<<< orphan*/ strlen(char const *);
void siphash24_compress_string(const char *in, struct siphash *state) {
  if (!in)
    return;
  siphash24_compress(in, strlen(in), state);
}


x86 assembly (clang, -O0):
<siphash24_compress_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1140 <siphash24_compress_string+0x20>
jmp    1160 <siphash24_compress_string+0x40>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1030 <siphash24_compress@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<siphash24_compress_string>:
test   %rdi,%rdi
je     1148 <siphash24_compress_string+0x28>
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <siphash24_compress@plt>
ret

LLVM IR (-O0):
%struct.siphash = type { i32 }
define void @siphash24_compress_string(i8* %0, %struct.siphash* %1) {
%3 = alloca i8*
%4 = alloca %struct.siphash*
store i8* %0, i8** %3
store %struct.siphash* %1, %struct.siphash** %4
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %2
br label %14
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @strlen(i8* %10)
%12 = load %struct.siphash*, %struct.siphash** %4
%13 = call i32 @siphash24_compress(i8* %9, i32 %11, %struct.siphash* %12)
br label %14
14: ; preds = %8, %7
ret void
}

LLVM IR (-O2):
%struct.siphash = type { i32 }
define void @siphash24_compress_string(i8* %0, %struct.siphash* %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @strlen(i8* %0)
%6 = tail call i32 @siphash24_compress(i8* %0, i32 %5, %struct.siphash* %1)
br label %7
7: ; preds = %2, %4
ret void
}
int sub() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @sub() {
ret i32 0
}
/* Variables and functions */
int check_cursor_pos(char const *, int const *);
int main(int argc, char **argv) {
  const char *str1 = "World ";
  const int expected_pos1[] = {0, 1, 2, 3, 4, 3};
  return check_cursor_pos(str1, expected_pos1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed8(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed5(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xed2(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <check_cursor_pos@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xf05(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xece(%rip),%rdi
mov    %rsp,%rsi
call   1030 <check_cursor_pos@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"World \00"
@__const.main.expected_pos1 = [6 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 3]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [6 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %6
%8 = bitcast [6 x i32]* %7 to i8*
%9 = load i8*, i8** %6
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%11 = call i32 @check_cursor_pos(i8* %9, i32* %10)
ret i32 %11
}

LLVM IR (-O2):
@.str = [7 x i8] c"World \00"
@__const.main.expected_pos1 = [6 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 3]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i32]
%4 = bitcast [6 x i32]* %3 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%6 = call i32 @check_cursor_pos(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %5)
ret i32 %6
}
/* Variables and functions */
double erf(float);
float sqrt(double);
float Phi(float z) { return 0.5 * (1.0 + erf(z / (sqrt(2.0)))); }


x86 assembly (clang, -O0):
<Phi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movsd  0xed1(%rip),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
divss  %xmm1,%xmm0
call   1040 <erf@plt>
movsd  0xeab(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xe97(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Phi>:
push   %rax
movss  %xmm0,0x4(%rsp)
movsd  0xed1(%rip),%xmm0
call   1030 <sqrt@plt>
movss  0x4(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
call   1040 <erf@plt>
addsd  0xeba(%rip),%xmm0
mulsd  0xeba(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @Phi(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @sqrt(double 2.000000e+00)
%5 = fdiv float %3, %4
%6 = call double @erf(float %5)
%7 = fadd double 1.000000e+00, %6
%8 = fmul double 5.000000e-01, %7
%9 = fptrunc double %8 to float
ret float %9
}

LLVM IR (-O2):
define float @Phi(float %0) {
%2 = tail call float @sqrt(double 2.000000e+00)
%3 = fdiv float %0, %2
%4 = tail call double @erf(float %3)
%5 = fadd double %4, 1.000000e+00
%6 = fmul double %5, 5.000000e-01
%7 = fptrunc double %6 to float
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void hello() { printf("%s\n", "Hello CGO!"); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [11 x i8] c"Hello CGO!\00"
define void @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [11 x i8] c"Hello CGO!\00"
define void @hello() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct linseg {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free_object(int, short *);
void free_linseg(struct linseg *ls) { free_object(34, (short *)ls); }


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

x86 assembly (clang, -O2):
<free_linseg>:
mov    %rdi,%rsi
mov    $0x22,%edi
jmp    1030 <free_object@plt>

LLVM IR (-O0):
%struct.linseg = type { i32 }
define void @free_linseg(%struct.linseg* %0) {
%2 = alloca %struct.linseg*
store %struct.linseg* %0, %struct.linseg** %2
%3 = load %struct.linseg*, %struct.linseg** %2
%4 = bitcast %struct.linseg* %3 to i16*
%5 = call i32 @free_object(i32 34, i16* %4)
ret void
}

LLVM IR (-O2):
%struct.linseg = type { i32 }
define void @free_linseg(%struct.linseg* %0) {
%2 = bitcast %struct.linseg* %0 to i16*
%3 = tail call i32 @free_object(i32 34, i16* %2)
ret void
}
void GotMouseEvent(int client, int mask, int x, int y) {}


x86 assembly (clang, -O0):
<GotMouseEvent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @GotMouseEvent(i32 %0, i32 %1, i32 %2, i32 %3) {
ret void
}
int get_unsigned_short_le(unsigned char **data) {
  int result;
  result = *(*data) | (*(*data + 1) << 8);
  *data += 2;
  return result;
}


x86 assembly (clang, -O0):
<get_unsigned_short_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x2,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_unsigned_short_le>:
mov    (%rdi),%rcx
movzwl (%rcx),%eax
add    $0x2,%rcx
mov    %rcx,(%rdi)
ret

LLVM IR (-O0):
define i32 @get_unsigned_short_le(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = load i8**, i8*** %2
%9 = load i8*, i8** %8
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = or i32 %7, %13
store i32 %14, i32* %3
%15 = load i8**, i8*** %2
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8, i8* %16, i64 2
store i8* %17, i8** %15
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @get_unsigned_short_le(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %2, i64 2
store i8* %10, i8** %0
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ die(char *, unsigned int);
void *malloc(unsigned int);
void *xmalloc(unsigned int howmuch) {
  void *p = malloc(howmuch);
  if (!p)
    die("Unable to allocate %d bytes of memory", howmuch);
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1151 <xmalloc+0x31>
mov    -0x4(%rbp),%esi
lea    0xeb4(%rip),%rdi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1140 <xmalloc+0x20>
lea    0xec7(%rip),%rdi
mov    %ebp,%esi
call   1040 <die@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [38 x i8] c"Unable to allocate %d bytes of memory\00"
define noalias i8* @xmalloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @die(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %4, %1
ret i8* %2
}
void ps_select_window(int id) { id = id; }


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

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

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

LLVM IR (-O2):
define void @ps_select_window(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ done_testing();
int /*<<< orphan*/ ok(int, char *);
int /*<<< orphan*/ plan(int);
int main(void) {
  plan(1);
  ok(1, "ok works");
  done_testing();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1050 <plan@plt>
mov    $0x1,%edi
lea    0xeab(%rip),%rsi
call   1030 <ok@plt>
mov    $0x0,%al
call   1040 <done_testing@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1050 <plan@plt>
lea    0xebe(%rip),%rsi
mov    $0x1,%edi
call   1030 <ok@plt>
xor    %eax,%eax
call   1040 <done_testing@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"ok works\00"
define i32 @main() {
%1 = tail call i32 @plan(i32 1)
%2 = tail call i32 @ok(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @done_testing()
ret i32 0
}
void foo_1_1_1_1_2_2_1_1_2() {}


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

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

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

LLVM IR (-O2):
define void @foo_1_1_1_1_2_2_1_1_2() {
ret void
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
void e_1_7() { printf("%d", EOF); }


x86 assembly (clang, -O0):
<e_1_7>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<e_1_7>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i32 0
define void @e_1_7() {
%1 = load i32, i32* @EOF
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) { return 0; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.rt2x00_dev = type opaque
define i32 @rt2x00rfkill_register(%struct.rt2x00_dev* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, unsigned int);
void write_data_to_pointer_on_offset(void *state, unsigned char *data,
                                     unsigned int offset, unsigned int length) {
  memcpy((unsigned char *)state + offset, data, length);
}


x86 assembly (clang, -O0):
<write_data_to_pointer_on_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%eax
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_data_to_pointer_on_offset>:
mov    %edx,%eax
add    %rax,%rdi
mov    %ecx,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @write_data_to_pointer_on_offset(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %7
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8*, i8** %6
%14 = load i32, i32* %8
%15 = call i32 @memcpy(i8* %12, i8* %13, i32 %14)
ret void
}

LLVM IR (-O2):
define void @write_data_to_pointer_on_offset(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = zext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = tail call i32 @memcpy(i8* %6, i8* %1, i32 %3)
ret void
}
char charTest(char value) { return value; }


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

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

LLVM IR (-O0):
define signext i8 @charTest(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
ret i8 %3
}

LLVM IR (-O2):
define signext i8 @charTest(i8 returned signext %0) {
ret i8 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void main() {
  int a = 0, b = 0, i = 0;
  a++;
  while (i < 5) {
    b++;
    i++;
    a++;
  };
  printf("%i\n", a);
  printf("%i\n", b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1160 <main+0x50>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1136 <main+0x26>
mov    -0x4(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe87(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 6)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 5)
ret void
}
/* Variables and functions */
double M_LOG2E;
double log(double const);
double log2(const double x) { return log(x) * M_LOG2E; }


x86 assembly (clang, -O0):
<log2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
mov    0x2eb2(%rip),%rax
mulsd  (%rax),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2>:
push   %rax
call   1030 <log@plt>
mov    0x2ec3(%rip),%rax
mulsd  (%rax),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_LOG2E = global double 0.000000e+00
define double @log2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @log(double %3)
%5 = load double, double* @M_LOG2E
%6 = fmul double %4, %5
ret double %6
}

LLVM IR (-O2):
@M_LOG2E = global double 0.000000e+00
define double @log2(double %0) {
%2 = tail call double @log(double %0)
%3 = load double, double* @M_LOG2E
%4 = fmul double %2, %3
ret double %4
}