xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ insertion_sort(int *, int);
int /*<<< orphan*/ quick_sort4var2(int *, int /*<<< orphan*/, int);
void sort4var2(int32_t *a, int32_t n) {
  if (n > 9)
    quick_sort4var2(a, 0, n);
  insertion_sort(a, n);
}


x86 assembly (clang, -O0):
<sort4var2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jle    1147 <sort4var2+0x27>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <quick_sort4var2@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <insertion_sort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort4var2>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
cmp    $0xa,%esi
jl     113a <sort4var2+0x1a>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1030 <quick_sort4var2@plt>
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <insertion_sort@plt>

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

LLVM IR (-O2):
define void @sort4var2(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 9
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @quick_sort4var2(i32* %0, i32 0, i32 %1)
br label %6
6: ; preds = %4, %2
%7 = tail call i32 @insertion_sort(i32* %0, i32 %1)
ret void
}
long get_min_by_max(long max) {
  long min = -1 - max;
  return min;
}


x86 assembly (clang, -O0):
<get_min_by_max>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0xffffffffffffffff,%rax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @get_min_by_max(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = sub nsw i64 -1, %4
store i64 %5, i64* %3
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_min_by_max(i64 %0) {
%2 = xor i64 %0, -1
ret i64 %2
}
/* Variables and functions */
int nextquadlabel();
int manage_whilestart_WHILE() { return nextquadlabel(); }


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

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

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

LLVM IR (-O2):
define i32 @manage_whilestart_WHILE() {
%1 = tail call i32 (...) @nextquadlabel()
ret i32 %1
}
/* Variables and functions */
int a_fetch_add(int volatile *, int);
int a_inc(volatile int *x) { return a_fetch_add(x, 1); }


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

x86 assembly (clang, -O2):
<a_inc>:
mov    $0x1,%esi
jmp    1030 <a_fetch_add@plt>

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

LLVM IR (-O2):
define i32 @a_inc(i32* %0) {
%2 = tail call i32 @a_fetch_add(i32* %0, i32 1)
ret i32 %2
}
int btoi(unsigned char *b) {
  return (b[3] << 24) | (b[2] << 16) | (b[1] << 8) | (b[0]);
}


x86 assembly (clang, -O0):
<btoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<btoi>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @btoi(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 3
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 %6, 24
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 16
%13 = or i32 %7, %12
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = or i32 %13, %18
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = or i32 %19, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @btoi(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = shl nuw i32 %4, 24
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = shl nuw nsw i32 %8, 16
%10 = or i32 %9, %5
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = shl nuw nsw i32 %13, 8
%15 = or i32 %10, %14
%16 = load i8, i8* %0
%17 = zext i8 %16 to i32
%18 = or i32 %15, %17
ret i32 %18
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
uint8_t Function1Uint8(uint8_t x) { return x + 42; }


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

x86 assembly (clang, -O2):
<Function1Uint8>:
lea    0x2a(%rdi),%rax
ret

LLVM IR (-O0):
define i64 @Function1Uint8(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 42
ret i64 %4
}

LLVM IR (-O2):
define i64 @Function1Uint8(i64 %0) {
%2 = add nsw i64 %0, 42
ret i64 %2
}
/* Variables and functions */
float floor(float);
float Float_floor(float x) { return floor(x); }


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

x86 assembly (clang, -O2):
<Float_floor>:
jmp    1030 <floorf@plt>

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

LLVM IR (-O2):
define float @Float_floor(float %0) {
%2 = tail call float @llvm.floor.f32(float %0)
ret float %2
}
/* Variables and functions */
int f47(int *);
int f48(int *p) { return f47(p); }


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

x86 assembly (clang, -O2):
<f48>:
jmp    1030 <f47@plt>

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

LLVM IR (-O2):
define i32 @f48(i32* %0) {
%2 = tail call i32 @f47(i32* %0)
ret i32 %2
}
int Operand_xt_wbr18_label_encode(unsigned int *valp) {
  unsigned xt_wbr18_imm_0, xt_wbr18_label_0;
  xt_wbr18_label_0 = *valp;
  xt_wbr18_imm_0 = (xt_wbr18_label_0 - 0x4) & 0x3ffff;
  *valp = xt_wbr18_imm_0;
  return 0;
}


x86 assembly (clang, -O0):
<Operand_xt_wbr18_label_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
and    $0x3ffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_xt_wbr18_label_encode>:
mov    $0x3fffc,%eax
add    (%rdi),%eax
and    $0x3ffff,%eax
mov    %eax,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @Operand_xt_wbr18_label_encode(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = sub i32 %7, 4
%9 = and i32 %8, 262143
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = load i32*, i32** %2
store i32 %10, i32* %11
ret i32 0
}

LLVM IR (-O2):
define i32 @Operand_xt_wbr18_label_encode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add i32 %2, 262140
%4 = and i32 %3, 262143
store i32 %4, i32* %0
ret i32 0
}
unsigned short decode_artnet_uint16_hilo(unsigned char *data) {
  unsigned short ret;
  ret = data[0];
  ret <<= 8;
  ret |= data[1];
  return ret;
}


x86 assembly (clang, -O0):
<decode_artnet_uint16_hilo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
shl    $0x8,%eax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%ecx
movzwl -0xa(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_artnet_uint16_hilo>:
movzwl (%rdi),%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @decode_artnet_uint16_hilo(i8* %0) {
%2 = alloca i8*
%3 = alloca i16
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i16
store i16 %7, i16* %3
%8 = load i16, i16* %3
%9 = zext i16 %8 to i32
%10 = shl i32 %9, 8
%11 = trunc i32 %10 to i16
store i16 %11, i16* %3
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i16, i16* %3
%17 = zext i16 %16 to i32
%18 = or i32 %17, %15
%19 = trunc i32 %18 to i16
store i16 %19, i16* %3
%20 = load i16, i16* %3
ret i16 %20
}

LLVM IR (-O2):
define zeroext i16 @decode_artnet_uint16_hilo(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i16
%4 = shl nuw i16 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i16
%8 = or i16 %4, %7
ret i16 %8
}
void gtk_progress_bar_set_fraction() {}


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

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

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

LLVM IR (-O2):
define void @gtk_progress_bar_set_fraction() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GL_LINES;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2f(float, float);
void graphic_draw_segment(float x1, float y1, float x2, float y2) {
  glBegin(GL_LINES);
  glVertex2f(x1, y1);
  glVertex2f(x2, y2);
  glEnd();
}


x86 assembly (clang, -O0):
<graphic_draw_segment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1040 <glVertex2f@plt>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1040 <glVertex2f@plt>
mov    $0x0,%al
call   1030 <glEnd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<graphic_draw_segment>:
sub    $0x18,%rsp
movss  %xmm3,0x14(%rsp)
movss  %xmm2,0x10(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1040 <glVertex2f@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
call   1040 <glVertex2f@plt>
xor    %eax,%eax
add    $0x18,%rsp
jmp    1030 <glEnd@plt>

LLVM IR (-O0):
@GL_LINES = global i32 0
define void @graphic_draw_segment(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 i32, i32* @GL_LINES
%10 = call i32 @glBegin(i32 %9)
%11 = load float, float* %5
%12 = load float, float* %6
%13 = call i32 @glVertex2f(float %11, float %12)
%14 = load float, float* %7
%15 = load float, float* %8
%16 = call i32 @glVertex2f(float %14, float %15)
%17 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_LINES = global i32 0
define void @graphic_draw_segment(float %0, float %1, float %2, float %3) {
%5 = load i32, i32* @GL_LINES
%6 = tail call i32 @glBegin(i32 %5)
%7 = tail call i32 @glVertex2f(float %0, float %1)
%8 = tail call i32 @glVertex2f(float %2, float %3)
%9 = tail call i32 (...) @glEnd()
ret void
}
void a_and(volatile int *p, int v) {
  __asm__("lock ; andl %1, %0" : "=m"(*p) : "r"(v) : "memory");
}


x86 assembly (clang, -O0):
<a_and>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
lock and %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_and>:
lock and %esi,(%rdi)
ret

LLVM IR (-O0):
define void @a_and(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
ret void
}

LLVM IR (-O2):
define void @a_and(i32* %0, i32 %1) {
tail call void asm "lock ; andl $1, $0", "=*m,r,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %0, i32 %1)
ret void
}
void I2C1_EV_IRQHandler(void) {}


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

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

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

LLVM IR (-O2):
define void @I2C1_EV_IRQHandler() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ remove(char const *);
void delete_file(const char *file_name) { remove(file_name); }


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

x86 assembly (clang, -O2):
<delete_file>:
jmp    1030 <remove@plt>

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

LLVM IR (-O2):
define void @delete_file(i8* nocapture %0) {
%2 = tail call i32 @remove(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isprint(int);
void t_isprint_0xfe() {
  Assert_real((isprint(254) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isprint.c",
              1275, ("isprint should be 0 for 0xfe"));
}


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

x86 assembly (clang, -O2):
<t_isprint_0xfe>:
push   %rax
mov    $0xfe,%edi
call   1030 <isprint@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4fb,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

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

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isprint.c\00"
@.str.1 = [29 x i8] c"isprint should be 0 for 0xfe\00"
define void @t_isprint_0xfe() {
%1 = tail call i64 @isprint(i32 254)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1275, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void ExttRequestAuxTable(void) {}


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

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

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

LLVM IR (-O2):
define void @ExttRequestAuxTable() {
ret void
}
unsigned char f31(unsigned char x, unsigned int y) {
  return (x >> ((-y) & (8 * sizeof(unsigned char) - 1))) ^ (x << y);
}


x86 assembly (clang, -O0):
<f31>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
mov    %ecx,%ecx
and    $0x7,%rcx
sar    %cl,%eax
movzbl -0x1(%rbp),%edx
mov    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
xor    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f31>:
mov    %esi,%ecx
neg    %cl
and    $0x7,%cl
mov    %edi,%eax
shr    %cl,%eax
mov    %esi,%ecx
shl    %cl,%edi
xor    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @f31(i8 zeroext %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 = zext i8 %5 to i32
%7 = load i32, i32* %4
%8 = sub i32 0, %7
%9 = zext i32 %8 to i64
%10 = and i64 %9, 7
%11 = trunc i64 %10 to i32
%12 = ashr i32 %6, %11
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = load i32, i32* %4
%16 = shl i32 %14, %15
%17 = xor i32 %12, %16
%18 = trunc i32 %17 to i8
ret i8 %18
}

LLVM IR (-O2):
define zeroext i8 @f31(i8 zeroext %0, i32 %1) {
%3 = zext i8 %0 to i32
%4 = sub i32 0, %1
%5 = and i32 %4, 7
%6 = lshr i32 %3, %5
%7 = shl i32 %3, %1
%8 = xor i32 %6, %7
%9 = trunc i32 %8 to i8
ret i8 %9
}
/* Variables and functions */
int /*<<< orphan*/ pic16n_standby();
int /*<<< orphan*/ pic16n_write_config();
int /*<<< orphan*/ pic_write_panel(int, int, int);
void pic16n_program_end(int config) {
  pic_write_panel((3), (0xFFFF), (0xFFFF));
  pic16n_standby();
  if (config)
    pic16n_write_config();
}


x86 assembly (clang, -O0):
<pic16n_program_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x3,%edi
mov    $0xffff,%edx
mov    %edx,%esi
call   1030 <pic_write_panel@plt>
mov    $0x0,%al
call   1040 <pic16n_standby@plt>
cmpl   $0x0,-0x4(%rbp)
je     1164 <pic16n_program_end+0x34>
mov    $0x0,%al
call   1050 <pic16n_write_config@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pic16n_program_end>:
push   %rbx
mov    %edi,%ebx
mov    $0x3,%edi
mov    $0xffff,%esi
mov    $0xffff,%edx
call   1030 <pic_write_panel@plt>
xor    %eax,%eax
call   1040 <pic16n_standby@plt>
test   %ebx,%ebx
je     115a <pic16n_program_end+0x2a>
xor    %eax,%eax
pop    %rbx
jmp    1050 <pic16n_write_config@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @pic16n_program_end(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @pic_write_panel(i32 3, i32 65535, i32 65535)
%4 = call i32 (...) @pic16n_standby()
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 (...) @pic16n_write_config()
br label %9
9: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
define void @pic16n_program_end(i32 %0) {
%2 = tail call i32 @pic_write_panel(i32 3, i32 65535, i32 65535)
%3 = tail call i32 (...) @pic16n_standby()
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @pic16n_write_config()
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int sum = 0;
  for (int i = 1, j = 2; i <= 4000000;) {
    j = i + j;
    i = j - i;
    if (i % 2 == 0) {
      sum += i;
    }
  }
  printf("%d\n", sum);
}


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)
movl   $0x1,-0x18(%rbp)
movl   $0x2,-0x1c(%rbp)
cmpl   $0x3d0900,-0x18(%rbp)
jg     117c <main+0x6c>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1177 <main+0x67>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    113b <main+0x2b>
mov    -0x14(%rbp),%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 1, i32* %7
store i32 2, i32* %8
br label %9
9: ; preds = %26, %2
%10 = load i32, i32* %7
%11 = icmp sle i32 %10, 4000000
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = add nsw i32 %13, %14
store i32 %15, i32* %8
%16 = load i32, i32* %8
%17 = load i32, i32* %7
%18 = sub nsw i32 %16, %17
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = srem i32 %19, 2
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %12
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = add nsw i32 %24, %23
store i32 %25, i32* %6
br label %26
26: ; preds = %22, %12
br label %9
27: ; preds = %9
%28 = load i32, i32* %6
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4613732)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ handle_60(int /*<<< orphan*/);
int gen_60() {
  handle_60(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_60>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_60@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gen_60() {
%1 = call i32 @handle_60(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_60() {
%1 = tail call i32 @handle_60(i32 0)
ret i32 0
}
int test_imm_33int16_reg(short val) {
  return ((val) & (0x33 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_33int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x33,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_33int16_reg>:
test   $0x33,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_33int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 51
%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_33int16_reg(i16 signext %0) {
%2 = and i16 %0, 51
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
extern void simdtrellis(unsigned int *nodemetric1, unsigned int *nodemetric2,
                        unsigned int *metrictab, unsigned short *backptr,
                        int vr, int vi) {}


x86 assembly (clang, -O0):
<simdtrellis>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @simdtrellis(i32* %0, i32* %1, i32* %2, i16* %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i16*
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i16* %3, i16** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
ret void
}

LLVM IR (-O2):
define void @simdtrellis(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2, i16* nocapture %3, i32 %4, i32 %5) {
ret void
}
int snul(char *c) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @snul(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int mkostemp(char *, int);
void no_resourceLeak_mkostemp_01(char *template, int flags) {
  int fp = mkostemp(template, flags);
  close(fp);
}


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

x86 assembly (clang, -O2):
<no_resourceLeak_mkostemp_01>:
push   %rax
call   1030 <mkostemp@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <close@plt>

LLVM IR (-O0):
define void @no_resourceLeak_mkostemp_01(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @mkostemp(i8* %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = call i32 @close(i32 %9)
ret void
}

LLVM IR (-O2):
define void @no_resourceLeak_mkostemp_01(i8* %0, i32 %1) {
%3 = tail call i32 @mkostemp(i8* %0, i32 %1)
%4 = tail call i32 @close(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errnoexit(char *);
int send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int say(int socket, char *s) {
  int result = send(socket, s, strlen(s), 0);
  if (result == -1)
    errnoexit("Error talking to the server");
  return result;
}


x86 assembly (clang, -O0):
<say>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    117f <say+0x4f>
lea    0xe86(%rip),%rdi
call   1050 <errnoexit@plt>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<say>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1161 <say+0x31>
lea    0xea4(%rip),%rdi
call   1050 <errnoexit@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Error talking to the server\00"
define i32 @say(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 i32, i32* %3
%7 = load i8*, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @send(i32 %6, i8* %7, i32 %9, i32 0)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @errnoexit(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %2
%16 = load i32, i32* %5
ret i32 %16
}

LLVM IR (-O2):
@.str = [28 x i8] c"Error talking to the server\00"
define i32 @say(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @send(i32 %0, i8* %1, i32 %3, i32 0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @errnoexit(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret i32 %4
}
int config_get_int(const char *param, int *ret) {}


x86 assembly (clang, -O0):
<config_get_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @config_get_int(i8* nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 undef
}
int is_pointer(const char *buf) {
  if (('*' == buf[0])) {
    if (('*' == buf[1])) {
      return 2;
    }
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_pointer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x2a,%eax
cmp    %ecx,%eax
jne    1149 <is_pointer+0x49>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%ecx
mov    $0x2a,%eax
cmp    %ecx,%eax
jne    113d <is_pointer+0x3d>
movl   $0x2,-0x4(%rbp)
jmp    1150 <is_pointer+0x50>
movl   $0x1,-0x4(%rbp)
jmp    1150 <is_pointer+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_pointer>:
xor    %eax,%eax
cmpb   $0x2a,(%rdi)
jne    1113 <is_pointer+0x13>
xor    %eax,%eax
cmpb   $0x2a,0x1(%rdi)
sete   %al
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_pointer(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 42
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 42
%8 = select i1 %7, i32 2, i32 1
br label %9
9: ; preds = %1, %4
%10 = phi i32 [ %8, %4 ], [ 0, %1 ]
ret i32 %10
}
float my_sqrt(const float x) {
  const float xhalf = 0.5f * x;
  union {
    float x;
    int i;
  } u;
  u.x = x;
  u.i = 0x5f3759df - (u.i >> 1);
  return x * u.x * (1.5f - xhalf * u.x * u.x);
}


x86 assembly (clang, -O0):
<my_sqrt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef3(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
sar    $0x1,%ecx
mov    $0x5f3759df,%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe99(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_sqrt>:
movd   %xmm0,%eax
sar    %eax
mov    $0x5f3759df,%ecx
sub    %eax,%ecx
movd   %ecx,%xmm1
movdqa %xmm1,%xmm2
mulss  %xmm0,%xmm2
mulss  0xedf(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  0xed3(%rip),%xmm0
mulss  %xmm2,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { float }
define float @my_sqrt(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca %union.anon
store float %0, float* %2
%5 = load float, float* %2
%6 = fmul float 5.000000e-01, %5
store float %6, float* %3
%7 = load float, float* %2
%8 = bitcast %union.anon* %4 to float*
store float %7, float* %8
%9 = bitcast %union.anon* %4 to i32*
%10 = load i32, i32* %9
%11 = ashr i32 %10, 1
%12 = sub nsw i32 1597463007, %11
%13 = bitcast %union.anon* %4 to i32*
store i32 %12, i32* %13
%14 = load float, float* %2
%15 = bitcast %union.anon* %4 to float*
%16 = load float, float* %15
%17 = fmul float %14, %16
%18 = load float, float* %3
%19 = bitcast %union.anon* %4 to float*
%20 = load float, float* %19
%21 = fmul float %18, %20
%22 = bitcast %union.anon* %4 to float*
%23 = load float, float* %22
%24 = fneg float %21
%25 = call float @llvm.fmuladd.f32(float %24, float %23, float 1.500000e+00)
%26 = fmul float %17, %25
ret float %26
}

LLVM IR (-O2):
define float @my_sqrt(float %0) {
%2 = bitcast float %0 to i32
%3 = ashr i32 %2, 1
%4 = sub nsw i32 1597463007, %3
%5 = bitcast i32 %4 to float
%6 = fmul float %5, %0
%7 = fmul float %0, -5.000000e-01
%8 = fmul float %7, %5
%9 = tail call float @llvm.fmuladd.f32(float %8, float %5, float 1.500000e+00)
%10 = fmul float %6, %9
ret float %10
}
__attribute__((always_)) void
debug_object_destroy(void *addr, struct debug_obj_descr *descr) {}


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

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

LLVM IR (-O0):
%struct.debug_obj_descr = type opaque
define void @debug_object_destroy(i8* %0, %struct.debug_obj_descr* %1) {
%3 = alloca i8*
%4 = alloca %struct.debug_obj_descr*
store i8* %0, i8** %3
store %struct.debug_obj_descr* %1, %struct.debug_obj_descr** %4
ret void
}

LLVM IR (-O2):
%struct.debug_obj_descr = type opaque
define void @debug_object_destroy(i8* nocapture %0, %struct.debug_obj_descr* nocapture %1) {
ret void
}
int signum(double num) {
  if (num > 1e-10) {
    return 1;
  } else if (num < -1e-10) {
    return -1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<signum>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    112c <signum+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1152 <signum+0x52>
movsd  0xed4(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    114b <signum+0x4b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1152 <signum+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<signum>:
movsd  0xef8(%rip),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
neg    %ecx
ucomisd 0xeed(%rip),%xmm0
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @signum(double %0) {
%2 = fcmp ogt double %0, 1.000000e-10
%3 = fcmp olt double %0, -1.000000e-10
%4 = sext i1 %3 to i32
%5 = select i1 %2, i32 1, i32 %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void os_trace_api_u32(unsigned id, uint32_t p0) {}


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

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

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

LLVM IR (-O2):
define void @os_trace_api_u32(i32 %0, i32 %1) {
ret void
}
void UART2_Handler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<UART2_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <UART2_Handler+0x9>
jmp    1109 <UART2_Handler+0x9>

x86 assembly (clang, -O2):
<UART2_Handler>:
jmp    1100 <UART2_Handler>

LLVM IR (-O0):
define void @UART2_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @UART2_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int *returnSigned();
void signed_int_ptr() {
  int *x = returnSigned();
  if (*x < 0) {
    int y = 1 / 0;
  }
}


x86 assembly (clang, -O0):
<signed_int_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <returnSigned@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jge    1133 <signed_int_ptr+0x23>
mov    %eax,-0xc(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @signed_int_ptr() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32* (...) @returnSigned()
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = load i32, i32* %4
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 poison, i32* %2
br label %8
8: ; preds = %7, %0
ret void
}

LLVM IR (-O2):
define void @signed_int_ptr() {
%1 = tail call i32* (...) @returnSigned()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _k_init();
void __attribute__((constructor)) k_attach(void) { _k_init(); }


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

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

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @k_attach, i8* null }]
define void @k_attach() {
%1 = call i32 (...) @_k_init()
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @k_attach, i8* null }]
define void @k_attach() {
%1 = tail call i32 (...) @_k_init()
ret void
}
unsigned long mf_sec2ticks(secs, division, tempo)
int division;
unsigned int tempo;
float secs;
{ return (long)(((secs * 1000.0) / 4.0 * division) / tempo); }


x86 assembly (clang, -O0):
<mf_sec2ticks>:
push   %rbp
mov    %rsp,%rbp
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xedc(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0xc(%rbp),%eax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mf_sec2ticks>:
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xef0(%rip),%xmm0
mulsd  0xef0(%rip),%xmm0
cvtsi2sd %edi,%xmm1
mov    %esi,%eax
cvtsi2sd %rax,%xmm2
mulsd  %xmm0,%xmm1
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%rax
ret

LLVM IR (-O0):
define i64 @mf_sec2ticks(double %0, i32 %1, i32 %2) {
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
%7 = fptrunc double %0 to float
store float %7, float* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load float, float* %4
%9 = fpext float %8 to double
%10 = fmul double %9, 1.000000e+03
%11 = fdiv double %10, 4.000000e+00
%12 = load i32, i32* %5
%13 = sitofp i32 %12 to double
%14 = fmul double %11, %13
%15 = load i32, i32* %6
%16 = uitofp i32 %15 to double
%17 = fdiv double %14, %16
%18 = fptosi double %17 to i64
ret i64 %18
}

LLVM IR (-O2):
define i64 @mf_sec2ticks(double %0, i32 %1, i32 %2) {
%4 = fptrunc double %0 to float
%5 = fpext float %4 to double
%6 = fmul double %5, 1.000000e+03
%7 = fmul double %6, 2.500000e-01
%8 = sitofp i32 %1 to double
%9 = fmul double %7, %8
%10 = uitofp i32 %2 to double
%11 = fdiv double %9, %10
%12 = fptosi double %11 to i64
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ getticks();
float ticks2seconds(int /*<<< orphan*/);
float gettime(void) { return ticks2seconds(getticks()); }


x86 assembly (clang, -O0):
<gettime>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getticks@plt>
mov    %eax,%edi
call   1040 <ticks2seconds@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettime>:
push   %rax
xor    %eax,%eax
call   1030 <getticks@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <ticks2seconds@plt>

LLVM IR (-O0):
define float @gettime() {
%1 = call i32 (...) @getticks()
%2 = call float @ticks2seconds(i32 %1)
ret float %2
}

LLVM IR (-O2):
define float @gettime() {
%1 = tail call i32 (...) @getticks()
%2 = tail call float @ticks2seconds(i32 %1)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ sort_r_swap(char *, char *, size_t);
int sort_r_cmpswap(char *restrict a, char *__restrict b, size_t w,
                   int (*compar)(const void *_a, const void *_b, void *_arg),
                   void *arg) {
  if (compar(a, b, arg) > 0) {
    sort_r_swap(a, b, w);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<sort_r_cmpswap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   *%rax
cmp    $0x0,%eax
jle    1164 <sort_r_cmpswap+0x54>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <sort_r_swap@plt>
movl   $0x1,-0x4(%rbp)
jmp    116b <sort_r_cmpswap+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort_r_cmpswap>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %r8,%rdx
call   *%rcx
test   %eax,%eax
jle    113c <sort_r_cmpswap+0x2c>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <sort_r_swap@plt>
mov    $0x1,%eax
jmp    113e <sort_r_cmpswap+0x2e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @sort_r_cmpswap(i8* noalias %0, i8* noalias %1, i64 %2, i32 (i8*, i8*, i8*)* %3, i8* %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32 (i8*, i8*, i8*)*
%11 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i32 (i8*, i8*, i8*)* %3, i32 (i8*, i8*, i8*)** %10
store i8* %4, i8** %11
%12 = load i32 (i8*, i8*, i8*)*, i32 (i8*, i8*, i8*)** %10
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = load i8*, i8** %11
%16 = call i32 %12(i8* %13, i8* %14, i8* %15)
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %5
%19 = load i8*, i8** %7
%20 = load i8*, i8** %8
%21 = load i64, i64* %9
%22 = call i32 @sort_r_swap(i8* %19, i8* %20, i64 %21)
store i32 1, i32* %6
br label %24
23: ; preds = %5
store i32 0, i32* %6
br label %24
24: ; preds = %23, %18
%25 = load i32, i32* %6
ret i32 %25
}

LLVM IR (-O2):
define i32 @sort_r_cmpswap(i8* noalias %0, i8* noalias %1, i64 %2, i32 (i8*, i8*, i8*)* nocapture %3, i8* %4) {
%6 = tail call i32 %3(i8* %0, i8* %1, i8* %4)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @sort_r_swap(i8* %0, i8* %1, i64 %2)
br label %10
10: ; preds = %5, %8
%11 = phi i32 [ 1, %8 ], [ 0, %5 ]
ret i32 %11
}
/* Type definitions */
struct sigaction {
  void (*sa_handler)(int);
  scalar_t__ sa_flags;
  int /*<<< orphan*/ sa_mask;
};

/* Variables and functions */
int /*<<< orphan*/ sigaction(int, struct sigaction *, int /*<<< orphan*/ *);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
void iSignal(int n, void (*foo)(int)) {
  struct sigaction act;
  act.sa_handler = foo;
  sigemptyset(&act.sa_mask);
  act.sa_flags = 0;
  sigaction(n, &act, NULL);
}


x86 assembly (clang, -O0):
<iSignal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
add    $0x10,%rdi
call   1040 <sigemptyset@plt>
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigaction@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iSignal>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%ebx
mov    %rsi,0x8(%rsp)
lea    0x18(%rsp),%rdi
call   1040 <sigemptyset@plt>
movq   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rsi
mov    %ebx,%edi
xor    %edx,%edx
call   1030 <sigaction@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.sigaction = type { void (i32)*, i64, i32 }
define void @iSignal(i32 %0, void (i32)* %1) {
%3 = alloca i32
%4 = alloca void (i32)*
%5 = alloca %struct.sigaction
store i32 %0, i32* %3
store void (i32)* %1, void (i32)** %4
%6 = load void (i32)*, void (i32)** %4
%7 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 0
store void (i32)* %6, void (i32)** %7
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 2
%9 = call i32 @sigemptyset(i32* %8)
%10 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %5, i32 0, i32 1
store i64 0, i64* %10
%11 = load i32, i32* %3
%12 = call i32 @sigaction(i32 %11, %struct.sigaction* %5, i32* null)
ret void
}

LLVM IR (-O2):
%struct.sigaction = type { void (i32)*, i64, i32 }
define void @iSignal(i32 %0, void (i32)* %1) {
%3 = alloca %struct.sigaction
%4 = bitcast %struct.sigaction* %3 to i8*
%5 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 0
store void (i32)* %1, void (i32)** %5
%6 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 2
%7 = call i32 @sigemptyset(i32* %6)
%8 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %3, i64 0, i32 1
store i64 0, i64* %8
%9 = call i32 @sigaction(i32 %0, %struct.sigaction* %3, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SWAP(unsigned char *, unsigned char *);
void SWAP16(void *i_in) {
  unsigned char *inptr = (unsigned char *)i_in;
  SWAP(inptr, &inptr[1]);
}


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

x86 assembly (clang, -O2):
<SWAP16>:
lea    0x1(%rdi),%rsi
jmp    1030 <SWAP@plt>

LLVM IR (-O0):
define void @SWAP16(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = call i32 @SWAP(i8* %5, i8* %7)
ret void
}

LLVM IR (-O2):
define void @SWAP16(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = tail call i32 @SWAP(i8* %0, i8* %2)
ret void
}