xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void show_usage(const char *progname, int exitcode) {
  fprintf(stderr, "%s -o <outfile> <infile>\n", progname);
  exit(exitcode);
}


x86 assembly (clang, -O0):
<show_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xebd(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<show_usage>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rdx
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"%s -o <outfile> <infile>\0A\00"
define void @show_usage(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %3
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* %4
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"%s -o <outfile> <infile>\0A\00"
define void @show_usage(i8* %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 @exit(i32 %1)
unreachable
}
unsigned long _video_to_bits(char count) {
  long ret = 1;
  if (count == 0) {
    return 0;
  }
  for (char c = 0; c < count - 1; c++) {
    ret |= ret << 1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<_video_to_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movq   $0x1,-0x18(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    112c <_video_to_bits+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    1168 <_video_to_bits+0x68>
movb   $0x0,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
movsbl -0x9(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1160 <_video_to_bits+0x60>
mov    -0x18(%rbp),%rax
shl    $0x1,%rax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x19(%rbp),%al
add    $0x1,%al
mov    %al,-0x19(%rbp)
jmp    1130 <_video_to_bits+0x30>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_video_to_bits>:
test   %dil,%dil
je     1132 <_video_to_bits+0x32>
mov    $0x1,%eax
cmp    $0x2,%dil
jl     1131 <_video_to_bits+0x31>
movsbl %dil,%ecx
add    $0xffffffff,%ecx
mov    $0x1,%eax
mov    $0x1,%dl
xchg   %ax,%ax
lea    (%rax,%rax,1),%rsi
or     %rsi,%rax
movsbl %dl,%esi
lea    0x1(%rsi),%edx
cmp    %esi,%ecx
jg     1120 <_video_to_bits+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @_video_to_bits(i8 signext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %15, label %3
3: ; preds = %1
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -1
%6 = icmp sgt i8 %0, 1
br i1 %6, label %7, label %15
7: ; preds = %3, %7
%8 = phi i8 [ %12, %7 ], [ 0, %3 ]
%9 = phi i64 [ %11, %7 ], [ 1, %3 ]
%10 = shl i64 %9, 1
%11 = or i64 %10, %9
%12 = add i8 %8, 1
%13 = sext i8 %12 to i32
%14 = icmp sgt i32 %5, %13
br i1 %14, label %7, label %15
15: ; preds = %7, %3, %1
%16 = phi i64 [ 0, %1 ], [ 1, %3 ], [ %11, %7 ]
ret i64 %16
}
void foo164() {}


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

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

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

LLVM IR (-O2):
define void @foo164() {
ret void
}
/* Variables and functions */
scalar_t__ isalnum(int);
scalar_t__ isspace(int);
int ispunct(int c) {
  if (isalnum(c) != 0)
    return 0;
  if (isspace(c) != 0)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<ispunct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isalnum@plt>
cmp    $0x0,%rax
je     1149 <ispunct+0x29>
movl   $0x0,-0x4(%rbp)
jmp    116e <ispunct+0x4e>
mov    -0x8(%rbp),%edi
call   1040 <isspace@plt>
cmp    $0x0,%rax
je     1167 <ispunct+0x47>
movl   $0x0,-0x4(%rbp)
jmp    116e <ispunct+0x4e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ispunct>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalnum@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1134 <ispunct+0x14>
pop    %rbx
ret
mov    %ebx,%edi
call   1040 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ispunct(i32 %0) {
%2 = tail call i64 @isalnum(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @isspace(i32 %0)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
void fs_http_init(void) { return; }


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

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

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

LLVM IR (-O2):
define void @fs_http_init() {
ret void
}
int GetAge() { return 22; }


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

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

LLVM IR (-O0):
define i32 @GetAge() {
ret i32 22
}

LLVM IR (-O2):
define i32 @GetAge() {
ret i32 22
}
int iszero(int n) { return n == 0; }


x86 assembly (clang, -O0):
<iszero>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iszero>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @iszero(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main(void) {
  float x = 2.55;
  float sum;
  sum = 3 * x * x * x - 5 * x * x + 6;
  printf("3x3 - 5x2 + 6 = %f\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xee5(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xed4(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
movss  0xeb9(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xe8e(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"3x3 - 5x2 + 6 = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 0x4004666660000000, float* %2
%4 = load float, float* %2
%5 = fmul float 3.000000e+00, %4
%6 = load float, float* %2
%7 = fmul float %5, %6
%8 = load float, float* %2
%9 = load float, float* %2
%10 = fmul float 5.000000e+00, %9
%11 = load float, float* %2
%12 = fmul float %10, %11
%13 = fneg float %12
%14 = call float @llvm.fmuladd.f32(float %7, float %8, float %13)
%15 = fadd float %14, 6.000000e+00
store float %15, float* %3
%16 = load float, float* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), float %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"3x3 - 5x2 + 6 = %f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), float 0x40373B4B40000000)
ret i32 0
}
int fun805() { return 805; }


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

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

LLVM IR (-O0):
define i32 @fun805() {
ret i32 805
}

LLVM IR (-O2):
define i32 @fun805() {
ret i32 805
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
unsigned insert_into(unsigned N, unsigned M, unsigned j, unsigned i) {
  assert(j >= i);
  unsigned mask = ~(~(~0 << (j - i + 1)) << i);
  unsigned N_cleared = N & mask;
  return N_cleared | (M << i);
}


x86 assembly (clang, -O0):
<insert_into>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%ecx
sub    -0x10(%rbp),%ecx
add    $0x1,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
and    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_into>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%ebx
mov    %edi,%r15d
xor    %edi,%edi
sub    %ecx,%ebp
setae  %dil
call   1030 <assert@plt>
add    $0x1,%bpl
mov    $0xffffffff,%eax
mov    %ebp,%ecx
shl    %cl,%eax
not    %eax
mov    %r14d,%ecx
shl    %cl,%eax
not    %eax
and    %r15d,%eax
shl    %cl,%ebx
or     %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @insert_into(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = icmp uge i32 %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = sub i32 %16, %17
%19 = add i32 %18, 1
%20 = shl i32 -1, %19
%21 = xor i32 %20, -1
%22 = load i32, i32* %8
%23 = shl i32 %21, %22
%24 = xor i32 %23, -1
store i32 %24, i32* %9
%25 = load i32, i32* %5
%26 = load i32, i32* %9
%27 = and i32 %25, %26
store i32 %27, i32* %10
%28 = load i32, i32* %10
%29 = load i32, i32* %6
%30 = load i32, i32* %8
%31 = shl i32 %29, %30
%32 = or i32 %28, %31
ret i32 %32
}

LLVM IR (-O2):
define i32 @insert_into(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp uge i32 %2, %3
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = add i32 %2, 1
%9 = sub i32 %8, %3
%10 = shl nsw i32 -1, %9
%11 = xor i32 %10, -1
%12 = shl i32 %11, %3
%13 = xor i32 %12, -1
%14 = and i32 %13, %0
%15 = shl i32 %1, %3
%16 = or i32 %14, %15
ret i32 %16
}
int isAsciiDigit(char c) { return c >= '0' && c <= '9'; }


x86 assembly (clang, -O0):
<isAsciiDigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <isAsciiDigit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isAsciiDigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @isAsciiDigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isAsciiDigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
double v3_angle(const struct v3_str *u, const struct v3_str *v) {
  return acos(v3_dot(u, v) / ((v3_mag(u)) * (v3_mag(v))));
}


x86 assembly (clang, -O0):
<v3_angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1050 <v3_dot@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <v3_mag@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <v3_mag@plt>
mov    -0x18(%rbp),%ecx
mov    %eax,%edx
mov    -0x14(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
call   1030 <acos@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v3_angle>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <v3_dot@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <v3_mag@plt>
mov    %eax,%ebx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <v3_mag@plt>
mov    %eax,%ecx
imul   %ebx,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <acos@plt>

LLVM IR (-O0):
%struct.v3_str = type opaque
define double @v3_angle(%struct.v3_str* %0, %struct.v3_str* %1) {
%3 = alloca %struct.v3_str*
%4 = alloca %struct.v3_str*
store %struct.v3_str* %0, %struct.v3_str** %3
store %struct.v3_str* %1, %struct.v3_str** %4
%5 = load %struct.v3_str*, %struct.v3_str** %3
%6 = load %struct.v3_str*, %struct.v3_str** %4
%7 = call i32 (%struct.v3_str*, %struct.v3_str*, ...) bitcast (i32 (...)* @v3_dot to i32 (%struct.v3_str*, %struct.v3_str*, ...)*)(%struct.v3_str* %5, %struct.v3_str* %6)
%8 = load %struct.v3_str*, %struct.v3_str** %3
%9 = call i32 (%struct.v3_str*, ...) bitcast (i32 (...)* @v3_mag to i32 (%struct.v3_str*, ...)*)(%struct.v3_str* %8)
%10 = load %struct.v3_str*, %struct.v3_str** %4
%11 = call i32 (%struct.v3_str*, ...) bitcast (i32 (...)* @v3_mag to i32 (%struct.v3_str*, ...)*)(%struct.v3_str* %10)
%12 = mul nsw i32 %9, %11
%13 = sdiv i32 %7, %12
%14 = sitofp i32 %13 to double
%15 = call double @acos(double %14)
ret double %15
}

LLVM IR (-O2):
%struct.v3_str = type opaque
define double @v3_angle(%struct.v3_str* %0, %struct.v3_str* %1) {
%3 = tail call i32 (%struct.v3_str*, %struct.v3_str*, ...) bitcast (i32 (...)* @v3_dot to i32 (%struct.v3_str*, %struct.v3_str*, ...)*)(%struct.v3_str* %0, %struct.v3_str* %1)
%4 = tail call i32 (%struct.v3_str*, ...) bitcast (i32 (...)* @v3_mag to i32 (%struct.v3_str*, ...)*)(%struct.v3_str* %0)
%5 = tail call i32 (%struct.v3_str*, ...) bitcast (i32 (...)* @v3_mag to i32 (%struct.v3_str*, ...)*)(%struct.v3_str* %1)
%6 = mul nsw i32 %5, %4
%7 = sdiv i32 %3, %6
%8 = sitofp i32 %7 to double
%9 = tail call double @acos(double %8)
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ assert(char const *);
char *strchr(char const *, int);
__attribute__((visibility("default"))) char *trio_index_last(const char *string,
                                                             int character) {
  assert(string);
  return strchr(string, character);
}


x86 assembly (clang, -O0):
<trio_index_last>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <strchr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trio_index_last>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <strchr@plt>

LLVM IR (-O0):
define i8* @trio_index_last(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @assert(i8* %5)
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i8* @strchr(i8* %7, i32 %8)
ret i8* %9
}

LLVM IR (-O2):
define i8* @trio_index_last(i8* %0, i32 %1) {
%3 = tail call i32 @assert(i8* %0)
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 %1)
ret i8* %4
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ chr1setBank0(int);
void vrc7setParamsA000(uint16_t addr, uint8_t val) {
  (void)addr;
  chr1setBank0(val << 10);
}


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

x86 assembly (clang, -O2):
mov    %esi,%edi
shl    $0xa,%edi
jmp    1030 <chr1setBank0@plt>

LLVM IR (-O0):
define void @vrc7setParamsA000(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = shl i32 %6, 10
%8 = call i32 @chr1setBank0(i32 %7)
ret void
}

LLVM IR (-O2):
define void @vrc7setParamsA000(i32 %0, i32 %1) {
%3 = shl i32 %1, 10
%4 = tail call i32 @chr1setBank0(i32 %3)
ret void
}
/* Variables and functions */
int aa_feq(double, double, int /*<<< orphan*/);
int aa_opt_is_eq(double l, double u) { return aa_feq(l, u, 0); }


x86 assembly (clang, -O0):
<aa_opt_is_eq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
xor    %edi,%edi
call   1030 <aa_feq@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @aa_opt_is_eq(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 = call i32 @aa_feq(double %5, double %6, i32 0)
ret i32 %7
}

LLVM IR (-O2):
define i32 @aa_opt_is_eq(double %0, double %1) {
%3 = tail call i32 @aa_feq(double %0, double %1, i32 0)
ret i32 %3
}
/* Variables and functions */
int recursive_factorial(int);
int main() { return recursive_factorial(5); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0x5,%edi
jmp    1030 <recursive_factorial@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @recursive_factorial(i32 5)
ret i32 %1
}
void MD5InitKey(ctx, s) struct MD5Context *ctx;
const char *s;
{
  MD5Init(ctx);
  MD5Update(ctx, (unsigned char *)s, (unsigned)strlen(s));
}


x86 assembly (clang, -O0):
<MD5InitKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1050 <MD5Init@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
mov    $0x0,%al
call   1030 <MD5Update@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MD5InitKey>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <MD5Init@plt>
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <MD5Update@plt>

LLVM IR (-O0):
%struct.MD5Context = type opaque
define void @MD5InitKey(%struct.MD5Context* %0, i8* %1) {
%3 = alloca %struct.MD5Context*
%4 = alloca i8*
store %struct.MD5Context* %0, %struct.MD5Context** %3
store i8* %1, i8** %4
%5 = load %struct.MD5Context*, %struct.MD5Context** %3
%6 = call i32 (%struct.MD5Context*, ...) bitcast (i32 (...)* @MD5Init to i32 (%struct.MD5Context*, ...)*)(%struct.MD5Context* %5)
%7 = load %struct.MD5Context*, %struct.MD5Context** %3
%8 = load i8*, i8** %4
%9 = load i8*, i8** %4
%10 = call i64 @strlen(i8* %9)
%11 = trunc i64 %10 to i32
%12 = call i32 (%struct.MD5Context*, i8*, i32, ...) bitcast (i32 (...)* @MD5Update to i32 (%struct.MD5Context*, i8*, i32, ...)*)(%struct.MD5Context* %7, i8* %8, i32 %11)
ret void
}

LLVM IR (-O2):
%struct.MD5Context = type opaque
define void @MD5InitKey(%struct.MD5Context* %0, i8* %1) {
%3 = tail call i32 (%struct.MD5Context*, ...) bitcast (i32 (...)* @MD5Init to i32 (%struct.MD5Context*, ...)*)(%struct.MD5Context* %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = trunc i64 %4 to i32
%6 = tail call i32 (%struct.MD5Context*, i8*, i32, ...) bitcast (i32 (...)* @MD5Update to i32 (%struct.MD5Context*, i8*, i32, ...)*)(%struct.MD5Context* %0, i8* %1, i32 %5)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sqlite3;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *sqlite3_errmsg(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void sql_error(sqlite3 *db) {
  fprintf(stderr, "Database error: %s\n", sqlite3_errmsg(db));
}


x86 assembly (clang, -O0):
<sql_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <sqlite3_errmsg@plt>
mov    -0xc(%rbp),%edi
mov    %rax,%rdx
lea    0xeb2(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sql_error>:
push   %rbx
mov    0x2eb8(%rip),%rax
mov    (%rax),%ebx
call   1030 <sqlite3_errmsg@plt>
lea    0xeca(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
pop    %rbx
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Database error: %s\0A\00"
define void @sql_error(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @stderr
%4 = load i32*, i32** %2
%5 = call i8* @sqlite3_errmsg(i32* %4)
%6 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Database error: %s\0A\00"
define void @sql_error(i32* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i8* @sqlite3_errmsg(i32* %0)
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}
void GC_abort(void) {}


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

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

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

LLVM IR (-O2):
define void @GC_abort() {
ret void
}
_RWSTD_NAMESPACE(__rw) {
  union __rw_critical_section {
    long _C_pad;
    char _C_buf[24];
  };
}


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

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

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

LLVM IR (-O2):
define i32 @_RWSTD_NAMESPACE(i32 %0) {
ret i32 undef
}
/* Variables and functions */
char getchar();
char toupper(char);
char lireCaractere() {
  char caractere = 0;
  caractere = getchar();
  caractere = toupper(caractere);
  while (getchar() != '\n')
    ;
  return caractere;
}


x86 assembly (clang, -O0):
<lireCaractere>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     115a <lireCaractere+0x3a>
jmp    1142 <lireCaractere+0x22>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lireCaractere>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
jne    1140 <lireCaractere+0x20>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @lireCaractere() {
%1 = alloca i8
store i8 0, i8* %1
%2 = call signext i8 (...) @getchar()
store i8 %2, i8* %1
%3 = load i8, i8* %1
%4 = call signext i8 @toupper(i8 signext %3)
store i8 %4, i8* %1
br label %5
5: ; preds = %9, %0
%6 = call signext i8 (...) @getchar()
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 10
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = load i8, i8* %1
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @lireCaractere() {
%1 = tail call signext i8 (...) @getchar()
%2 = tail call signext i8 @toupper(i8 signext %1)
br label %3
3: ; preds = %3, %0
%4 = tail call signext i8 (...) @getchar()
%5 = icmp eq i8 %4, 10
br i1 %5, label %6, label %3
6: ; preds = %3
ret i8 %2
}
/* Variables and functions */
void putc(int c) {
  while (!(*(volatile unsigned char *)(0x11006000 + 0x14) & 0x20))
    ;
  *(volatile unsigned char *)(0x11006000 + 0x0) = c;
}


x86 assembly (clang, -O0):
<putc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x11006014,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x20,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1129 <putc+0x29>
jmp    112e <putc+0x2e>
jmp    1107 <putc+0x7>
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    $0x11006000,%eax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<putc>:
testb  $0x20,0x11006014
20
je     1100 <putc>
mov    %dil,0x11006000
11
ret

LLVM IR (-O0):
define void @putc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %9, %1
%4 = load volatile i8, i8* inttoptr (i64 285237268 to i8*)
%5 = zext i8 %4 to i32
%6 = and i32 %5, 32
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %10
9: ; preds = %3
br label %3
10: ; preds = %3
%11 = load i32, i32* %2
%12 = trunc i32 %11 to i8
store volatile i8 %12, i8* inttoptr (i64 285237248 to i8*)
ret void
}

LLVM IR (-O2):
define void @putc(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i8, i8* inttoptr (i64 285237268 to i8*)
%4 = and i8 %3, 32
%5 = icmp eq i8 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
%7 = trunc i32 %0 to i8
store volatile i8 %7, i8* inttoptr (i64 285237248 to i8*)
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
scalar_t__ clock_gettime(int /*<<< orphan*/, struct timespec *);
int rtime_check_working(void) {
  struct timespec ts;
  if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<rtime_check_working>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0x0,%rax
je     1140 <rtime_check_working+0x30>
movl   $0x0,-0x4(%rbp)
jmp    1147 <rtime_check_working+0x37>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtime_check_working>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
define i32 @rtime_check_working() {
%1 = alloca i32
%2 = alloca %struct.timespec
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i64 @clock_gettime(i32 %3, %struct.timespec* %2)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 0, i32* %1
br label %8
7: ; preds = %0
store i32 1, i32* %1
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
define i32 @rtime_check_working() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i64 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ HsPrintk(char *);
int /*<<< orphan*/ cdrom_sysctl_unregister();
void cdrom_exit(void) {
  HsPrintk("<6>Uniform CD-ROM driver unloaded\n");
  cdrom_sysctl_unregister();
  return;
}


x86 assembly (clang, -O0):
<cdrom_exit>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <HsPrintk@plt>
mov    $0x0,%al
call   1040 <cdrom_sysctl_unregister@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdrom_exit>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <HsPrintk@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <cdrom_sysctl_unregister@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"<6>Uniform CD-ROM driver unloaded\0A\00"
define void @cdrom_exit() {
%1 = call i32 @HsPrintk(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @cdrom_sysctl_unregister()
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"<6>Uniform CD-ROM driver unloaded\0A\00"
define void @cdrom_exit() {
%1 = tail call i32 @HsPrintk(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @cdrom_sysctl_unregister()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(unsigned int, unsigned char);
void OUTPORT8(unsigned idx, unsigned char val) { outb(idx, val); }


x86 assembly (clang, -O0):
<OUTPORT8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
movzbl -0x5(%rbp),%esi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OUTPORT8>:
jmp    1030 <outb@plt>

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

LLVM IR (-O2):
define void @OUTPORT8(i32 %0, i8 zeroext %1) {
%3 = tail call i32 @outb(i32 %0, i8 zeroext %1)
ret void
}
/* Variables and functions */
char *find_ch_ptr(char *string, char ch) { return NULL; }


x86 assembly (clang, -O0):
<find_ch_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @find_ch_ptr(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @find_ch_ptr(i8* nocapture readnone %0, i8 signext %1) {
ret i8* null
}
int test_imm_04int32_mem(int *val) {
  return ((*val) & (0x04 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_04int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 4
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int rand();
int get_random_number(int n) { return rand() % n; }


x86 assembly (clang, -O0):
<get_random_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random_number>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_random_number(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @get_random_number(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ SIGALRM;
int /*<<< orphan*/ alarm(int);
int /*<<< orphan*/ pause();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
int main(int argc, char *argv[]) {
  void wakeup(int);
  signal(SIGALRM, wakeup);
  printf("sleep 4 seconds\n");
  alarm(4);
  pause();
  printf("Back to work\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
mov    0x2e6a(%rip),%rsi
call   1050 <signal@plt>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    $0x4,%edi
call   1040 <alarm@plt>
mov    $0x0,%al
call   1060 <pause@plt>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    0x2e7f(%rip),%rsi
call   1050 <signal@plt>
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x4,%edi
call   1040 <alarm@plt>
xor    %eax,%eax
call   1060 <pause@plt>
lea    0xe96(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGALRM = global i32 0
@.str = [17 x i8] c"sleep 4 seconds\0A\00"
@.str.1 = [14 x i8] c"Back to work\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @SIGALRM
%7 = call i32 @signal(i32 %6, void (i32)* @wakeup)
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @alarm(i32 4)
%10 = call i32 (...) @pause()
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@SIGALRM = global i32 0
@str = [16 x i8] c"sleep 4 seconds\00"
@str.2 = [13 x i8] c"Back to work\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @SIGALRM
%4 = tail call i32 @signal(i32 %3, void (i32)* @wakeup)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @alarm(i32 4)
%7 = tail call i32 (...) @pause()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
float shSaturate(float);
float linRange(float x, float xa, float xb, float s) {
  return shSaturate(x < xa ? (x - xa) / s + 1.f : (xb - x) / s + 1.f);
}


x86 assembly (clang, -O0):
<linRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1164 <linRange+0x54>
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
movss  0xeaa(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1184 <linRange+0x74>
movss  -0xc(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
divss  -0x10(%rbp),%xmm0
movss  0xe85(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <shSaturate@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linRange>:
movaps %xmm0,%xmm4
subss  %xmm1,%xmm4
subss  %xmm0,%xmm2
cmpltss %xmm1,%xmm0
andps  %xmm0,%xmm4
andnps %xmm2,%xmm0
orps   %xmm4,%xmm0
divss  %xmm3,%xmm0
addss  0xecb(%rip),%xmm0
jmp    1030 <shSaturate@plt>

LLVM IR (-O0):
define float @linRange(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %6
%11 = fcmp olt float %9, %10
br i1 %11, label %12, label %19
12: ; preds = %4
%13 = load float, float* %5
%14 = load float, float* %6
%15 = fsub float %13, %14
%16 = load float, float* %8
%17 = fdiv float %15, %16
%18 = fadd float %17, 1.000000e+00
br label %26
19: ; preds = %4
%20 = load float, float* %7
%21 = load float, float* %5
%22 = fsub float %20, %21
%23 = load float, float* %8
%24 = fdiv float %22, %23
%25 = fadd float %24, 1.000000e+00
br label %26
26: ; preds = %19, %12
%27 = phi float [ %18, %12 ], [ %25, %19 ]
%28 = call float @shSaturate(float %27)
ret float %28
}

LLVM IR (-O2):
define float @linRange(float %0, float %1, float %2, float %3) {
%5 = fcmp olt float %0, %1
%6 = fsub float %0, %1
%7 = fsub float %2, %0
%8 = select i1 %5, float %6, float %7
%9 = fdiv float %8, %3
%10 = fadd float %9, 1.000000e+00
%11 = tail call float @shSaturate(float %10)
ret float %11
}
int size_string(unsigned char *string) {
  int i;
  for (i = 0; string[i] != '\0'; ++i)
    ;
  return i;
}


x86 assembly (clang, -O0):
<size_string>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1137 <size_string+0x37>
jmp    1129 <size_string+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <size_string+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @size_string(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 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %4
br label %13
13: ; preds = %12
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @size_string(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
unsigned short CFSR_readw(void) { return 0; }


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

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

LLVM IR (-O0):
define zeroext i16 @CFSR_readw() {
ret i16 0
}

LLVM IR (-O2):
define zeroext i16 @CFSR_readw() {
ret i16 0
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void InitPointerData(void *p, int n) { memset(p, 0, sizeof(void *) * n); }


x86 assembly (clang, -O0):
<InitPointerData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InitPointerData>:
lea    0x0(,%rsi,8),%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @InitPointerData(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = mul i64 8, %7
%9 = trunc i64 %8 to i32
%10 = call i32 @memset(i8* %5, i32 0, i32 %9)
ret void
}

LLVM IR (-O2):
define void @InitPointerData(i8* %0, i32 %1) {
%3 = shl i32 %1, 3
%4 = tail call i32 @memset(i8* %0, i32 0, i32 %3)
ret void
}
struct foo {
  int i;
  char c;
} bar(struct foo *a) {
  if (a->c == 0) {
    *((char *)a + sizeof(int)) = 1;
    if (a->c != 0)
      abort();
  }
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x0,%eax
jne    1150 <bar+0x40>
mov    -0x10(%rbp),%rax
movb   $0x1,0x4(%rax)
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x0,%eax
je     114b <bar+0x3b>
call   1030 <abort@plt>
jmp    1150 <bar+0x40>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
cmpb   $0x0,0x4(%rdi)
je     1119 <bar+0x9>
pop    %rcx
ret
movb   $0x1,0x4(%rdi)
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.foo = type { i32, i8 }
define i64 @bar(%struct.foo* %0) {
%2 = alloca %struct.foo
%3 = alloca %struct.foo*
store %struct.foo* %0, %struct.foo** %3
%4 = load %struct.foo*, %struct.foo** %3
%5 = getelementptr inbounds %struct.foo, %struct.foo* %4, i32 0, i32 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %20
9: ; preds = %1
%10 = load %struct.foo*, %struct.foo** %3
%11 = bitcast %struct.foo* %10 to i8*
%12 = getelementptr inbounds i8, i8* %11, i64 4
store i8 1, i8* %12
%13 = load %struct.foo*, %struct.foo** %3
%14 = getelementptr inbounds %struct.foo, %struct.foo* %13, i32 0, i32 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %9
unreachable
19: ; preds = %9
br label %20
20: ; preds = %19, %1
%21 = bitcast %struct.foo* %2 to i64*
%22 = load i64, i64* %21
ret i64 %22
}

LLVM IR (-O2):
%struct.foo = type { i32, i8 }
define i64 @bar(%struct.foo* nocapture %0) {
%2 = getelementptr inbounds %struct.foo, %struct.foo* %0, i64 0, i32 1
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
store i8 1, i8* %2
tail call void @abort()
unreachable
6: ; preds = %1
ret i64 undef
}
/* Variables and functions */
float log10f(float);
float __ocl_native_log10_float(float src) { return log10f(src); }


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

x86 assembly (clang, -O2):
<__ocl_native_log10_float>:
jmp    1030 <log10f@plt>

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

LLVM IR (-O2):
define float @__ocl_native_log10_float(float %0) {
%2 = tail call float @log10f(float %0)
ret float %2
}
double MItoIN(double MI) { return MI * 63360; }


x86 assembly (clang, -O0):
<MItoIN>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @MItoIN(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 6.336000e+04
ret double %4
}

LLVM IR (-O2):
define double @MItoIN(double %0) {
%2 = fmul double %0, 6.336000e+04
ret double %2
}
__attribute__((no_profile_instrument_function)) int foo() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @foo() {
ret i32 0
}
void move16() {}


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

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

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

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

/* Variables and functions */
int do_accept(struct tcb *, int);
int sys_accept(struct tcb *tcp) { return do_accept(tcp, -1); }


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

x86 assembly (clang, -O2):
<sys_accept>:
mov    $0xffffffff,%esi
jmp    1030 <do_accept@plt>

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

LLVM IR (-O2):
%struct.tcb = type { i32 }
define i32 @sys_accept(%struct.tcb* %0) {
%2 = tail call i32 @do_accept(%struct.tcb* %0, i32 -1)
ret i32 %2
}
int mpi_get_diag_block_id(int i_block, int block_task_id, int n_diag_blocks) {
  return (i_block + block_task_id) % n_diag_blocks;
}


x86 assembly (clang, -O0):
<mpi_get_diag_block_id>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpi_get_diag_block_id>:
mov    %edx,%ecx
lea    (%rdi,%rsi,1),%eax
cltd
idiv   %ecx
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @mpi_get_diag_block_id(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* %5
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = srem i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @mpi_get_diag_block_id(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = srem i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int foo(int *);
int main(int argc, char **argv) {
  int bar = 0;
  return foo(&bar);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <foo@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <foo@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i32 @foo(i32* %3)
ret i32 %5
}