xunge/DecIR huggingface dataset:
int high_bits_set(int c) {
  int ret = 0;
  while (1) {
    if ((c & 0x80) != 0x080)
      break;
    c <<= 1;
    ++ret;
  }
  return ret;
}


x86 assembly (clang, -O0):
<high_bits_set>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x80,%eax
je     1126 <high_bits_set+0x26>
jmp    113d <high_bits_set+0x3d>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <high_bits_set+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<high_bits_set>:
xor    %eax,%eax
test   $0x80,%dil
je     111e <high_bits_set+0x1e>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
lea    (%rdi,%rdi,1),%ecx
add    $0x1,%eax
test   $0x40,%dil
mov    %ecx,%edi
jne    1110 <high_bits_set+0x10>
ret

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

LLVM IR (-O2):
define i32 @high_bits_set(i32 %0) {
%2 = and i32 %0, 128
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i32 [ %7, %4 ], [ %0, %1 ]
%7 = shl i32 %6, 1
%8 = add nuw nsw i32 %5, 1
%9 = and i32 %6, 64
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void MG_init(void) {
  printf("ERROR: MG_init called but DDalphaAMG library not included.\n");
  exit(1);
}


x86 assembly (clang, -O0):
<MG_init>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<MG_init>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [60 x i8] c"ERROR: MG_init called but DDalphaAMG library not included.\0A\00"
define void @MG_init() {
%1 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [59 x i8] c"ERROR: MG_init called but DDalphaAMG library not included.\00"
define void @MG_init() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ aprintf(char *, int, char *, char *);
int main(int argc, char *argv[]) {
  aprintf("%d\n%s\n%s\n", argc + 1, argv[0], argv[1]);
  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    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xebe(%rip),%rdi
call   1030 <aprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x1(%rdi),%eax
mov    (%rsi),%rdx
mov    0x8(%rsi),%rcx
lea    0xede(%rip),%rdi
mov    %eax,%esi
call   1030 <aprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d\0A%s\0A%s\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* %4
%7 = add nsw i32 %6, 1
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 0
%10 = load i8*, i8** %9
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @aprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %10, i8* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d\0A%s\0A%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = add nsw i32 %0, 1
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @aprintf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3, i8* %4, i8* %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ miniuart_putc(int /*<<< orphan*/);
void miniuart_puts(const char *str) {
  while (*str) {
    miniuart_putc(*str++);
  }
}


x86 assembly (clang, -O0):
<miniuart_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <miniuart_puts+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <miniuart_putc@plt>
jmp    111c <miniuart_puts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @miniuart_puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @miniuart_putc(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ df_disconnect();
void df_abort() { df_disconnect(); }


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

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

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

LLVM IR (-O2):
define void @df_abort() {
%1 = tail call i32 (...) @df_disconnect()
ret void
}
/* Variables and functions */
scalar_t__ parse_int(char const *, int, int, int *);
int /*<<< orphan*/ player_set_buffer_chunks(int);
void set_buffer_seconds(unsigned int id, const char *buf) {
  int sec;
  if (parse_int(buf, 1, 300, &sec))
    player_set_buffer_chunks((sec * (44100 * 16 / 8 * 2) + (60 * 1024) / 2) /
                             (60 * 1024));
}


x86 assembly (clang, -O0):
<set_buffer_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x12c,%edx
lea    -0x14(%rbp),%rcx
call   1040 <parse_int@plt>
cmp    $0x0,%rax
je     116b <set_buffer_seconds+0x4b>
imul   $0x2b110,-0x14(%rbp),%eax
add    $0x7800,%eax
mov    $0xf000,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <player_set_buffer_chunks@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_buffer_seconds>:
push   %rax
mov    %rsi,%rdi
lea    0x4(%rsp),%rcx
mov    $0x1,%esi
mov    $0x12c,%edx
call   1040 <parse_int@plt>
test   %rax,%rax
je     1173 <set_buffer_seconds+0x53>
imul   $0x2b110,0x4(%rsp),%eax
mov    %eax,%ecx
add    $0x7800,%ecx
movslq %ecx,%rcx
imul   $0xffffffff88888889,%rcx,%rcx
shr    $0x20,%rcx
lea    (%rcx,%rax,1),%edi
add    $0x7800,%edi
mov    %edi,%eax
shr    $0x1f,%eax
sar    $0xf,%edi
add    %eax,%edi
call   1030 <player_set_buffer_chunks@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @set_buffer_seconds(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i64 @parse_int(i8* %6, i32 1, i32 300, i32* %5)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i32, i32* %5
%11 = mul nsw i32 %10, 176400
%12 = add nsw i32 %11, 30720
%13 = sdiv i32 %12, 61440
%14 = call i32 @player_set_buffer_chunks(i32 %13)
br label %15
15: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
define void @set_buffer_seconds(i32 %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i64 @parse_int(i8* %1, i32 1, i32 300, i32* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 176400
%10 = add nsw i32 %9, 30720
%11 = sdiv i32 %10, 61440
%12 = call i32 @player_set_buffer_chunks(i32 %11)
br label %13
13: ; preds = %7, %2
ret void
}
int LIB2() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @LIB2() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_slli_epi32(int /*<<< orphan*/, int);
__m128i __attribute__((no, unused)) test31(__m128i s1) {
  return _mm_slli_epi32(s1, 31);
}


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

x86 assembly (clang, -O2):
<test31>:
mov    $0x1f,%esi
jmp    1030 <_mm_slli_epi32@plt>

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

LLVM IR (-O2):
define i32 @test31(i32 %0) {
%2 = tail call i32 @_mm_slli_epi32(i32 %0, i32 31)
ret i32 %2
}
float scale(float val, float valmin, float valmax, float min, float max) {
  float valscale = (val - valmin) / (valmax - valmin);
  return valscale * (max - min) + min;
}


x86 assembly (clang, -O0):
<scale>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
subss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
subss  -0x10(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale>:
subss  %xmm1,%xmm0
subss  %xmm1,%xmm2
divss  %xmm2,%xmm0
subss  %xmm3,%xmm4
mulss  %xmm4,%xmm0
addss  %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @scale(float %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%12 = load float, float* %6
%13 = load float, float* %7
%14 = fsub float %12, %13
%15 = load float, float* %8
%16 = load float, float* %7
%17 = fsub float %15, %16
%18 = fdiv float %14, %17
store float %18, float* %11
%19 = load float, float* %11
%20 = load float, float* %10
%21 = load float, float* %9
%22 = fsub float %20, %21
%23 = load float, float* %9
%24 = call float @llvm.fmuladd.f32(float %19, float %22, float %23)
ret float %24
}

LLVM IR (-O2):
define float @scale(float %0, float %1, float %2, float %3, float %4) {
%6 = fsub float %0, %1
%7 = fsub float %2, %1
%8 = fdiv float %6, %7
%9 = fsub float %4, %3
%10 = tail call float @llvm.fmuladd.f32(float %8, float %9, float %3)
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
void sigpipe_handler(int sig) {
  printf("sigpipe_handler(): received signal %d\n", sig);
  signal(SIGPIPE, sigpipe_handler);
}


x86 assembly (clang, -O0):
<sigpipe_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
mov    0x2e9e(%rip),%rsi
call   1040 <signal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigpipe_handler>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    0x2ea9(%rip),%rsi
pop    %rax
jmp    1040 <signal@plt>

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

LLVM IR (-O2):
@.str = [39 x i8] c"sigpipe_handler(): received signal %d\0A\00"
@SIGPIPE = global i32 0
define void @sigpipe_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = load i32, i32* @SIGPIPE
%4 = tail call i32 @signal(i32 %3, void (i32)* @sigpipe_handler)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parse_mark(char *);
int /*<<< orphan*/ show_marks();
void cmd_mark(char *arg) {
  if (!*arg)
    show_marks();
  else
    parse_mark(arg);
}


x86 assembly (clang, -O0):
<cmd_mark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1145 <cmd_mark+0x25>
mov    $0x0,%al
call   1030 <show_marks@plt>
jmp    114e <cmd_mark+0x2e>
mov    -0x8(%rbp),%rdi
call   1040 <parse_mark@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_mark>:
cmpb   $0x0,(%rdi)
je     112a <cmd_mark+0xa>
jmp    1040 <parse_mark@plt>
xor    %eax,%eax
jmp    1030 <show_marks@plt>

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

LLVM IR (-O2):
define void @cmd_mark(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @show_marks()
br label %8
6: ; preds = %1
%7 = tail call i32 @parse_mark(i8* %0)
br label %8
8: ; preds = %6, %4
ret void
}
unsigned float_neg(unsigned uf) {
  unsigned result;
  unsigned tmp;
  tmp = uf & (0x7fffffff);
  result = uf ^ 0x80000000;
  if (tmp > 0x7f800000)
    result = uf;
  return result;
}


x86 assembly (clang, -O0):
<float_neg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x7fffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x80000000,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x7f800000,-0xc(%rbp)
jbe    1130 <float_neg+0x30>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_neg>:
mov    %edi,%ecx
and    $0x7fffffff,%ecx
mov    %edi,%eax
xor    $0x80000000,%eax
cmp    $0x7f800001,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @float_neg(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = and i32 %5, 2147483647
store i32 %6, i32* %4
%7 = load i32, i32* %2
%8 = xor i32 %7, -2147483648
store i32 %8, i32* %3
%9 = load i32, i32* %4
%10 = icmp ugt i32 %9, 2139095040
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load i32, i32* %2
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %1
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @float_neg(i32 %0) {
%2 = and i32 %0, 2147483647
%3 = xor i32 %0, -2147483648
%4 = icmp ugt i32 %2, 2139095040
%5 = select i1 %4, i32 %0, i32 %3
ret i32 %5
}
OP(ed, ec) {}


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

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

LLVM IR (-O0):
define i32 @OP(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* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
int exact_square(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num, res;
  scanf("%d", &num);
  res = exact_square(num);
  printf("%d\n", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <exact_square@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <exact_square@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%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"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = call i32 @exact_square(i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @exact_square(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
int i915_debugfs_connector_add(struct drm_connector *connector) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.drm_connector = type opaque
define i32 @i915_debugfs_connector_add(%struct.drm_connector* nocapture readnone %0) {
ret i32 0
}
double CalculateE2Squared(double a, double b) {
  return ((a * a) - (b * b)) / (b * b);
}


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

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

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

LLVM IR (-O2):
define double @CalculateE2Squared(double %0, double %1) {
%3 = fmul double %1, %1
%4 = fneg double %3
%5 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %4)
%6 = fdiv double %5, %3
ret double %6
}
/* Variables and functions */
scalar_t__ is_a20_platform();
scalar_t__ is_s500_platform();
int get_lmk_revision(void) {
  if (is_a20_platform()) {
    return 0x2;
  } else if (is_s500_platform()) {
    return 0x3;
  }
  return -1;
}


x86 assembly (clang, -O0):
<get_lmk_revision>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <is_a20_platform@plt>
cmp    $0x0,%rax
je     1145 <get_lmk_revision+0x25>
movl   $0x2,-0x4(%rbp)
jmp    116e <get_lmk_revision+0x4e>
mov    $0x0,%al
call   1040 <is_s500_platform@plt>
cmp    $0x0,%rax
je     1162 <get_lmk_revision+0x42>
movl   $0x3,-0x4(%rbp)
jmp    116e <get_lmk_revision+0x4e>
jmp    1167 <get_lmk_revision+0x47>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_lmk_revision>:
push   %rax
xor    %eax,%eax
call   1030 <is_a20_platform@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
je     1137 <get_lmk_revision+0x17>
pop    %rcx
ret
xor    %eax,%eax
call   1040 <is_s500_platform@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
or     $0x3,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @get_lmk_revision() {
%1 = tail call i64 (...) @is_a20_platform()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i64 (...) @is_s500_platform()
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i32 -1, i32 3
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ 2, %0 ], [ %6, %3 ]
ret i32 %8
}
/* Type definitions */
struct wl_proxy {
  int dummy;
};
struct wl_pointer_listener {
  int dummy;
};
struct wl_pointer {
  int dummy;
};

/* Variables and functions */
int wl_proxy_add_listener(struct wl_proxy *, void (*)(), void *);
int wl_pointer_add_listener(struct wl_pointer *wl_pointer,
                            const struct wl_pointer_listener *listener,
                            void *data) {
  return wl_proxy_add_listener((struct wl_proxy *)wl_pointer,
                               (void (**)(void))listener, data);
}


x86 assembly (clang, -O0):
<wl_pointer_add_listener>:
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
mov    -0x18(%rbp),%rdx
call   1030 <wl_proxy_add_listener@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_pointer_add_listener>:
jmp    1030 <wl_proxy_add_listener@plt>

LLVM IR (-O0):
%struct.wl_pointer = type { i32 }
%struct.wl_pointer_listener = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_pointer_add_listener(%struct.wl_pointer* %0, %struct.wl_pointer_listener* %1, i8* %2) {
%4 = alloca %struct.wl_pointer*
%5 = alloca %struct.wl_pointer_listener*
%6 = alloca i8*
store %struct.wl_pointer* %0, %struct.wl_pointer** %4
store %struct.wl_pointer_listener* %1, %struct.wl_pointer_listener** %5
store i8* %2, i8** %6
%7 = load %struct.wl_pointer*, %struct.wl_pointer** %4
%8 = bitcast %struct.wl_pointer* %7 to %struct.wl_proxy*
%9 = load %struct.wl_pointer_listener*, %struct.wl_pointer_listener** %5
%10 = bitcast %struct.wl_pointer_listener* %9 to void ()**
%11 = bitcast void ()** %10 to void (...)*
%12 = load i8*, i8** %6
%13 = call i32 @wl_proxy_add_listener(%struct.wl_proxy* %8, void (...)* %11, i8* %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.wl_pointer = type { i32 }
%struct.wl_pointer_listener = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_pointer_add_listener(%struct.wl_pointer* %0, %struct.wl_pointer_listener* %1, i8* %2) {
%4 = bitcast %struct.wl_pointer* %0 to %struct.wl_proxy*
%5 = bitcast %struct.wl_pointer_listener* %1 to void (...)*
%6 = tail call i32 @wl_proxy_add_listener(%struct.wl_proxy* %4, void (...)* %5, i8* %2)
ret i32 %6
}
/* Variables and functions */
unsigned char GetByte(unsigned int);
unsigned char GetStackByte(unsigned int addr) { return GetByte(addr & 0xFFFF); }


x86 assembly (clang, -O0):
<GetStackByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
and    $0xffff,%edi
call   1030 <GetByte@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetStackByte>:
movzwl %di,%edi
jmp    1030 <GetByte@plt>

LLVM IR (-O0):
define zeroext i8 @GetStackByte(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65535
%5 = call zeroext i8 @GetByte(i32 %4)
ret i8 %5
}

LLVM IR (-O2):
define zeroext i8 @GetStackByte(i32 %0) {
%2 = and i32 %0, 65535
%3 = tail call zeroext i8 @GetByte(i32 %2)
ret i8 %3
}
unsigned long rev_log2(const unsigned long x) {
  return (unsigned long)(1 << x);
}


x86 assembly (clang, -O0):
<rev_log2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<rev_log2>:
mov    %rdi,%rcx
mov    $0x1,%eax
shl    %cl,%eax
cltq
ret

LLVM IR (-O0):
define i64 @rev_log2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = shl i32 1, %4
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
define i64 @rev_log2(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = shl nuw i32 1, %2
%4 = sext i32 %3 to i64
ret i64 %4
}
void flushLine(void *ramptr) { (void)ramptr; }


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

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

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

LLVM IR (-O2):
define void @flushLine(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fwrite(char **, int, size_t, int /*<<< orphan*/ *);
size_t utf8_format(char *, int /*<<< orphan*/);
int utf8_write_to(uint32_t codepoint, FILE *s) {
  char str[4];
  size_t len = utf8_format((char *)&str, codepoint);
  size_t n = fwrite(&str, sizeof(char), len, s);
  if (n != len) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<utf8_write_to>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <utf8_format@plt>
mov    %rax,-0x20(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fwrite@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1173 <utf8_write_to+0x53>
movl   $0x1,-0x4(%rbp)
jmp    117a <utf8_write_to+0x5a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_write_to>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %edi,%esi
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1030 <utf8_format@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x1,%esi
mov    %rax,%rdx
mov    %r15,%rcx
call   1040 <fwrite@plt>
xor    %ecx,%ecx
cmp    %rbx,%rax
setne  %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @utf8_write_to(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca [4 x i8]
%7 = alloca i64
%8 = alloca i64
store i32 %0, i32* %4
store i32* %1, i32** %5
%9 = bitcast [4 x i8]* %6 to i8*
%10 = load i32, i32* %4
%11 = call i64 @utf8_format(i8* %9, i32 %10)
store i64 %11, i64* %7
%12 = bitcast [4 x i8]* %6 to i8**
%13 = load i64, i64* %7
%14 = load i32*, i32** %5
%15 = call i64 @fwrite(i8** %12, i32 1, i64 %13, i32* %14)
store i64 %15, i64* %8
%16 = load i64, i64* %8
%17 = load i64, i64* %7
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %20
19: ; preds = %2
store i32 1, i32* %3
br label %21
20: ; preds = %2
store i32 0, i32* %3
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @utf8_write_to(i32 %0, i32* nocapture %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = call i64 @utf8_format(i8* %4, i32 %0)
%6 = bitcast [4 x i8]* %3 to i8**
%7 = call i64 @fwrite(i8** %6, i32 1, i64 %5, i32* %1)
%8 = icmp ne i64 %7, %5
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void write_byte(uint8_t byte, uint8_t *buf, int offset) { buf[offset] = byte; }


x86 assembly (clang, -O0):
<write_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_byte>:
movslq %edx,%rax
mov    %edi,(%rsi,%rax,4)
ret

LLVM IR (-O0):
define void @write_byte(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 = load i32, i32* %6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
store i32 %7, i32* %11
ret void
}

LLVM IR (-O2):
define void @write_byte(i32 %0, i32* nocapture writeonly %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i32, i32* %1, i64 %4
store i32 %0, i32* %5
ret void
}
void gtk_color_button_new_with_color() {}


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

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

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

LLVM IR (-O2):
define void @gtk_color_button_new_with_color() {
ret void
}
/* Variables and functions */
float logf(int);
float log2f(float x) { return logf(x) / logf(2); }


x86 assembly (clang, -O0):
<log2f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
cvttss2si -0x4(%rbp),%edi
call   1030 <logf@plt>
movss  %xmm0,-0x8(%rbp)
mov    $0x2,%edi
call   1030 <logf@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2f>:
push   %rax
cvttss2si %xmm0,%edi
call   1030 <logf@plt>
movss  %xmm0,0x4(%rsp)
mov    $0x2,%edi
call   1030 <logf@plt>
movss  0x4(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @log2f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fptosi float %3 to i32
%5 = call float @logf(i32 %4)
%6 = call float @logf(i32 2)
%7 = fdiv float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @log2f(float %0) {
%2 = fptosi float %0 to i32
%3 = tail call float @logf(i32 %2)
%4 = tail call float @logf(i32 2)
%5 = fdiv float %3, %4
ret float %5
}
/* Variables and functions */
scalar_t__ strtoimax(char const *, int /*<<< orphan*/, int);
int atoi(const char *s) { return (int)strtoimax(s, 0, 10); }


x86 assembly (clang, -O0):
<atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <strtoimax@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoi>:
xor    %esi,%esi
mov    $0xa,%edx
jmp    1030 <strtoimax@plt>

LLVM IR (-O0):
define i32 @atoi(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strtoimax(i8* %3, i32 0, i32 10)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @atoi(i8* %0) {
%2 = tail call i64 @strtoimax(i8* %0, i32 0, i32 10)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int errno;
int perrno() { return (errno); }


x86 assembly (clang, -O0):
<perrno>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<perrno>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @perrno() {
%1 = load i32, i32* @errno
ret i32 %1
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @perrno() {
%1 = load i32, i32* @errno
ret i32 %1
}
int nap(int n) {
  register i;
  while (n-- > 0) {
    for (i = 0; i < 1000 * 1000 * 10; i++)
      ;
  }
  return 0;
}


x86 assembly (clang, -O0):
<nap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    1147 <nap+0x47>
movl   $0x0,-0x8(%rbp)
cmpl   $0x989680,-0x8(%rbp)
jge    1142 <nap+0x42>
jmp    1134 <nap+0x34>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <nap+0x22>
jmp    1107 <nap+0x7>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @nap(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %2
%6 = add nsw i32 %5, -1
store i32 %6, i32* %2
%7 = icmp sgt i32 %5, 0
br i1 %7, label %8, label %17
8: ; preds = %4
store i32 0, i32* %3
br label %9
9: ; preds = %13, %8
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 10000000
br i1 %11, label %12, label %16
12: ; preds = %9
br label %13
13: ; preds = %12
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %9
16: ; preds = %9
br label %4
17: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
define i32 @nap(i32 %0) {
ret i32 0
}
double foo(double x, double y) { return __builtin_pow(x, 0.75) + y; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed1(%rip),%xmm1
call   1030 <pow@plt>
addsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
movsd  %xmm1,(%rsp)
movsd  0xee2(%rip),%xmm1
call   1030 <pow@plt>
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @foo(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 = call double @pow(double %5, double 7.500000e-01)
%7 = load double, double* %4
%8 = fadd double %6, %7
ret double %8
}

LLVM IR (-O2):
define double @foo(double %0, double %1) {
%3 = tail call double @pow(double %0, double 7.500000e-01)
%4 = fadd double %3, %1
ret double %4
}
/* Variables and functions */
int errno;
int /*<<< orphan*/ sprintf(char *, char *, int, char *);
char *strerror(int);
char *neterrstr(void) {
  static char buf[200];
  sprintf(buf, "errno = %d: %s", errno, strerror(errno));
  errno = 0;
  return buf;
}


x86 assembly (clang, -O0):
<neterrstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x4(%rbp),%edx
mov    %rax,%rcx
lea    0x2ef1(%rip),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <sprintf@plt>
mov    0x2e7e(%rip),%rax
movl   $0x0,(%rax)
lea    0x2ed1(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<neterrstr>:
push   %r15
push   %r14
push   %rbx
mov    0x2eb4(%rip),%r15
mov    (%r15),%ebx
mov    %ebx,%edi
call   1040 <strerror@plt>
lea    0x2f03(%rip),%r14
lea    0xebc(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
mov    %rax,%rcx
call   1030 <sprintf@plt>
movl   $0x0,(%r15)
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@neterrstr.buf = internal global [200 x i8] zeroinitializer
@.str = [15 x i8] c"errno = %d: %s\00"
@errno = global i32 0
define i8* @neterrstr() {
%1 = load i32, i32* @errno
%2 = load i32, i32* @errno
%3 = call i8* @strerror(i32 %2)
%4 = call i32 @sprintf(i8* getelementptr inbounds ([200 x i8], [200 x i8]* @neterrstr.buf, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %3)
store i32 0, i32* @errno
ret i8* getelementptr inbounds ([200 x i8], [200 x i8]* @neterrstr.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@neterrstr.buf = internal global [200 x i8] zeroinitializer
@.str = [15 x i8] c"errno = %d: %s\00"
@errno = global i32 0
define i8* @neterrstr() {
%1 = load i32, i32* @errno
%2 = tail call i8* @strerror(i32 %1)
%3 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([200 x i8], [200 x i8]* @neterrstr.buf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %2)
store i32 0, i32* @errno
ret i8* getelementptr inbounds ([200 x i8], [200 x i8]* @neterrstr.buf, i64 0, i64 0)
}
/* Variables and functions */
float cos(float);
float sin(float);
float tan(float n) { return sin(n) / cos(n); }


x86 assembly (clang, -O0):
<tan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sin@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tan>:
push   %rax
movss  %xmm0,(%rsp)
call   1030 <sin@plt>
movss  %xmm0,0x4(%rsp)
movss  (%rsp),%xmm0
call   1040 <cos@plt>
movss  0x4(%rsp),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @tan(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @sin(float %3)
%5 = load float, float* %2
%6 = call float @cos(float %5)
%7 = fdiv float %4, %6
ret float %7
}

LLVM IR (-O2):
define float @tan(float %0) {
%2 = tail call float @sin(float %0)
%3 = tail call float @cos(float %0)
%4 = fdiv float %2, %3
ret float %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void QEIVelocityDisable(uint32_t ui32Base) {
  ASSERT((ui32Base == 0x4002C000) || (ui32Base == 0x4002D000));
  (*((volatile uint32_t *)(ui32Base + 0x00000000))) &= ~(0x00000020);
}


x86 assembly (clang, -O0):
<QEIVelocityDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x4002c000,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     113a <QEIVelocityDisable+0x2a>
cmpl   $0x4002d000,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x0,%eax
cltq
mov    (%rax),%ecx
and    $0xffffffdf,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<QEIVelocityDisable>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x4002c000,%eax
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
andl   $0xffffffdf,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @QEIVelocityDisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1073922048
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 1073926144
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
%11 = call i32 @ASSERT(i32 %10)
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 0
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = and i32 %16, -33
store volatile i32 %17, i32* %15
ret void
}

LLVM IR (-O2):
define void @QEIVelocityDisable(i32 %0) {
%2 = and i32 %0, -4097
%3 = icmp eq i32 %2, 1073922048
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = sext i32 %0 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, -33
store volatile i32 %9, i32* %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ xlfail(char *);
badiop(void) { xlfail("bad integer operation"); }


x86 assembly (clang, -O0):
<badiop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <xlfail@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [22 x i8] c"bad integer operation\00"
define i32 @badiop() {
%1 = alloca i32
%2 = call i32 @xlfail(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [22 x i8] c"bad integer operation\00"
define i32 @badiop() {
%1 = tail call i32 @xlfail(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int hwlist_lcd_ppi(const char *value) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @hwlist_lcd_ppi(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int *malloc(int);
int *makeIndirection(int i) {
  int si = sizeof(int);
  int *p;
  p = malloc(si);
  if (p == 0) {
  END:
    goto END;
  }
  *p = i;
  return p;
}


x86 assembly (clang, -O0):
<makeIndirection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <makeIndirection+0x33>
jmp    113e <makeIndirection+0x2e>
jmp    113e <makeIndirection+0x2e>
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeIndirection>:
push   %rbx
mov    %edi,%ebx
mov    $0x4,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     1130 <makeIndirection+0x20>
mov    %ebx,(%rax)
pop    %rbx
ret
cs nopw 0x0(%rax,%rax,1)
jmp    1130 <makeIndirection+0x20>

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

LLVM IR (-O2):
define noalias i32* @makeIndirection(i32 %0) {
%2 = tail call i32* @malloc(i32 4)
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %5
4: ; preds = %1, %4
br label %4
5: ; preds = %1
store i32 %0, i32* %2
ret i32* %2
}
int test_imm_D7int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0xD7 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_D7int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 923417968640
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char *two_digits(char *s, int x) {
  s[0] = '0' + x / 10;
  s[1] = '0' + x % 10;
  return s + 2;
}


x86 assembly (clang, -O0):
<two_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<two_digits>:
movslq %esi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    0x30(%rcx),%edx
mov    %dl,(%rdi)
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x30,%al
mov    %al,0x1(%rdi)
lea    0x2(%rdi),%rax
ret

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

LLVM IR (-O2):
define i8* @two_digits(i8* writeonly %0, i32 %1) {
%3 = sdiv i32 %1, 10
%4 = trunc i32 %3 to i8
%5 = add i8 %4, 48
store i8 %5, i8* %0
%6 = srem i32 %1, 10
%7 = trunc i32 %6 to i8
%8 = add nsw i8 %7, 48
%9 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %8, i8* %9
%10 = getelementptr inbounds i8, i8* %0, i64 2
ret i8* %10
}
void ScaleRowDown34_0_Box_SSSE3() {}


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

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

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

LLVM IR (-O2):
define void @ScaleRowDown34_0_Box_SSSE3() {
ret void
}
void variableLengthArray(int rows, int cols, int arr[rows][cols]) {
  for (int i = 0; i < cols; ++i) {
  }
}


x86 assembly (clang, -O0):
<variableLengthArray>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1134 <variableLengthArray+0x34>
jmp    1126 <variableLengthArray+0x26>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <variableLengthArray+0x15>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @variableLengthArray(i32 %0, i32 %1, i32* nocapture %2) {
ret void
}
int f1(int x) {
  switch (x) {
  default:
    return 3;
  case 10 ... 0xFFFFFFFF:
    return 0;
  }
}


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

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

LLVM IR (-O0):
define i32 @f1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %5 [
]
5: ; preds = %1
store i32 3, i32* %2
br label %7
6: ; No predecessors!
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @f1(i32 %0) {
ret i32 3
}