xunge/DecIR huggingface dataset:
int countLeadingChars(char *s, char c) {
  int count = 0;
  while (*s++ == c)
    ++count;
  return count;
}


x86 assembly (clang, -O0):
<countLeadingChars>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1141 <countLeadingChars+0x41>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1115 <countLeadingChars+0x15>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<countLeadingChars>:
xor    %eax,%eax
cmp    %sil,(%rdi)
jne    111e <countLeadingChars+0x1e>
xor    %eax,%eax
nopl   0x0(%rax)
mov    %rax,%rcx
add    $0x1,%rax
cmp    %sil,0x1(%rdi,%rcx,1)
je     1110 <countLeadingChars+0x10>
ret

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

LLVM IR (-O2):
define i32 @countLeadingChars(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, %1
br i1 %4, label %5, label %12
5: ; preds = %2, %5
%6 = phi i32 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8* [ %8, %5 ], [ %0, %2 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = add nuw nsw i32 %6, 1
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, %1
br i1 %11, label %5, label %12
12: ; preds = %5, %2
%13 = phi i32 [ 0, %2 ], [ %9, %5 ]
ret i32 %13
}
int f9(struct { enum e { a = 1 } b; } c) { return a; }


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

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

LLVM IR (-O0):
%struct.anon = type { i32 }
define i32 @f9(i32 %0) {
%2 = alloca %struct.anon
%3 = getelementptr inbounds %struct.anon, %struct.anon* %2, i32 0, i32 0
store i32 %0, i32* %3
ret i32 1
}

LLVM IR (-O2):
define i32 @f9(i32 %0) {
ret i32 1
}
int foo(void) { return 3; }


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

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

LLVM IR (-O0):
define i32 @foo() {
ret i32 3
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 3
}
/* Type definitions */
struct buffer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ shrink(struct buffer *, size_t, size_t);
void delbuf(struct buffer *fb, size_t a1, size_t a2) {
  shrink(fb, a1 - 1, a2 - a1 + 1);
}


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

x86 assembly (clang, -O2):
<delbuf>:
sub    %rsi,%rdx
add    $0xffffffffffffffff,%rsi
add    $0x1,%rdx
jmp    1030 <shrink@plt>

LLVM IR (-O0):
%struct.buffer = type { i32 }
define void @delbuf(%struct.buffer* %0, i64 %1, i64 %2) {
%4 = alloca %struct.buffer*
%5 = alloca i64
%6 = alloca i64
store %struct.buffer* %0, %struct.buffer** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load %struct.buffer*, %struct.buffer** %4
%8 = load i64, i64* %5
%9 = sub i64 %8, 1
%10 = load i64, i64* %6
%11 = load i64, i64* %5
%12 = sub i64 %10, %11
%13 = add i64 %12, 1
%14 = call i32 @shrink(%struct.buffer* %7, i64 %9, i64 %13)
ret void
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define void @delbuf(%struct.buffer* %0, i64 %1, i64 %2) {
%4 = add i64 %1, -1
%5 = sub i64 1, %1
%6 = add i64 %5, %2
%7 = tail call i32 @shrink(%struct.buffer* %0, i64 %4, i64 %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ fpos_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fsetpos(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void crash_fsetpos() {
  FILE *f;
  fpos_t position;
  f = fopen("this_file_doesnt_exist", "r");
  fsetpos(f, &position);
  fclose(f);
}


x86 assembly (clang, -O0):
<crash_fsetpos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <fsetpos@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crash_fsetpos>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0xed4(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
lea    0xc(%rsp),%rsi
mov    %rax,%rdi
call   1050 <fsetpos@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @crash_fsetpos() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = call i32 @fsetpos(i32* %4, i32* %2)
%6 = load i32*, i32** %1
%7 = call i32 @fclose(i32* %6)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @crash_fsetpos() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @fsetpos(i32* %3, i32* %1)
%5 = call i32 @fclose(i32* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ log(int /*<<< orphan*/);
int /*<<< orphan*/ popNumber();
int /*<<< orphan*/ pushNumber(int /*<<< orphan*/);
void basLog() { pushNumber(log(popNumber())); }


x86 assembly (clang, -O0):
<basLog>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <popNumber@plt>
mov    %eax,%edi
call   1030 <log@plt>
mov    %eax,%edi
call   1040 <pushNumber@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<basLog>:
push   %rax
xor    %eax,%eax
call   1050 <popNumber@plt>
mov    %eax,%edi
call   1030 <log@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <pushNumber@plt>

LLVM IR (-O0):
define void @basLog() {
%1 = call i32 (...) @popNumber()
%2 = call i32 @log(i32 %1)
%3 = call i32 @pushNumber(i32 %2)
ret void
}

LLVM IR (-O2):
define void @basLog() {
%1 = tail call i32 (...) @popNumber()
%2 = tail call i32 @log(i32 %1)
%3 = tail call i32 @pushNumber(i32 %2)
ret void
}
signed int si_round(double d) {
  if (d < 0) {
    return (signed int)(d - 0.5);
  } else {
    return (signed int)(d + 0.5);
  }
}


x86 assembly (clang, -O0):
<si_round>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1134 <si_round+0x34>
movsd  -0x10(%rbp),%xmm0
movsd  0xedc(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    1148 <si_round+0x48>
movsd  0xec4(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<si_round>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @si_round(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fsub double %7, 5.000000e-01
%9 = fptosi double %8 to i32
store i32 %9, i32* %2
br label %14
10: ; preds = %1
%11 = load double, double* %3
%12 = fadd double %11, 5.000000e-01
%13 = fptosi double %12 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @si_round(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = select i1 %2, double -5.000000e-01, double 5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i32
ret i32 %5
}
unsigned short unsignedshort_ignoring_unsignedlong(unsigned short x,
                                                   unsigned long y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedshort_ignoring_unsignedlong>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i16 @unsignedshort_ignoring_unsignedlong(i16 returned zeroext %0, i64 %1) {
ret i16 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
uint16_t rand_uint16(void) {
  static int n = 0;
  if (n == 0) {
    srand((unsigned)time(NULL));
    n = 100;
  }
  return (uint16_t)(rand() & 0xffff);
}


x86 assembly (clang, -O0):
<rand_uint16>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2f01(%rip)
jne    115b <rand_uint16+0x2b>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x64,0x2ee1(%rip)
mov    $0x0,%al
call   1050 <rand@plt>
and    $0xffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_uint16>:
push   %rax
cmpb   $0x0,0x2f04(%rip)
jne    114f <rand_uint16+0x1f>
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movb   $0x1,0x2eed(%rip)
xor    %eax,%eax
call   1050 <rand@plt>
movzwl %ax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@rand_uint16.n = internal global i32 0
define i32 @rand_uint16() {
%1 = load i32, i32* @rand_uint16.n
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = call i64 @time(i32* null)
%5 = trunc i64 %4 to i32
%6 = call i32 @srand(i32 %5)
store i32 100, i32* @rand_uint16.n
br label %7
7: ; preds = %3, %0
%8 = call i32 (...) @rand()
%9 = and i32 %8, 65535
ret i32 %9
}

LLVM IR (-O2):
@rand_uint16.n = internal unnamed_addr global i1 false
define i32 @rand_uint16() {
%1 = load i1, i1* @rand_uint16.n
br i1 %1, label %6, label %2
2: ; preds = %0
%3 = tail call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @srand(i32 %4)
store i1 true, i1* @rand_uint16.n
br label %6
6: ; preds = %2, %0
%7 = tail call i32 (...) @rand()
%8 = and i32 %7, 65535
ret i32 %8
}
decreqtparm(pn) int pn;
{ brc(pn, 'x'); }


x86 assembly (clang, -O0):
<decreqtparm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x78,%esi
mov    $0x0,%al
call   1030 <brc@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decreqtparm>:
mov    $0x78,%esi
xor    %eax,%eax
jmp    1030 <brc@plt>

LLVM IR (-O0):
define i32 @decreqtparm(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 (i32, i32, ...) bitcast (i32 (...)* @brc to i32 (i32, i32, ...)*)(i32 %4, i32 120)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @decreqtparm(i32 %0) {
%2 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @brc to i32 (i32, i32, ...)*)(i32 %0, i32 120)
ret i32 undef
}
/* Variables and functions */
double gegl_floor(double);
double gegl_fmod(double x, double y) { return x - y * gegl_floor(x / y); }


x86 assembly (clang, -O0):
<gegl_fmod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <gegl_floor@plt>
movsd  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gegl_fmod>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
divsd  %xmm1,%xmm0
call   1030 <gegl_floor@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @gegl_fmod(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 = load double, double* %3
%8 = load double, double* %4
%9 = fdiv double %7, %8
%10 = call double @gegl_floor(double %9)
%11 = fneg double %6
%12 = call double @llvm.fmuladd.f64(double %11, double %10, double %5)
ret double %12
}

LLVM IR (-O2):
define double @gegl_fmod(double %0, double %1) {
%3 = fdiv double %0, %1
%4 = tail call double @gegl_floor(double %3)
%5 = fneg double %1
%6 = tail call double @llvm.fmuladd.f64(double %5, double %4, double %0)
ret double %6
}
char _sub_90(char orientation) {
  char value = orientation - 16;
  if (value > 0)
    return value;
  else
    return (char)0;
}


x86 assembly (clang, -O0):
<_sub_90>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
sub    $0x10,%eax
mov    %al,-0x3(%rbp)
movsbl -0x3(%rbp),%eax
cmp    $0x0,%eax
jle    112c <_sub_90+0x2c>
mov    -0x3(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    1130 <_sub_90+0x30>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sub_90>:
xor    %ecx,%ecx
add    $0xf0,%dil
movzbl %dil,%eax
cmovs  %ecx,%eax
ret

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

LLVM IR (-O2):
define signext i8 @_sub_90(i8 signext %0) {
%2 = add i8 %0, -16
%3 = icmp sgt i8 %2, 0
%4 = select i1 %3, i8 %2, i8 0
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void print_usage_and_exit(char **argv) {
  printf("Usage: %s -t #trials -a <mcs|central> [-n #threads]\n", argv[0]);
  exit(-1);
}


x86 assembly (clang, -O0):
<print_usage_and_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_usage_and_exit>:
push   %rax
mov    (%rdi),%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"Usage: %s -t #trials -a <mcs|central> [-n #threads]\0A\00"
define void @print_usage_and_exit(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [53 x i8] c"Usage: %s -t #trials -a <mcs|central> [-n #threads]\0A\00"
define void @print_usage_and_exit(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Pop();
void DoDrop() { Pop(); }


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

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

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

LLVM IR (-O2):
define void @DoDrop() {
%1 = tail call i32 (...) @Pop()
ret void
}
adrreg0regx1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{
  if ((p0[10000000]) <= (p1[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adrreg0regx1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2625a00(%rax),%eax
mov    -0x28(%rbp),%rcx
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jg     113f <adrreg0regx1+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    1146 <adrreg0regx1+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0regx1>:
mov    0x2625a00(%r8),%edx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    (%r9,%rcx,4),%edx
setle  %al
ret

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

LLVM IR (-O2):
define i32 @adrreg0regx1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture %4, i32* nocapture %5) {
%7 = getelementptr inbounds i32, i32* %4, i64 10000000
%8 = load i32, i32* %7
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i32, i32* %5, i64 %9
%11 = load i32, i32* %10
%12 = icmp sle i32 %8, %11
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int missingNumber(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int nums[4] = {0, 4, 3, 1};
  printf("%d\n", missingNumber(nums, 4));
  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,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
call   1040 <missingNumber@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
call   1040 <missingNumber@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.nums = [4 x i32] [i32 0, i32 4, i32 3, i32 1]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
store i32 0, i32* %1
%3 = bitcast [4 x i32]* %2 to i8*
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%5 = call i32 @missingNumber(i32* %4, i32 4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.nums = [4 x i32] [i32 0, i32 4, i32 3, i32 1]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @missingNumber(i32* %3, i32 4)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
typedef size_t uint16_t;
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
uint16_t updateq(int16_t *xq, int16_t *in, uint16_t xi, uint16_t l) {
  xq[xi] = xq[xi + l] = *in;
  return (--xi) & (l - 1);
}


x86 assembly (clang, -O0):
<updateq>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
add    -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<updateq>:
mov    (%rsi),%eax
lea    (%rcx,%rdx,1),%rsi
mov    %eax,(%rdi,%rsi,4)
mov    %eax,(%rdi,%rdx,4)
add    $0xffffffffffffffff,%rdx
lea    -0x1(%rcx),%rax
and    %rdx,%rax
ret

LLVM IR (-O0):
define i64 @updateq(i32* %0, i32* %1, i64 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i64
store i32* %0, i32** %5
store i32* %1, i32** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
%11 = load i32*, i32** %5
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = add i64 %12, %13
%15 = getelementptr inbounds i32, i32* %11, i64 %14
store i32 %10, i32* %15
%16 = load i32*, i32** %5
%17 = load i64, i64* %7
%18 = getelementptr inbounds i32, i32* %16, i64 %17
store i32 %10, i32* %18
%19 = load i64, i64* %7
%20 = add i64 %19, -1
store i64 %20, i64* %7
%21 = load i64, i64* %8
%22 = sub i64 %21, 1
%23 = and i64 %20, %22
ret i64 %23
}

LLVM IR (-O2):
define i64 @updateq(i32* nocapture writeonly %0, i32* nocapture %1, i64 %2, i64 %3) {
%5 = load i32, i32* %1
%6 = add i64 %3, %2
%7 = getelementptr inbounds i32, i32* %0, i64 %6
store i32 %5, i32* %7
%8 = getelementptr inbounds i32, i32* %0, i64 %2
store i32 %5, i32* %8
%9 = add i64 %2, -1
%10 = add i64 %3, -1
%11 = and i64 %10, %9
ret i64 %11
}
/* Type definitions */
struct net_device {
  int dummy;
};
struct ethtool_drvinfo {
  int /*<<< orphan*/ driver;
};

/* Variables and functions */
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
void str9100_get_drvinfo(struct net_device *netdev,
                         struct ethtool_drvinfo *info) {
  strcpy(info->driver, "str9100 test");
}


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

x86 assembly (clang, -O2):
mov    (%rsi),%edi
lea    0xee7(%rip),%rsi
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
%struct.net_device = type { i32 }
%struct.ethtool_drvinfo = type { i32 }
@.str = [13 x i8] c"str9100 test\00"
define void @str9100_get_drvinfo(%struct.net_device* %0, %struct.ethtool_drvinfo* %1) {
%3 = alloca %struct.net_device*
%4 = alloca %struct.ethtool_drvinfo*
store %struct.net_device* %0, %struct.net_device** %3
store %struct.ethtool_drvinfo* %1, %struct.ethtool_drvinfo** %4
%5 = load %struct.ethtool_drvinfo*, %struct.ethtool_drvinfo** %4
%6 = getelementptr inbounds %struct.ethtool_drvinfo, %struct.ethtool_drvinfo* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = call i32 @strcpy(i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.net_device = type { i32 }
%struct.ethtool_drvinfo = type { i32 }
@.str = [13 x i8] c"str9100 test\00"
define void @str9100_get_drvinfo(%struct.net_device* nocapture readnone %0, %struct.ethtool_drvinfo* nocapture %1) {
%3 = getelementptr inbounds %struct.ethtool_drvinfo, %struct.ethtool_drvinfo* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = tail call i32 @strcpy(i32 %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct video_still_picture {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ VIDEO_STILLPICTURE;
int ioctl(int, int /*<<< orphan*/, struct video_still_picture *);
int /*<<< orphan*/ perror(char *);
int videoStillPicture(int fd, struct video_still_picture *sp) {
  int ans;
  if ((ans = ioctl(fd, VIDEO_STILLPICTURE, sp)) < 0) {
    perror("VIDEO STILLPICTURE: ");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<videoStillPicture>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1168 <videoStillPicture+0x48>
lea    0xea9(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    116f <videoStillPicture+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<videoStillPicture>:
push   %rax
mov    %rsi,%rdx
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
call   1030 <ioctl@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
js     113c <videoStillPicture+0x1c>
pop    %rcx
ret
lea    0xebd(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.video_still_picture = type { i32 }
@VIDEO_STILLPICTURE = global i32 0
@.str = [21 x i8] c"VIDEO STILLPICTURE: \00"
define i32 @videoStillPicture(i32 %0, %struct.video_still_picture* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.video_still_picture*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.video_still_picture* %1, %struct.video_still_picture** %5
%7 = load i32, i32* %4
%8 = load i32, i32* @VIDEO_STILLPICTURE
%9 = load %struct.video_still_picture*, %struct.video_still_picture** %5
%10 = call i32 @ioctl(i32 %7, i32 %8, %struct.video_still_picture* %9)
store i32 %10, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %15
14: ; preds = %2
store i32 0, i32* %3
br label %15
15: ; preds = %14, %12
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
%struct.video_still_picture = type { i32 }
@VIDEO_STILLPICTURE = global i32 0
@.str = [21 x i8] c"VIDEO STILLPICTURE: \00"
define i32 @videoStillPicture(i32 %0, %struct.video_still_picture* %1) {
%3 = load i32, i32* @VIDEO_STILLPICTURE
%4 = tail call i32 @ioctl(i32 %0, i32 %3, %struct.video_still_picture* %1)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ -1, %6 ], [ 0, %2 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t ltoh_u32(uint32_t littleval) { return littleval; }


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

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

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

LLVM IR (-O2):
define i32 @ltoh_u32(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ f1(char, int, int, int, int);
void f2() {
  int a, m, c;
  for (c = 2048; c; c--) {
    char b = a++;
    f1(b, m, m + 1, m + 2, m + 3);
    m += 4;
  }
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x800,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1170 <f2+0x60>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
mov    -0x8(%rbp),%r8d
add    $0x3,%r8d
movsbl %al,%edi
call   1030 <f1@plt>
mov    -0x8(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <f2+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @f2() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 2048, i32* %3
br label %5
5: ; preds = %23, %0
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
%11 = trunc i32 %9 to i8
store i8 %11, i8* %4
%12 = load i8, i8* %4
%13 = load i32, i32* %2
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 2
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 3
%20 = call i32 @f1(i8 signext %12, i32 %13, i32 %15, i32 %17, i32 %19)
%21 = load i32, i32* %2
%22 = add nsw i32 %21, 4
store i32 %22, i32* %2
br label %23
23: ; preds = %8
%24 = load i32, i32* %3
%25 = add nsw i32 %24, -1
store i32 %25, i32* %3
br label %5
26: ; preds = %5
ret void
}

LLVM IR (-O2):
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
bool uint32_gt(uint32_t a, uint32_t b) { return a > b; }


x86 assembly (clang, -O0):
<uint32_gt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint32_gt>:
xor    %eax,%eax
cmp    %rsi,%rdi
setg   %al
ret

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

LLVM IR (-O2):
define i32 @uint32_gt(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct geometry_struct {
  int dummy;
};

/* Variables and functions */
int A_within_B(struct geometry_struct *, struct geometry_struct *, int);
int cylinder_within_sphere(struct geometry_struct *geometry_child,
                           struct geometry_struct *geometry_parent) {
  return A_within_B(geometry_child, geometry_parent, (int)60);
}


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

x86 assembly (clang, -O2):
<cylinder_within_sphere>:
mov    $0x3c,%edx
jmp    1030 <A_within_B@plt>

LLVM IR (-O0):
%struct.geometry_struct = type { i32 }
define i32 @cylinder_within_sphere(%struct.geometry_struct* %0, %struct.geometry_struct* %1) {
%3 = alloca %struct.geometry_struct*
%4 = alloca %struct.geometry_struct*
store %struct.geometry_struct* %0, %struct.geometry_struct** %3
store %struct.geometry_struct* %1, %struct.geometry_struct** %4
%5 = load %struct.geometry_struct*, %struct.geometry_struct** %3
%6 = load %struct.geometry_struct*, %struct.geometry_struct** %4
%7 = call i32 @A_within_B(%struct.geometry_struct* %5, %struct.geometry_struct* %6, i32 60)
ret i32 %7
}

LLVM IR (-O2):
%struct.geometry_struct = type { i32 }
define i32 @cylinder_within_sphere(%struct.geometry_struct* %0, %struct.geometry_struct* %1) {
%3 = tail call i32 @A_within_B(%struct.geometry_struct* %0, %struct.geometry_struct* %1, i32 60)
ret i32 %3
}
/* Variables and functions */
void *__real_malloc(size_t);
unsigned int irq_disable();
int /*<<< orphan*/ irq_restore(unsigned int);
void *__wrap_malloc(size_t size) {
  unsigned state = irq_disable();
  void *ptr = __real_malloc(size);
  irq_restore(state);
  return ptr;
}


x86 assembly (clang, -O0):
<__wrap_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <irq_disable@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <__real_malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <irq_restore@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wrap_malloc>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <irq_disable@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <__real_malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1050 <irq_restore@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i8* @__wrap_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i8*
store i64 %0, i64* %2
%5 = call i32 (...) @irq_disable()
store i32 %5, i32* %3
%6 = load i64, i64* %2
%7 = call i8* @__real_malloc(i64 %6)
store i8* %7, i8** %4
%8 = load i32, i32* %3
%9 = call i32 @irq_restore(i32 %8)
%10 = load i8*, i8** %4
ret i8* %10
}

LLVM IR (-O2):
define i8* @__wrap_malloc(i64 %0) {
%2 = tail call i32 (...) @irq_disable()
%3 = tail call i8* @__real_malloc(i64 %0)
%4 = tail call i32 @irq_restore(i32 %2)
ret i8* %3
}
int compareFloat(void *p1, void *p2) {
  float *n1 = (float *)p1;
  float *n2 = (float *)p2;
  return (*n1 - *n2);
}


x86 assembly (clang, -O0):
<compareFloat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
subss  (%rax),%xmm0
cvttss2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareFloat>:
movss  (%rdi),%xmm0
subss  (%rsi),%xmm0
cvttss2si %xmm0,%eax
ret

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

LLVM IR (-O2):
define i32 @compareFloat(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = bitcast i8* %1 to float*
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fsub float %5, %6
%8 = fptosi float %7 to i32
ret i32 %8
}
int helper(int n, int *vlaue) {
  if (vlaue[n] != 0) {
    return vlaue[n];
  }
  vlaue[n] = helper(n - 1, vlaue) + helper(n - 2, vlaue);
  return vlaue[n];
}


x86 assembly (clang, -O0):
<helper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1144 <helper+0x34>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
jmp    1183 <helper+0x73>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
call   1030 <helper@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
mov    -0x10(%rbp),%rsi
call   1030 <helper@plt>
mov    -0x14(%rbp),%edx
add    %eax,%edx
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<helper>:
push   %rbp
push   %r14
push   %rbx
movslq %edi,%rbp
mov    (%rsi,%rbp,4),%eax
test   %eax,%eax
jne    113d <helper+0x2d>
mov    %rsi,%rbx
lea    -0x1(%rbp),%edi
call   1030 <helper@plt>
mov    %eax,%r14d
lea    -0x2(%rbp),%edi
mov    %rbx,%rsi
call   1030 <helper@plt>
add    %r14d,%eax
mov    %eax,(%rbx,%rbp,4)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @helper(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** %5
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32*, i32** %5
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
store i32 %17, i32* %3
br label %37
18: ; preds = %2
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 1
%21 = load i32*, i32** %5
%22 = call i32 @helper(i32 %20, i32* %21)
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 2
%25 = load i32*, i32** %5
%26 = call i32 @helper(i32 %24, i32* %25)
%27 = add nsw i32 %22, %26
%28 = load i32*, i32** %5
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
store i32 %27, i32* %31
%32 = load i32*, i32** %5
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = load i32, i32* %35
store i32 %36, i32* %3
br label %37
37: ; preds = %18, %12
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
define i32 @helper(i32 %0, i32* %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i32, i32* %1, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2, %9
%8 = phi i32 [ %14, %9 ], [ %5, %2 ]
ret i32 %8
9: ; preds = %2
%10 = add nsw i32 %0, -1
%11 = tail call i32 @helper(i32 %10, i32* %1)
%12 = add nsw i32 %0, -2
%13 = tail call i32 @helper(i32 %12, i32* %1)
%14 = add nsw i32 %13, %11
store i32 %14, i32* %4
br label %7
}
double modf(double value, double *iptr) {
  int neg = 0;
  long i;
  if (value < 0) {
    neg = 1;
    value = -value;
  }
  i = (long)value;
  value -= i;
  if (neg) {
    value = -value;
    i = -i;
  }
  *iptr = i;
  return (value);
}


x86 assembly (clang, -O0):
<modf>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    114a <modf+0x4a>
movl   $0x1,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cvtsi2sdq -0x20(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     119d <modf+0x9d>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
xor    %eax,%eax
sub    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
cvtsi2sdq -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<modf>:
movapd %xmm0,%xmm1
movapd 0xef4(%rip),%xmm2
movapd %xmm0,%xmm3
xorpd  %xmm2,%xmm3
xorpd  %xmm4,%xmm4
cmpltsd %xmm4,%xmm0
andpd  %xmm0,%xmm3
andnpd %xmm1,%xmm0
orpd   %xmm3,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,%rcx
neg    %rcx
ucomisd %xmm1,%xmm4
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
jbe    114a <modf+0x4a>
xorpd  %xmm2,%xmm0
cmova  %rcx,%rax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movsd  %xmm1,(%rdi)
ret

LLVM IR (-O0):
define double @modf(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca i32
%6 = alloca i64
store double %0, double* %3
store double* %1, double** %4
store i32 0, i32* %5
%7 = load double, double* %3
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %2
store i32 1, i32* %5
%10 = load double, double* %3
%11 = fneg double %10
store double %11, double* %3
br label %12
12: ; preds = %9, %2
%13 = load double, double* %3
%14 = fptosi double %13 to i64
store i64 %14, i64* %6
%15 = load i64, i64* %6
%16 = sitofp i64 %15 to double
%17 = load double, double* %3
%18 = fsub double %17, %16
store double %18, double* %3
%19 = load i32, i32* %5
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %12
%22 = load double, double* %3
%23 = fneg double %22
store double %23, double* %3
%24 = load i64, i64* %6
%25 = sub nsw i64 0, %24
store i64 %25, i64* %6
br label %26
26: ; preds = %21, %12
%27 = load i64, i64* %6
%28 = sitofp i64 %27 to double
%29 = load double*, double** %4
store double %28, double* %29
%30 = load double, double* %3
ret double %30
}

LLVM IR (-O2):
define double @modf(double %0, double* nocapture writeonly %1) {
%3 = fcmp olt double %0, 0.000000e+00
%4 = fneg double %0
%5 = select i1 %3, double %4, double %0
%6 = fptosi double %5 to i64
%7 = sitofp i64 %6 to double
%8 = fsub double %5, %7
%9 = fneg double %8
%10 = sub nsw i64 0, %6
%11 = select i1 %3, double %9, double %8
%12 = select i1 %3, i64 %10, i64 %6
%13 = sitofp i64 %12 to double
store double %13, double* %1
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int *foo_pure(int *);
void test_pure(void) {
  int i;
  int *p = &i;
  int *q_pure = foo_pure(p);
  *p = 1;
  *q_pure = 2;
  if (*p != 2)
    abort();
}


x86 assembly (clang, -O0):
<test_pure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <foo_pure@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x2,(%rax)
je     1165 <test_pure+0x45>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_pure>:
push   %rax
lea    0x4(%rsp),%rdi
call   1040 <foo_pure@plt>
movl   $0x1,0x4(%rsp)
movl   $0x2,(%rax)
cmpl   $0x2,0x4(%rsp)
jne    1142 <test_pure+0x22>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @test_pure() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32*
store i32* %1, i32** %2
%4 = load i32*, i32** %2
%5 = call i32* @foo_pure(i32* %4)
store i32* %5, i32** %3
%6 = load i32*, i32** %2
store i32 1, i32* %6
%7 = load i32*, i32** %3
store i32 2, i32* %7
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %0
ret void
}

LLVM IR (-O2):
define void @test_pure() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32* @foo_pure(i32* %1)
store i32 1, i32* %1
store i32 2, i32* %3
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 2
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_PKEY;
typedef int /*<<< orphan*/ BIO;
typedef int /*<<< orphan*/ ASN1_PCTX;

/* Variables and functions */
int print_gost_01(int /*<<< orphan*/ *, int /*<<< orphan*/ const *, int,
                  int /*<<< orphan*/ *, int);
int priv_print_gost01(BIO *out, const EVP_PKEY *pkey, int indent,
                      ASN1_PCTX *pctx) {
  return print_gost_01(out, pkey, indent, pctx, 2);
}


x86 assembly (clang, -O0):
<priv_print_gost01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    $0x2,%r8d
call   1030 <print_gost_01@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priv_print_gost01>:
mov    $0x2,%r8d
jmp    1030 <print_gost_01@plt>

LLVM IR (-O0):
define i32 @priv_print_gost01(i32* %0, i32* %1, i32 %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = load i32, i32* %7
%12 = load i32*, i32** %8
%13 = call i32 @print_gost_01(i32* %9, i32* %10, i32 %11, i32* %12, i32 2)
ret i32 %13
}

LLVM IR (-O2):
define i32 @priv_print_gost01(i32* %0, i32* %1, i32 %2, i32* %3) {
%5 = tail call i32 @print_gost_01(i32* %0, i32* %1, i32 %2, i32* %3, i32 2)
ret i32 %5
}
/* Type definitions */
typedef double uint32_t;

/* Variables and functions */
double RAND_MAX;
double rand();
uint32_t rrrrandom(uint32_t limit) {
  return (uint32_t)(limit * (rand() / (RAND_MAX + 1.0)));
}


x86 assembly (clang, -O0):
<rrrrandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xec2(%rip),%xmm2
mov    0x2ea3(%rip),%rax
addsd  (%rax),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rrrrandom>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ec4(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xed0(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @rrrrandom(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double (...) @rand()
%5 = load double, double* @RAND_MAX
%6 = fadd double %5, 1.000000e+00
%7 = fdiv double %4, %6
%8 = fmul double %3, %7
ret double %8
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @rrrrandom(double %0) {
%2 = tail call double (...) @rand()
%3 = load double, double* @RAND_MAX
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double %2, %4
%6 = fmul double %5, %0
ret double %6
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int main(void) { printf("%d", atoi("123")); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed8(%rip),%rdi
call   1040 <atoi@plt>
mov    %eax,%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x7b,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 123)
ret i32 0
}
float test_remquof(float x, float y, int *z) {
  return __builtin_remquof(x, y, z);
}


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

x86 assembly (clang, -O2):
<test_remquof>:
jmp    1030 <remquof@plt>

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

LLVM IR (-O2):
define float @test_remquof(float %0, float %1, i32* %2) {
%4 = tail call float @remquof(float %0, float %1, i32* %2)
ret float %4
}