xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ cpc_key_press(int);
int /*<<< orphan*/ cpc_key_unpress(int);
void Joy_Gamma_Up(int value) {
  if (value) {
    cpc_key_press(0x70);
  } else {
    cpc_key_unpress(0x70);
  };
}


x86 assembly (clang, -O0):
<Joy_Gamma_Up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1144 <Joy_Gamma_Up+0x24>
mov    $0x70,%edi
call   1030 <cpc_key_press@plt>
jmp    114e <Joy_Gamma_Up+0x2e>
mov    $0x70,%edi
call   1040 <cpc_key_unpress@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Joy_Gamma_Up>:
test   %edi,%edi
je     112e <Joy_Gamma_Up+0xe>
mov    $0x70,%edi
jmp    1030 <cpc_key_press@plt>
mov    $0x70,%edi
jmp    1040 <cpc_key_unpress@plt>

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

LLVM IR (-O2):
define void @Joy_Gamma_Up(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @cpc_key_press(i32 112)
br label %7
5: ; preds = %1
%6 = tail call i32 @cpc_key_unpress(i32 112)
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fib(int);
int benchmark() {
  int a;
  a = 35;
  fib(a);
  return a;
}


x86 assembly (clang, -O0):
<benchmark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x23,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <fib@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<benchmark>:
push   %rax
mov    $0x23,%edi
call   1030 <fib@plt>
mov    $0x23,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @benchmark() {
%1 = tail call i32 @fib(i32 35)
ret i32 35
}
void genabs_s() {}


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

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

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

LLVM IR (-O2):
define void @genabs_s() {
ret void
}
int fun1202() { return 1202; }


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

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

LLVM IR (-O0):
define i32 @fun1202() {
ret i32 1202
}

LLVM IR (-O2):
define i32 @fun1202() {
ret i32 1202
}
/* Variables and functions */
float const raw_noise_2d(float const, float const);
float scaled_raw_noise_2d(const float loBound, const float hiBound,
                          const float x, const float y) {
  return raw_noise_2d(x, y) * (hiBound - loBound) / 2 + (hiBound + loBound) / 2;
}


x86 assembly (clang, -O0):
<scaled_raw_noise_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1030 <raw_noise_2d@plt>
movss  -0x8(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xeaf(%rip),%xmm1
divss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
addss  -0x4(%rbp),%xmm1
movss  0xe99(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scaled_raw_noise_2d>:
push   %rax
movss  %xmm1,(%rsp)
movss  %xmm0,0x4(%rsp)
movaps %xmm2,%xmm0
movaps %xmm3,%xmm1
call   1030 <raw_noise_2d@plt>
movss  (%rsp),%xmm3
movaps %xmm3,%xmm1
movss  0x4(%rsp),%xmm2
subss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  0xebb(%rip),%xmm1
mulss  %xmm1,%xmm0
addss  %xmm3,%xmm2
mulss  %xmm1,%xmm2
addss  %xmm2,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @scaled_raw_noise_2d(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* %7
%10 = load float, float* %8
%11 = call float @raw_noise_2d(float %9, float %10)
%12 = load float, float* %6
%13 = load float, float* %5
%14 = fsub float %12, %13
%15 = fmul float %11, %14
%16 = fdiv float %15, 2.000000e+00
%17 = load float, float* %6
%18 = load float, float* %5
%19 = fadd float %17, %18
%20 = fdiv float %19, 2.000000e+00
%21 = fadd float %16, %20
ret float %21
}

LLVM IR (-O2):
define float @scaled_raw_noise_2d(float %0, float %1, float %2, float %3) {
%5 = tail call float @raw_noise_2d(float %2, float %3)
%6 = fsub float %1, %0
%7 = fmul float %6, %5
%8 = fmul float %7, 5.000000e-01
%9 = fadd float %0, %1
%10 = fmul float %9, 5.000000e-01
%11 = fadd float %10, %8
ret float %11
}
char *WcxLastSlash(cp)
char *cp;
{
  char *slash = (char *)0;
  while (*cp) {
    if (*cp == '/')
      slash = cp;
    ++cp;
  }
  return slash;
}


x86 assembly (clang, -O0):
<WcxLastSlash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <WcxLastSlash+0x46>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1135 <WcxLastSlash+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <WcxLastSlash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<WcxLastSlash>:
xor    %eax,%eax
jmp    1117 <WcxLastSlash+0x17>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rdi,%rax
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0x2f,%cl
je     1110 <WcxLastSlash+0x10>
test   %cl,%cl
jne    1113 <WcxLastSlash+0x13>
ret

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

LLVM IR (-O2):
define i8* @WcxLastSlash(i8* %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i8* [ %0, %1 ], [ %9, %7 ]
%4 = phi i8* [ null, %1 ], [ %8, %7 ]
%5 = load i8, i8* %3
switch i8 %5, label %7 [
i8 0, label %10
i8 47, label %6
]
6: ; preds = %2
br label %7
7: ; preds = %2, %6
%8 = phi i8* [ %3, %6 ], [ %4, %2 ]
%9 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
10: ; preds = %2
ret i8* %4
}
int tcflush(int fd, int queue_selector) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @tcflush(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
size_t FSE_compressBound(size_t size) { return (512 + (size + (size >> 7))); }


x86 assembly (clang, -O0):
<FSE_compressBound>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x7,%rcx
add    %rcx,%rax
add    $0x200,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FSE_compressBound>:
mov    %rdi,%rax
shr    $0x7,%rax
add    %rdi,%rax
add    $0x200,%rax
ret

LLVM IR (-O0):
define i64 @FSE_compressBound(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* %2
%5 = lshr i64 %4, 7
%6 = add i64 %3, %5
%7 = add i64 512, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @FSE_compressBound(i64 %0) {
%2 = lshr i64 %0, 7
%3 = add i64 %0, 512
%4 = add i64 %3, %2
ret i64 %4
}
void stdio_display_cycle(void) {}


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

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

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

LLVM IR (-O2):
define void @stdio_display_cycle() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void foo(char *str) {
  str[0] = 'H';
  printf("%s\n", str);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x48,(%rax)
mov    -0x8(%rbp),%rsi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %rdi,%rsi
movb   $0x48,(%rdi)
lea    0xee3(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @foo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 72, i8* %4
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @foo(i8* %0) {
store i8 72, i8* %0
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
unsigned int dtobcd(unsigned int d) { return ((d / 10) << 4) + (d % 10); }


x86 assembly (clang, -O0):
<dtobcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x8(%rbp),%eax
add    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtobcd>:
mov    %edi,%eax
mov    $0xcccccccd,%ecx
imul   %rax,%rcx
shr    $0x23,%rcx
mov    %ecx,%eax
shl    $0x4,%eax
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @dtobcd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = udiv i32 %3, 10
%5 = shl i32 %4, 4
%6 = load i32, i32* %2
%7 = urem i32 %6, 10
%8 = add i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @dtobcd(i32 %0) {
%2 = udiv i32 %0, 10
%3 = shl i32 %2, 4
%4 = urem i32 %0, 10
%5 = or i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ mulv(int, int);
int main() {
  mulv(0, 0);
  mulv(0, -1);
  mulv(-1, 0);
  mulv(-1, -1);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <mulv@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
call   1030 <mulv@plt>
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1030 <mulv@plt>
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1030 <mulv@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @mulv(i32 0, i32 0)
%2 = tail call i32 @mulv(i32 0, i32 -1)
%3 = tail call i32 @mulv(i32 -1, i32 0)
%4 = tail call i32 @mulv(i32 -1, i32 -1)
ret i32 0
}
int fun1110() { return 1110; }


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

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

LLVM IR (-O0):
define i32 @fun1110() {
ret i32 1110
}

LLVM IR (-O2):
define i32 @fun1110() {
ret i32 1110
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void outputRange(unsigned lo, unsigned hi) {
  for (lo; lo < hi; ++lo)
    printf("%u\n", lo);
}


x86 assembly (clang, -O0):
<outputRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1147 <outputRange+0x37>
mov    -0x4(%rbp),%esi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111e <outputRange+0xe>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outputRange>:
push   %rbp
push   %r14
push   %rbx
cmp    %esi,%edi
jae    1141 <outputRange+0x31>
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xedd(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1130 <outputRange+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u\0A\00"
define void @outputRange(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
br label %6
6: ; preds = %13, %2
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i32, i32* %3
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %3
%15 = add i32 %14, 1
store i32 %15, i32* %3
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define void @outputRange(i32 %0, i32 %1) {
%3 = icmp ult i32 %0, %1
br i1 %3, label %4, label %9
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %0, %2 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = add i32 %5, 1
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %4
9: ; preds = %4, %2
ret void
}
/* Variables and functions */
char *_(int, int, char *);
int /*<<< orphan*/ printf(char *);
void print_free_header(void) {
  printf(_(4, 6, "\nSegment        Total\n"));
  printf("-------  ----------------\n");
}


x86 assembly (clang, -O0):
<print_free_header>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
mov    $0x6,%esi
lea    0xecb(%rip),%rdx
call   1040 <_@plt>
mov    %rax,%rdi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_free_header>:
push   %rax
lea    0xec8(%rip),%rdx
mov    $0x4,%edi
mov    $0x6,%esi
call   1050 <_@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"\0ASegment Total\0A\00"
@.str.1 = [27 x i8] c"------- ----------------\0A\00"
define void @print_free_header() {
%1 = call i8* @_(i32 4, i32 6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* %1)
%3 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0ASegment Total\0A\00"
@str = [26 x i8] c"------- ----------------\00"
define void @print_free_header() {
%1 = tail call i8* @_(i32 4, i32 6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) %1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
ret void
}
void RTMpGetPresentCount(void) {}


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

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

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

LLVM IR (-O2):
define void @RTMpGetPresentCount() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ squeeze(char *, char *);
int main() {
  char s1[] = "abcdefg";
  char *s2 = "cdef";
  squeeze(s1, s2);
  printf("%s\n", s1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <squeeze@plt>
lea    -0xc(%rbp),%rsi
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x67666564636261,%rax
mov    %rax,0x8(%rsp)
lea    0xec5(%rip),%rsi
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <squeeze@plt>
lea    0xeb6(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"cdef\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 29104508263162465, i64* %1
%3 = call i32 @squeeze(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
void isr_int_page_fault(long error_code) {}


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

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

LLVM IR (-O0):
define void @isr_int_page_fault(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
ret void
}

LLVM IR (-O2):
define void @isr_int_page_fault(i64 %0) {
ret void
}
int *uds_set_communication_control(int communicationType, int controlType) {
  return (int *)1;
}


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

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

LLVM IR (-O0):
define i32* @uds_set_communication_control(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret i32* inttoptr (i64 1 to i32*)
}

LLVM IR (-O2):
define i32* @uds_set_communication_control(i32 %0, i32 %1) {
ret i32* inttoptr (i64 1 to i32*)
}
double calcEnergy(double axis) { return -(3.986E5 / (2 * axis)); }


x86 assembly (clang, -O0):
<calcEnergy>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xee2(%rip),%xmm0
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcEnergy>:
addsd  %xmm0,%xmm0
movsd  0xef4(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @calcEnergy(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 2.000000e+00, %3
%5 = fdiv double 3.986000e+05, %4
%6 = fneg double %5
ret double %6
}

LLVM IR (-O2):
define double @calcEnergy(double %0) {
%2 = fmul double %0, 2.000000e+00
%3 = fdiv double -3.986000e+05, %2
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
scalar_t__ iswdigit(int /*<<< orphan*/ const);
int wskip_atoi(const wchar_t **s) {
  int i = 0;
  while (iswdigit(**s))
    i = i * 10 + *((*s)++) - L'0';
  return i;
}


x86 assembly (clang, -O0):
<wskip_atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%edi
call   1030 <iswdigit@plt>
cmp    $0x0,%rax
je     115d <wskip_atoi+0x4d>
imul   $0xa,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rcx
mov    %rcx,%rsi
add    $0x4,%rsi
mov    %rsi,(%rdx)
add    (%rcx),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <wskip_atoi+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wskip_atoi>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rax
mov    (%rax),%edi
call   1030 <iswdigit@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1152 <wskip_atoi+0x42>
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbx,4),%eax
mov    (%r14),%rcx
lea    0x4(%rcx),%rdx
mov    %rdx,(%r14)
mov    (%rcx),%edx
mov    0x4(%rcx),%edi
lea    (%rdx,%rax,2),%ebx
add    $0xffffffd0,%ebx
call   1030 <iswdigit@plt>
test   %rax,%rax
jne    1130 <wskip_atoi+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @wskip_atoi(i32** %0) {
%2 = alloca i32**
%3 = alloca i32
store i32** %0, i32*** %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32**, i32*** %2
%6 = load i32*, i32** %5
%7 = load i32, i32* %6
%8 = call i64 @iswdigit(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %19
10: ; preds = %4
%11 = load i32, i32* %3
%12 = mul nsw i32 %11, 10
%13 = load i32**, i32*** %2
%14 = load i32*, i32** %13
%15 = getelementptr inbounds i32, i32* %14, i32 1
store i32* %15, i32** %13
%16 = load i32, i32* %14
%17 = add nsw i32 %12, %16
%18 = sub nsw i32 %17, 48
store i32 %18, i32* %3
br label %4
19: ; preds = %4
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @wskip_atoi(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = load i32, i32* %2
%4 = tail call i64 @iswdigit(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %1, %6
%7 = phi i32 [ %13, %6 ], [ 0, %1 ]
%8 = mul nsw i32 %7, 10
%9 = load i32*, i32** %0
%10 = getelementptr inbounds i32, i32* %9, i64 1
store i32* %10, i32** %0
%11 = load i32, i32* %9
%12 = add i32 %8, -48
%13 = add i32 %12, %11
%14 = load i32, i32* %10
%15 = tail call i64 @iswdigit(i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %6
17: ; preds = %6, %1
%18 = phi i32 [ 0, %1 ], [ %13, %6 ]
ret i32 %18
}
/* Type definitions */
struct memlock {
  int dummy;
};

/* Variables and functions */
struct memlock *get_memlock();
int /*<<< orphan*/ mem_lock(struct memlock *, char *);
int /*<<< orphan*/ printf(char *);
int do_lock() {
  struct memlock *lock = get_memlock();
  if (NULL == lock) {
    printf("get lock faild\n");
    return -1;
  }
  while (1) {
    mem_lock(lock, "lock ...");
  }
  return 0;
}


x86 assembly (clang, -O0):
<do_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <get_memlock@plt>
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%rax
jne    1166 <do_lock+0x36>
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret
jmp    116b <do_lock+0x3b>
mov    -0x8(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <mem_lock@plt>
jmp    116b <do_lock+0x3b>

x86 assembly (clang, -O2):
<do_lock>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <get_memlock@plt>
test   %rax,%rax
je     115d <do_lock+0x2d>
mov    %rax,%rbx
lea    0xeb6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mem_lock@plt>
jmp    1150 <do_lock+0x20>
lea    0xea5(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.memlock = type { i32 }
@.str = [16 x i8] c"get lock faild\0A\00"
@.str.1 = [9 x i8] c"lock ...\00"
define i32 @do_lock() {
%1 = alloca %struct.memlock*
%2 = call %struct.memlock* (...) @get_memlock()
store %struct.memlock* %2, %struct.memlock** %1
%3 = load %struct.memlock*, %struct.memlock** %1
%4 = icmp eq %struct.memlock* null, %3
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 -1
7: ; preds = %0
br label %8
8: ; preds = %7, %8
%9 = load %struct.memlock*, %struct.memlock** %1
%10 = call i32 @mem_lock(%struct.memlock* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %8
}

LLVM IR (-O2):
%struct.memlock = type { i32 }
@.str.1 = [9 x i8] c"lock ...\00"
@str = [15 x i8] c"get lock faild\00"
define i32 @do_lock() {
%1 = tail call %struct.memlock* (...) @get_memlock()
%2 = icmp eq %struct.memlock* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 -1
5: ; preds = %0, %5
%6 = tail call i32 @mem_lock(%struct.memlock* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %5
}
double ffi_test_7(double x, double y) { return x * y; }


x86 assembly (clang, -O0):
<ffi_test_7>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffi_test_7>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ffi_test_7(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fmul double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @ffi_test_7(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Variables and functions */
int FIPS_mode();
int FIPS_mode_set(int on) { return on == FIPS_mode(); }


x86 assembly (clang, -O0):
<FIPS_mode_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <FIPS_mode@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FIPS_mode_set>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <FIPS_mode@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @FIPS_mode_set(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (...) @FIPS_mode()
%5 = icmp eq i32 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @FIPS_mode_set(i32 %0) {
%2 = tail call i32 (...) @FIPS_mode()
%3 = icmp eq i32 %2, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
int test_imm_F6int16_mem(short *val) {
  return ((*val) & (0xF6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F6int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xf6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_F6int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 246
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double eval_cle(double x, double y) { return x <= y; }


x86 assembly (clang, -O0):
<eval_cle>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval_cle>:
cmplesd %xmm1,%xmm0
movsd  0xef3(%rip),%xmm1
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @eval_cle(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp ole double %5, %6
%8 = zext i1 %7 to i32
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @eval_cle(double %0, double %1) {
%3 = fcmp ole double %0, %1
%4 = uitofp i1 %3 to double
ret double %4
}
void *sasl_mutex_alloc(void) { return (void *)0x1; }


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

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

LLVM IR (-O0):
define i8* @sasl_mutex_alloc() {
ret i8* inttoptr (i64 1 to i8*)
}

LLVM IR (-O2):
define i8* @sasl_mutex_alloc() {
ret i8* inttoptr (i64 1 to i8*)
}
void G_HandleMessage(int _clientfrom, const char *_buffer, int _messagesize,
                     int _commandtime) {}


x86 assembly (clang, -O0):
<G_HandleMessage>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @G_HandleMessage(i32 %0, i8* nocapture %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Divide(int *, int /*<<< orphan*/, int, int *);
scalar_t__ malloc(int);
void MergeSort(int *arr, int len) {
  int *tmp = (int *)malloc(len * sizeof(int));
  Divide(arr, 0, len - 1, tmp);
}


x86 assembly (clang, -O0):
<MergeSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    -0x18(%rbp),%rcx
xor    %esi,%esi
call   1040 <Divide@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MergeSort>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    0x0(,%rbx,4),%edi
call   1030 <malloc@plt>
add    $0xffffffff,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
mov    %rax,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <Divide@plt>

LLVM IR (-O0):
define void @MergeSort(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 4
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %5
%12 = load i32*, i32** %3
%13 = load i32, i32* %4
%14 = sub nsw i32 %13, 1
%15 = load i32*, i32** %5
%16 = call i32 @Divide(i32* %12, i32 0, i32 %14, i32* %15)
ret void
}

LLVM IR (-O2):
define void @MergeSort(i32* %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i32*
%6 = add nsw i32 %1, -1
%7 = tail call i32 @Divide(i32* %0, i32 0, i32 %6, i32* %5)
ret void
}
int util_test_func() { return 3 * 3; }


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

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

LLVM IR (-O0):
define i32 @util_test_func() {
ret i32 9
}

LLVM IR (-O2):
define i32 @util_test_func() {
ret i32 9
}
extern int t() {}


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

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

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

LLVM IR (-O2):
define i32 @t() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void ClearWindow() { printf("\ec"); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"\1Bc\00"
define void @ClearWindow() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
size_t strlen(char const *);
scalar_t__ strncmp(char const *, char const *, size_t);
__attribute__((unused)) const char *ls_strfollow(const char *str,
                                                 const char *prefix) {
  size_t nprefix = strlen(prefix);
  return strncmp(str, prefix, nprefix) == 0 ? str + nprefix : NULL;
}


x86 assembly (clang, -O0):
<ls_strfollow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1169 <ls_strfollow+0x49>
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1174 <ls_strfollow+0x54>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1174 <ls_strfollow+0x54>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_strfollow>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
add    %r15,%rbx
xor    %ecx,%ecx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @ls_strfollow(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %5
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = load i64, i64* %5
%11 = call i64 @strncmp(i8* %8, i8* %9, i64 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = load i64, i64* %5
%16 = getelementptr inbounds i8, i8* %14, i64 %15
br label %18
17: ; preds = %2
br label %18
18: ; preds = %17, %13
%19 = phi i8* [ %16, %13 ], [ null, %17 ]
ret i8* %19
}

LLVM IR (-O2):
define i8* @ls_strfollow(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i64 @strncmp(i8* %0, i8* %1, i64 %3)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds i8, i8* %0, i64 %3
%7 = select i1 %5, i8* %6, i8* null
ret i8* %7
}
double func_foobar(char *formal_parameters, ...) {
  double retval = 0;
  retval++;
  return retval * 3.14159265359F;
}


x86 assembly (clang, -O0):
<func_foobar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xee3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed5(%rip),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @func_foobar(i8* %0, ...) {
%2 = alloca i8*
%3 = alloca double
store i8* %0, i8** %2
store double 0.000000e+00, double* %3
%4 = load double, double* %3
%5 = fadd double %4, 1.000000e+00
store double %5, double* %3
%6 = load double, double* %3
%7 = fmul double %6, 0x400921FB60000000
ret double %7
}

LLVM IR (-O2):
define double @func_foobar(i8* nocapture readnone %0, ...) {
ret double 0x400921FB60000000
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
char *strndup(char const *, size_t);
char *sr_strndup(const char *s, size_t n) {
  char *result = strndup(s, n);
  if (result == NULL) {
    fprintf(stderr, "satyr: out of memory");
    exit(1);
  }
  return result;
}


x86 assembly (clang, -O0):
<sr_strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strndup@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117b <sr_strndup+0x4b>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sr_strndup>:
push   %rax
call   1030 <strndup@plt>
test   %rax,%rax
je     113d <sr_strndup+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"satyr: out of memory\00"
define i8* @sr_strndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @strndup(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"satyr: out of memory\00"
define noalias i8* @sr_strndup(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @strndup(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ __fail(char *);
void __stack_chk_fail(void) { __fail("stack overflow detected; terminated"); }


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"stack overflow detected; terminated\00"
define void @__stack_chk_fail() {
%1 = call i32 @__fail(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"stack overflow detected; terminated\00"
define void @__stack_chk_fail() {
%1 = tail call i32 @__fail(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double cos(double);
double sin(double);
void sincos(double x, double *s, double *c) {
  *s = sin(x);
  *c = cos(x);
}


x86 assembly (clang, -O0):
<sincos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sincos>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,(%rbx)
movsd  (%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @sincos(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 = call double @sin(double %7)
%9 = load double*, double** %5
store double %8, double* %9
%10 = load double, double* %4
%11 = call double @cos(double %10)
%12 = load double*, double** %6
store double %11, double* %12
ret void
}

LLVM IR (-O2):
define void @sincos(double %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
%4 = tail call double @sin(double %0)
store double %4, double* %1
%5 = tail call double @cos(double %0)
store double %5, double* %2
ret void
}
/* Variables and functions */
void *Cyc_Port_var();
void *Cyc_Port_new_var(void *x) {
  void *_T0;
  _T0 = Cyc_Port_var();
  return _T0;
}


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

x86 assembly (clang, -O2):
<Cyc_Port_new_var>:
xor    %eax,%eax
jmp    1030 <Cyc_Port_var@plt>

LLVM IR (-O0):
define i8* @Cyc_Port_new_var(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i8* (...) @Cyc_Port_var()
store i8* %4, i8** %3
%5 = load i8*, i8** %3
ret i8* %5
}

LLVM IR (-O2):
define i8* @Cyc_Port_new_var(i8* nocapture readnone %0) {
%2 = tail call i8* (...) @Cyc_Port_var()
ret i8* %2
}
__attribute__((always_)) void patch_CAS_2_0_1_60_extra(void) {}


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

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

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

LLVM IR (-O2):
define void @patch_CAS_2_0_1_60_extra() {
ret void
}
/* Type definitions */
struct memorycontainer {
  int dummy;
};

/* Variables and functions */
struct memorycontainer *
createUnaryGeneralMathsExpression(struct memorycontainer *, int);
struct memorycontainer *
createASinExpression(struct memorycontainer *expression) {
  return createUnaryGeneralMathsExpression(expression, 0x0004);
}


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

x86 assembly (clang, -O2):
<createASinExpression>:
mov    $0x4,%esi
jmp    1030 <createUnaryGeneralMathsExpression@plt>

LLVM IR (-O0):
%struct.memorycontainer = type { i32 }
define %struct.memorycontainer* @createASinExpression(%struct.memorycontainer* %0) {
%2 = alloca %struct.memorycontainer*
store %struct.memorycontainer* %0, %struct.memorycontainer** %2
%3 = load %struct.memorycontainer*, %struct.memorycontainer** %2
%4 = call %struct.memorycontainer* @createUnaryGeneralMathsExpression(%struct.memorycontainer* %3, i32 4)
ret %struct.memorycontainer* %4
}

LLVM IR (-O2):
%struct.memorycontainer = type { i32 }
define %struct.memorycontainer* @createASinExpression(%struct.memorycontainer* %0) {
%2 = tail call %struct.memorycontainer* @createUnaryGeneralMathsExpression(%struct.memorycontainer* %0, i32 4)
ret %struct.memorycontainer* %2
}
/* Variables and functions */
scalar_t__ log10(double);
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *intToString(int n) {
  int c = (int)log10((double)n) + 1;
  char *b = (char *)malloc(c + 1);
  sprintf(b, "%d", n);
  return b;
}


x86 assembly (clang, -O0):
<intToString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
call   1040 <log10@plt>
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe98(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intToString>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
cvtsi2sd %edi,%xmm0
call   1040 <log10@plt>
lea    0x2(%rax),%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
lea    0xeb0(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i8* @intToString(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sitofp i32 %5 to double
%7 = call i64 @log10(double %6)
%8 = trunc i64 %7 to i32
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = load i32, i32* %2
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i8*, i8** %4
ret i8* %17
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i8* @intToString(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = tail call i64 @log10(double %2)
%4 = trunc i64 %3 to i32
%5 = add nsw i32 %4, 2
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @sprintf(i8* dereferenceable(1) %7, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* %7
}
/* Variables and functions */
int *calls_malloc();
int *test(void) {
  int *p = calls_malloc();
  *p = 42;
  return p;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <calls_malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x2a,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
xor    %eax,%eax
call   1030 <calls_malloc@plt>
movl   $0x2a,(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define i32* @test() {
%1 = alloca i32*
%2 = call i32* (...) @calls_malloc()
store i32* %2, i32** %1
%3 = load i32*, i32** %1
store i32 42, i32* %3
%4 = load i32*, i32** %1
ret i32* %4
}

LLVM IR (-O2):
define i32* @test() {
%1 = tail call i32* (...) @calls_malloc()
store i32 42, i32* %1
ret i32* %1
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int32_t boot_nv_security_counter_get(uint32_t image_id,
                                     uint32_t *security_cnt) {
  (void)image_id;
  *security_cnt = 30;
  return 0;
}


x86 assembly (clang, -O0):
<boot_nv_security_counter_get>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1e,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<boot_nv_security_counter_get>:
movl   $0x1e,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @boot_nv_security_counter_get(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
store i32 30, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @boot_nv_security_counter_get(i32 %0, i32* nocapture writeonly %1) {
store i32 30, i32* %1
ret i32 0
}
/* Variables and functions */
float sinf(float);
void __hv_sin_f(float bIn, float *bOut) { *bOut = sinf(bIn); }


x86 assembly (clang, -O0):
<__hv_sin_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sinf@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hv_sin_f>:
push   %rbx
mov    %rdi,%rbx
call   1030 <sinf@plt>
movss  %xmm0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @__hv_sin_f(float %0, float* nocapture writeonly %1) {
%3 = tail call float @sinf(float %0)
store float %3, float* %1
ret void
}
void adis16251_uninitialize_ring(struct iio_ring_buffer *ring) {}


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

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

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

LLVM IR (-O2):
%struct.iio_ring_buffer = type opaque
define void @adis16251_uninitialize_ring(%struct.iio_ring_buffer* nocapture %0) {
ret void
}