xunge/DecIR huggingface dataset:
/* Variables and functions */
int EOF;
int getch();
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ ungets(char *);
int main() {
  int c;
  char *s = "Hello World!";
  ungets(s);
  while ((c = getch()) != EOF) {
    putchar(c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <ungets@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e84(%rip),%rcx
cmp    (%rcx),%eax
je     1179 <main+0x49>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    1153 <main+0x23>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1040 <ungets@plt>
xor    %eax,%eax
call   1050 <getch@plt>
mov    0x2e9d(%rip),%rbx
cmp    (%rbx),%eax
je     1162 <main+0x32>
nop
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getch@plt>
cmp    (%rbx),%eax
jne    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World!\00"
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @ungets(i8* %4)
br label %6
6: ; preds = %10, %0
%7 = call i32 (...) @getch()
store i32 %7, i32* %2
%8 = load i32, i32* @EOF
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i32 @putchar(i32 %11)
br label %6
13: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World!\00"
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 @ungets(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getch()
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %11, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %8, %5 ], [ %2, %0 ]
%7 = tail call i32 @putchar(i32 %6)
%8 = tail call i32 (...) @getch()
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %5
11: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isbdigit(int);
void t_isbdigit_0xa6() {
  Assert_real((isbdigit(166) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isbdigit.c",
              835, ("isbdigit should be 0 for 0xa6"));
}


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

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

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xa6\00"
define void @t_isbdigit_0xa6() {
%1 = call i64 @isbdigit(i32 166)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 835, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isbdigit.c\00"
@.str.1 = [30 x i8] c"isbdigit should be 0 for 0xa6\00"
define void @t_isbdigit_0xa6() {
%1 = tail call i64 @isbdigit(i32 166)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 835, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ crash();
void foo(void) { crash(); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <crash@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @foo() {
%1 = call i32 (...) @crash()
ret void
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @crash()
ret void
}
int wav_w64_srate2blocksize(int srate_chan_product) {
  if (srate_chan_product < 12000)
    return 256;
  if (srate_chan_product < 23000)
    return 512;
  if (srate_chan_product < 44000)
    return 1024;
  return 2048;
}


x86 assembly (clang, -O0):
<wav_w64_srate2blocksize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2ee0,-0x8(%rbp)
jge    1120 <wav_w64_srate2blocksize+0x20>
movl   $0x100,-0x4(%rbp)
jmp    1159 <wav_w64_srate2blocksize+0x59>
cmpl   $0x59d8,-0x8(%rbp)
jge    1139 <wav_w64_srate2blocksize+0x39>
movl   $0x200,-0x4(%rbp)
jmp    1159 <wav_w64_srate2blocksize+0x59>
cmpl   $0xabe0,-0x8(%rbp)
jge    1152 <wav_w64_srate2blocksize+0x52>
movl   $0x400,-0x4(%rbp)
jmp    1159 <wav_w64_srate2blocksize+0x59>
movl   $0x800,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<wav_w64_srate2blocksize>:
mov    $0x100,%eax
cmp    $0x2ee0,%edi
jl     112d <wav_w64_srate2blocksize+0x2d>
mov    $0x200,%eax
cmp    $0x59d8,%edi
jb     112d <wav_w64_srate2blocksize+0x2d>
xor    %eax,%eax
cmp    $0xabe0,%edi
setae  %al
shl    $0xa,%eax
add    $0x400,%eax
ret

LLVM IR (-O0):
define i32 @wav_w64_srate2blocksize(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 12000
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 256, i32* %2
br label %16
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 23000
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 512, i32* %2
br label %16
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 44000
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 1024, i32* %2
br label %16
15: ; preds = %11
store i32 2048, i32* %2
br label %16
16: ; preds = %15, %14, %10, %6
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @wav_w64_srate2blocksize(i32 %0) {
%2 = icmp slt i32 %0, 12000
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 23000
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 44000
%7 = select i1 %6, i32 1024, i32 2048
br label %8
8: ; preds = %5, %3, %1
%9 = phi i32 [ 256, %1 ], [ 512, %3 ], [ %7, %5 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ SendCh(char);
void SendStr(char *s) {
  int i = 0;
  while (s[i] != 0) {
    SendCh(s[i++]);
  }
}


x86 assembly (clang, -O0):
<SendStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1158 <SendStr+0x48>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <SendCh@plt>
jmp    1123 <SendStr+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendStr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <SendStr+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <SendCh@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <SendStr+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @SendStr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = add nuw i64 %5, 1
%8 = tail call i32 @SendCh(i8 signext %6)
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
int isqrt(int);
void t_sqrt_143() {
  Assert_real((isqrt(143) == 11),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/stdlib/isqrt.c",
              720, ("Integer square root of 143 should be 11"));
}


x86 assembly (clang, -O0):
<t_sqrt_143>:
push   %rbp
mov    %rsp,%rbp
mov    $0x8f,%edi
call   1030 <isqrt@plt>
cmp    $0xb,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec0(%rip),%rsi
mov    $0x2d0,%edx
lea    0xf56(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_sqrt_143>:
push   %rax
mov    $0x8f,%edi
call   1030 <isqrt@plt>
xor    %edi,%edi
cmp    $0xb,%eax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x2d0,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 143 should be 11\00"
define void @t_sqrt_143() {
%1 = call i32 @isqrt(i32 143)
%2 = icmp eq i32 %1, 11
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 720, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [162 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/stdlib/isqrt.c\00"
@.str.1 = [40 x i8] c"Integer square root of 143 should be 11\00"
define void @t_sqrt_143() {
%1 = tail call i32 @isqrt(i32 143)
%2 = icmp eq i32 %1, 11
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([162 x i8], [162 x i8]* @.str, i64 0, i64 0), i32 720, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void InitBrowseLock() {}


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

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

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

LLVM IR (-O2):
define void @InitBrowseLock() {
ret void
}
/* Variables and functions */
const void *align_ptr(const void *ptr, size_t bytes) {
  return (void *)((uintptr_t)ptr & -(uintptr_t)bytes);
}


x86 assembly (clang, -O0):
<align_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align_ptr>:
mov    %rsi,%rax
neg    %rax
and    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @align_ptr(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
%7 = load i64, i64* %4
%8 = sub i64 0, %7
%9 = and i64 %6, %8
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @align_ptr(i8* %0, i64 %1) {
%3 = ptrtoint i8* %0 to i64
%4 = sub i64 0, %1
%5 = and i64 %3, %4
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
double negate(double a) { return -a; }


x86 assembly (clang, -O0):
<negate>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<negate>:
xorps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define double @negate(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fneg double %3
ret double %4
}

LLVM IR (-O2):
define double @negate(double %0) {
%2 = fneg double %0
ret double %2
}
/* Variables and functions */
short doubleToFixed(int /*<<< orphan*/);
int /*<<< orphan*/ sin(int);
short closeToFrequencyFullScaleSine(int n) {
  return doubleToFixed(sin(2 * 3.1415926535 * (60000 + 100) * n / 345));
}


x86 assembly (clang, -O0):
<closeToFrequencyFullScaleSine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xed0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xebc(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
mov    %eax,%edi
call   1030 <doubleToFixed@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeToFrequencyFullScaleSine>:
push   %rax
cvtsi2sd %edi,%xmm0
mulsd  0xed3(%rip),%xmm0
divsd  0xed3(%rip),%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sin@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <doubleToFixed@plt>

LLVM IR (-O0):
define signext i16 @closeToFrequencyFullScaleSine(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fmul double 0x41170C4DBF70011A, %4
%6 = fdiv double %5, 3.450000e+02
%7 = fptosi double %6 to i32
%8 = call i32 @sin(i32 %7)
%9 = call signext i16 @doubleToFixed(i32 %8)
ret i16 %9
}

LLVM IR (-O2):
define signext i16 @closeToFrequencyFullScaleSine(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fmul double %2, 0x41170C4DBF70011A
%4 = fdiv double %3, 3.450000e+02
%5 = fptosi double %4 to i32
%6 = tail call i32 @sin(i32 %5)
%7 = tail call signext i16 @doubleToFixed(i32 %6)
ret i16 %7
}
int put_c(void *context, char v) {
  *(*(char **)context)++ = v;
  return 1;
}


x86 assembly (clang, -O0):
<put_c>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_c>:
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
mov    %sil,(%rax)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @put_c(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i8**
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %7
store i8 %5, i8* %8
ret i32 1
}

LLVM IR (-O2):
define i32 @put_c(i8* nocapture %0, i8 signext %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %5, i8** %3
store i8 %1, i8* %4
ret i32 1
}
/* Variables and functions */
int PAPI_state(int, int *);
void papif_state__(int *EventSet, int *status, int *check) {
  *check = PAPI_state(*EventSet, status);
}


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

x86 assembly (clang, -O2):
<papif_state__>:
push   %rbx
mov    %rdx,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_state@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @papif_state__(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = load i32*, i32** %5
%10 = call i32 @PAPI_state(i32 %8, i32* %9)
%11 = load i32*, i32** %6
store i32 %10, i32* %11
ret void
}

LLVM IR (-O2):
define void @papif_state__(i32* nocapture %0, i32* %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %0
%5 = tail call i32 @PAPI_state(i32 %4, i32* %1)
store i32 %5, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
void test_print_float_error(int expect, int actual) {
  fprintf(stderr, "Error: expected 0x%08x but was 0x%08x\n", expect, actual);
}


x86 assembly (clang, -O0):
<test_print_float_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_print_float_error>:
mov    %esi,%ecx
mov    %edi,%edx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"Error: expected 0x%08x but was 0x%08x\0A\00"
define void @test_print_float_error(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"Error: expected 0x%08x but was 0x%08x\0A\00"
define void @test_print_float_error(i32 %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
unsigned long mul_32_32(const unsigned long arg1, const unsigned long arg2) {
  int retval;
  asm volatile("mull %2; movl %%edx,%%eax"
               : "=a"(retval)
               : "0"(arg1), "g"(arg2)
               : "dx");
  return retval;
}


x86 assembly (clang, -O0):
<mul_32_32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,-0x20(%rbp)
mull   -0x20(%rbp)
mov    %edx,%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i64 @mul_32_32(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i64 asm sideeffect "mull $2; movl %edx,%eax", "={ax},0,imr,~{dx},~{dirflag},~{fpsr},~{flags}"(i64 %6, i64 %7)
%9 = trunc i64 %8 to i32
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
ret i64 %11
}

LLVM IR (-O2):
/* Variables and functions */
void *WTSVirtualChannelOpenEx(unsigned int, char const *, int /*<<< orphan*/);
void *WTSVirtualChannelOpen(void *hServer, unsigned int SessionId,
                            const char *pVirtualName) {
  if (hServer != 0x00000000) {
    return 0;
  }
  return WTSVirtualChannelOpenEx(SessionId, pVirtualName, 0);
}


x86 assembly (clang, -O0):
<WTSVirtualChannelOpen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113b <WTSVirtualChannelOpen+0x2b>
movq   $0x0,-0x8(%rbp)
jmp    114d <WTSVirtualChannelOpen+0x3d>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
xor    %edx,%edx
call   1030 <WTSVirtualChannelOpenEx@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WTSVirtualChannelOpen>:
test   %rdi,%rdi
je     1118 <WTSVirtualChannelOpen+0x8>
xor    %eax,%eax
ret
mov    %esi,%edi
mov    %rdx,%rsi
xor    %edx,%edx
jmp    1030 <WTSVirtualChannelOpenEx@plt>

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

LLVM IR (-O2):
define i8* @WTSVirtualChannelOpen(i8* readnone %0, i32 %1, i8* %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i8* @WTSVirtualChannelOpenEx(i32 %1, i8* %2, i32 0)
br label %7
7: ; preds = %3, %5
%8 = phi i8* [ %6, %5 ], [ null, %3 ]
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ Sys_LeaveCriticalSectionInternal(int);
void Sys_LeaveCriticalSection(int section) {
  Sys_LeaveCriticalSectionInternal(section);
}


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

x86 assembly (clang, -O2):
<Sys_LeaveCriticalSection>:
jmp    1030 <Sys_LeaveCriticalSectionInternal@plt>

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

LLVM IR (-O2):
define void @Sys_LeaveCriticalSection(i32 %0) {
%2 = tail call i32 @Sys_LeaveCriticalSectionInternal(i32 %0)
ret void
}
/* Variables and functions */
int second();
int first() { return second(); }


x86 assembly (clang, -O0):
<first>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <second@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @first() {
%1 = call i32 (...) @second()
ret i32 %1
}

LLVM IR (-O2):
define i32 @first() {
%1 = tail call i32 (...) @second()
ret i32 %1
}
/* Variables and functions */
int cond_read_lock(int *);
int /*<<< orphan*/ wait_read_lock(int *);
int render_get_read_lock(int animflag, int *p_lock) {
  if (animflag)
    return cond_read_lock(p_lock);
  wait_read_lock(p_lock);
  return 1;
}


x86 assembly (clang, -O0):
<render_get_read_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     114a <render_get_read_lock+0x2a>
mov    -0x10(%rbp),%rdi
call   1040 <cond_read_lock@plt>
mov    %eax,-0x4(%rbp)
jmp    115a <render_get_read_lock+0x3a>
mov    -0x10(%rbp),%rdi
call   1030 <wait_read_lock@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render_get_read_lock>:
test   %edi,%edi
je     112c <render_get_read_lock+0xc>
mov    %rsi,%rdi
jmp    1040 <cond_read_lock@plt>
push   %rax
mov    %rsi,%rdi
call   1030 <wait_read_lock@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @render_get_read_lock(i32 %0, i32* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @cond_read_lock(i32* %1)
br label %8
6: ; preds = %2
%7 = tail call i32 @wait_read_lock(i32* %1)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ %5, %4 ], [ 1, %6 ]
ret i32 %9
}
int evdns_request_len(const int name_len) { return 96 + name_len + 2 + 4; }


x86 assembly (clang, -O0):
<evdns_request_len>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%eax
add    $0x2,%eax
add    $0x4,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @evdns_request_len(i32 %0) {
%2 = add nsw i32 %0, 102
ret i32 %2
}
void *memcpy(void *dest, const void *src, unsigned n) {
  int t0, t1, t2;
  __asm__ __volatile__("cld\n"
                       "rep; movsl\n"
                       "testb $2,%b4\n"
                       "je 1f\n"
                       "movsw\n"
                       "1: testb $1,%b4\n"
                       "je 2f\n"
                       "movsb\n"
                       "2:"
                       : "=&c"(t0), "=&D"(t1), "=&S"(t2)
                       : "0"(n / 4), "q"(n), "1"((long)dest), "2"((long)src)
                       : "memory");
  return dest;
}


x86 assembly (clang, -O0):
<memcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
shr    $0x2,%ecx
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
cld
rep movsl %ds:(%rsi),%es:(%rdi)
test   $0x2,%al
je     112d <memcpy+0x2d>
movsw  %ds:(%rsi),%es:(%rdi)
test   $0x1,%al
je     1136 <memcpy+0x36>
movsb  %ds:(%rsi),%es:(%rdi)
mov    %ecx,-0x18(%rbp)
mov    %edi,%eax
mov    %eax,-0x1c(%rbp)
mov    %esi,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memcpy>:
mov    %rdi,%rax
mov    %edx,%ecx
shr    $0x2,%ecx
cld
rep movsl %ds:(%rsi),%es:(%rdi)
test   $0x2,%dl
je     1112 <memcpy+0x12>
movsw  %ds:(%rsi),%es:(%rdi)
test   $0x1,%dl
je     1118 <memcpy+0x18>
movsb  %ds:(%rsi),%es:(%rdi)
ret

LLVM IR (-O0):
define i8* @memcpy(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%10 = load i32, i32* %6
%11 = udiv i32 %10, 4
%12 = load i32, i32* %6
%13 = load i8*, i8** %4
%14 = ptrtoint i8* %13 to i64
%15 = load i8*, i8** %5
%16 = ptrtoint i8* %15 to i64
%17 = call { i32, i64, i64 } asm sideeffect "cld\0Arep; movsl\0Atestb $$2,${4:b}\0Aje 1f\0Amovsw\0A1: testb $$1,${4:b}\0Aje 2f\0Amovsb\0A2:", "=&{cx},=&{di},=&{si},0,q,1,2,~{memory},~{dirflag},~{fpsr},~{flags}"(i32 %11, i32 %12, i64 %14, i64 %16)
%18 = extractvalue { i32, i64, i64 } %17, 0
%19 = extractvalue { i32, i64, i64 } %17, 1
%20 = extractvalue { i32, i64, i64 } %17, 2
store i32 %18, i32* %7
%21 = trunc i64 %19 to i32
store i32 %21, i32* %8
%22 = trunc i64 %20 to i32
store i32 %22, i32* %9
%23 = load i8*, i8** %4
ret i8* %23
}

LLVM IR (-O2):
define i8* @memcpy(i8* returned %0, i8* %1, i32 %2) {
%4 = lshr i32 %2, 2
%5 = ptrtoint i8* %0 to i64
%6 = ptrtoint i8* %1 to i64
%7 = tail call { i32, i64, i64 } asm sideeffect "cld\0Arep; movsl\0Atestb $$2,${4:b}\0Aje 1f\0Amovsw\0A1: testb $$1,${4:b}\0Aje 2f\0Amovsb\0A2:", "=&{cx},=&{di},=&{si},0,q,1,2,~{memory},~{dirflag},~{fpsr},~{flags}"(i32 %4, i32 %2, i64 %5, i64 %6)
ret i8* %0
}
float _dedx_max(float a, float b) {
  if (a > b)
    return a;
  return b;
}


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

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

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

LLVM IR (-O2):
define float @_dedx_max(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
long long GetVote(long long i) { return i < 50LL ? 0LL : 1LL; }


x86 assembly (clang, -O0):
<GetVote>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x32,%rdx
cmovl  %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetVote>:
xor    %eax,%eax
cmp    $0x32,%rdi
setge  %al
ret

LLVM IR (-O0):
define i64 @GetVote(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp slt i64 %3, 50
%5 = zext i1 %4 to i64
%6 = select i1 %4, i64 0, i64 1
ret i64 %6
}

LLVM IR (-O2):
define i64 @GetVote(i64 %0) {
%2 = icmp sgt i64 %0, 49
%3 = zext i1 %2 to i64
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ add_entry(char const *, char const *);
void list_add(const char *firstname, const char *lastname) {
  add_entry(firstname, lastname);
}


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

x86 assembly (clang, -O2):
<list_add>:
jmp    1030 <add_entry@plt>

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

LLVM IR (-O2):
define void @list_add(i8* %0, i8* %1) {
%3 = tail call i32 @add_entry(i8* %0, i8* %1)
ret void
}
void snd_usb_autosuspend(struct snd_usb_audio *chip) {}


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

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

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

LLVM IR (-O2):
%struct.snd_usb_audio = type opaque
define void @snd_usb_autosuspend(%struct.snd_usb_audio* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hostcall_test_func_hostcall_error();
int main(void) {
  hostcall_test_func_hostcall_error();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @hostcall_test_func_hostcall_error()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() { printf("usage: lpc2k_pgm <port> <ihex-file>\n"); }


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"usage: lpc2k_pgm <port> <ihex-file>\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"usage: lpc2k_pgm <port> <ihex-file>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret void
}
__attribute__((returns_nonnull)) int *ret_nonnull(int *a) { return a; }


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

x86 assembly (clang, -O2):
<ret_nonnull>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i32* @ret_nonnull(i32* readnone returned %0) {
ret i32* %0
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int);
int /*<<< orphan*/ sleep(int);
______(int *_) { (*_) != '\0' ? putchar(*_), ______(++_) : sleep(1); }


x86 assembly (clang, -O0):
<______>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
je     116a <______+0x3a>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rdi
add    $0x4,%rdi
mov    %rdi,-0x10(%rbp)
call   1040 <______@plt>
jmp    1174 <______+0x44>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<______>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
test   %edi,%edi
je     113f <______+0x1f>
add    $0x4,%rbx
xchg   %ax,%ax
call   1030 <putchar@plt>
mov    (%rbx),%edi
add    $0x4,%rbx
test   %edi,%edi
jne    1130 <______+0x10>
mov    $0x1,%edi
pop    %rbx
jmp    1040 <sleep@plt>

LLVM IR (-O0):
define i32 @______(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = call i32 @putchar(i32 %9)
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i32 1
store i32* %12, i32** %3
%13 = call i32 @______(i32* %12)
br label %16
14: ; preds = %1
%15 = call i32 @sleep(i32 1)
br label %16
16: ; preds = %14, %7
%17 = phi i32 [ %13, %7 ], [ %15, %14 ]
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @______(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %9, %4 ], [ %2, %1 ]
%6 = phi i32* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @putchar(i32 %5)
%8 = getelementptr inbounds i32, i32* %6, i64 1
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = tail call i32 @sleep(i32 1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void printSyntax(char *argv0) {
  fprintf(stderr, "Syntax: %s [mode] <seq-lenght> <chars-set>\n", argv0);
  fprintf(stderr,
          "\t[mode]:\t\t1 = Write to file\n\t\t\t2 = Calcs only\n"
          "\t<seq-lenght>:\tset sequence lenght (integer)\n"
          "\t<chars-set>:\tS = set SHORT set of chars [a-z,A-Z,0-9]\n\t\t\tF = "
          "set FULL set of chars (default)\n\t\t\tP = set PERSONALIZED set of "
          "chars from file\n");
}


x86 assembly (clang, -O0):
<printSyntax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xee5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSyntax>:
push   %rbx
mov    %rdi,%rdx
mov    0x2ec5(%rip),%rbx
mov    (%rbx),%edi
lea    0xedc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xef8(%rip),%rsi
xor    %eax,%eax
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"Syntax: %s [mode] <seq-lenght> <chars-set>\0A\00"
@.str.1 = [233 x i8] c"\09[mode]:\09\091 = Write to file\0A\09\09\092 = Calcs only\0A\09<seq-lenght>:\09set sequence lenght (integer)\0A\09<chars-set>:\09S = set SHORT set of chars [a-z,A-Z,0-9]\0A\09\09\09F = set FULL set of chars (default)\0A\09\09\09P = set PERSONALIZED set of chars from file\0A\00"
define void @printSyntax(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([233 x i8], [233 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"Syntax: %s [mode] <seq-lenght> <chars-set>\0A\00"
@.str.1 = [233 x i8] c"\09[mode]:\09\091 = Write to file\0A\09\09\092 = Calcs only\0A\09<seq-lenght>:\09set sequence lenght (integer)\0A\09<chars-set>:\09S = set SHORT set of chars [a-z,A-Z,0-9]\0A\09\09\09F = set FULL set of chars (default)\0A\09\09\09P = set PERSONALIZED set of chars from file\0A\00"
define void @printSyntax(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([233 x i8], [233 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
struct sembuf {
  int member_1;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int semop(int, struct sembuf *, int);
int sem_p(int semid) {
  int ret;
  struct sembuf sb = {0, -1, 0};
  ret = semop(semid, &sb, 1);
  return ret;
}


x86 assembly (clang, -O0):
<sem_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0xede(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xedc(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1030 <semop@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_p>:
sub    $0x18,%rsp
mov    0xeee(%rip),%eax
mov    %eax,0x10(%rsp)
mov    0xedb(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    $0x1,%edx
call   1030 <semop@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.sembuf = type { i32, i32, i32 }
@__const.sem_p.sb = %struct.sembuf { i32 0, i32 -1, i32 0 }
define i32 @sem_p(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.sembuf
store i32 %0, i32* %2
%5 = bitcast %struct.sembuf* %4 to i8*
%6 = load i32, i32* %2
%7 = call i32 @semop(i32 %6, %struct.sembuf* %4, i32 1)
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
%struct.sembuf = type { i32, i32, i32 }
@__const.sem_p.sb = %struct.sembuf { i32 0, i32 -1, i32 0 }
define i32 @sem_p(i32 %0) {
%2 = alloca %struct.sembuf
%3 = bitcast %struct.sembuf* %2 to i8*
%4 = call i32 @semop(i32 %0, %struct.sembuf* %2, i32 1)
ret i32 %4
}
int mystrlen(char *str) {
  int len = 0;
  while (str[len++] != '\0')
    ;
  return --len;
}


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

x86 assembly (clang, -O2):
<mystrlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <mystrlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @mystrlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %4, %2 ], [ 0, %1 ]
%4 = add nuw i64 %3, 1
%5 = getelementptr inbounds i8, i8* %0, i64 %3
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
int test_imm_8Bint64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x8B << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_8Bint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 597000454144
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getfloat(double *);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  double i;
  while (getfloat(&i) != EOF) {
    printf("i:\t%f\n", i);
  }
  printf("main is done, i: %f", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <getfloat@plt>
mov    0x2ea9(%rip),%rcx
cmp    (%rcx),%rax
je     115e <main+0x3e>
movsd  -0x10(%rbp),%xmm0
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
movsd  -0x10(%rbp),%xmm0
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rdi
call   1040 <getfloat@plt>
mov    0x2eae(%rip),%r15
cmp    (%r15),%rax
je     116b <main+0x4b>
lea    0xeba(%rip),%r14
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movsd  0x8(%rsp),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <getfloat@plt>
cmp    (%r15),%rax
jne    1150 <main+0x30>
movsd  0x8(%rsp),%xmm0
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@EOF = global i64 0
@.str = [7 x i8] c"i:\09%f\0A\00"
@.str.1 = [20 x i8] c"main is done, i: %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
br label %3
3: ; preds = %7, %0
%4 = call i64 @getfloat(double* %2)
%5 = load i64, i64* @EOF
%6 = icmp ne i64 %4, %5
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load double, double* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %8)
br label %3
10: ; preds = %3
%11 = load double, double* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %11)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [7 x i8] c"i:\09%f\0A\00"
@.str.1 = [20 x i8] c"main is done, i: %f\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i64 @getfloat(double* %1)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = load double, double* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %7)
%9 = call i64 @getfloat(double* %1)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %0
%13 = load double, double* %1
%14 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %13)
ret i32 0
}
/* Variables and functions */
int external_shared();
int external_shared_via_proxy(void) { return external_shared(); }


x86 assembly (clang, -O0):
<external_shared_via_proxy>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <external_shared@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @external_shared_via_proxy() {
%1 = call i32 (...) @external_shared()
ret i32 %1
}

LLVM IR (-O2):
define i32 @external_shared_via_proxy() {
%1 = tail call i32 (...) @external_shared()
ret i32 %1
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *my_strdup(const char *s) {
  char *p = malloc(strlen(s) + 1);
  if (p) {
    strcpy(p, s);
  }
  return p;
}


x86 assembly (clang, -O0):
<my_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116d <my_strdup+0x3d>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1158 <my_strdup+0x28>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @my_strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @strcpy(i8* %4, i8* %0)
br label %8
8: ; preds = %6, %1
ret i8* %4
}
/* Type definitions */
struct comp {
  int dummy;
};
struct BrzFalseVariable_ {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SEND_ACKDOWN(int /*<<< orphan*/);
void BrzFalseVariable_ackdown(struct comp *comp, int port) {
  struct BrzFalseVariable_ *c = (struct BrzFalseVariable_ *)comp;
  SEND_ACKDOWN(0);
}


x86 assembly (clang, -O0):
<BrzFalseVariable_ackdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
call   1030 <SEND_ACKDOWN@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BrzFalseVariable_ackdown>:
xor    %edi,%edi
jmp    1030 <SEND_ACKDOWN@plt>

LLVM IR (-O0):
%struct.comp = type { i32 }
%struct.BrzFalseVariable_ = type { i32 }
define void @BrzFalseVariable_ackdown(%struct.comp* %0, i32 %1) {
%3 = alloca %struct.comp*
%4 = alloca i32
%5 = alloca %struct.BrzFalseVariable_*
store %struct.comp* %0, %struct.comp** %3
store i32 %1, i32* %4
%6 = load %struct.comp*, %struct.comp** %3
%7 = bitcast %struct.comp* %6 to %struct.BrzFalseVariable_*
store %struct.BrzFalseVariable_* %7, %struct.BrzFalseVariable_** %5
%8 = call i32 @SEND_ACKDOWN(i32 0)
ret void
}

LLVM IR (-O2):
%struct.comp = type { i32 }
define void @BrzFalseVariable_ackdown(%struct.comp* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @SEND_ACKDOWN(i32 0)
ret void
}