xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ uint32_t;
struct timespec {
  int tv_nsec;
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
uint32_t VRRP_TIMER_CLK(void) {
  struct timespec tv;
  uint32_t usecs = 0;
  clock_gettime(CLOCK_MONOTONIC, &tv);
  usecs = (uint32_t)(tv.tv_nsec / 1000);
  return tv.tv_sec * 1000000 + usecs;
}


x86 assembly (clang, -O0):
<VRRP_TIMER_CLK>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x10(%rbp)
imul   $0xf4240,-0x4(%rbp),%eax
cltq
add    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VRRP_TIMER_CLK>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
movslq (%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
movslq %eax,%rcx
movslq 0x4(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @VRRP_TIMER_CLK() {
%1 = alloca %struct.timespec
%2 = alloca i64
store i64 0, i64* %2
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%6 = load i32, i32* %5
%7 = sdiv i32 %6, 1000
%8 = sext i32 %7 to i64
store i64 %8, i64* %2
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 1000000
%12 = sext i32 %11 to i64
%13 = load i64, i64* %2
%14 = add nsw i64 %12, %13
ret i64 %14
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
@CLOCK_MONOTONIC = global i32 0
define i64 @VRRP_TIMER_CLK() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = sdiv i32 %6, 1000
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, 1000000
%12 = sext i32 %11 to i64
%13 = add nsw i64 %12, %8
ret i64 %13
}
__attribute__((visibility("default"))) unsigned long _glthread_GetID(void) {
  return 0;
}


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

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

LLVM IR (-O0):
define i64 @_glthread_GetID() {
ret i64 0
}

LLVM IR (-O2):
define i64 @_glthread_GetID() {
ret i64 0
}
/* Variables and functions */
scalar_t__ fabs(double);
float fabs2(float x) { return (float)fabs((double)x); }


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

x86 assembly (clang, -O2):
<fabs2>:
push   %rax
cvtss2sd %xmm0,%xmm0
call   1030 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fabs2(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call i64 @fabs(double %4)
%6 = sitofp i64 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @fabs2(float %0) {
%2 = fpext float %0 to double
%3 = tail call i64 @fabs(double %2)
%4 = sitofp i64 %3 to float
ret float %4
}
void update_color_classes(int *C, int u, int old_color, int new_color) {
  C[old_color]--;
  C[new_color]++;
}


x86 assembly (clang, -O0):
<update_color_classes>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0xffffffff,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_color_classes>:
movslq %edx,%rax
addl   $0xffffffff,(%rdi,%rax,4)
movslq %ecx,%rax
addl   $0x1,(%rdi,%rax,4)
ret

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

LLVM IR (-O2):
define void @update_color_classes(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = add nsw i32 %7, -1
store i32 %8, i32* %6
%9 = sext i32 %3 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = add nsw i32 %11, 1
store i32 %12, i32* %10
ret void
}
/* Variables and functions */
int /*<<< orphan*/ addElementAtEnd(int);
int /*<<< orphan*/ addFirstElement(int);
scalar_t__ getElementCount();
void addElement(int element) {
  if (getElementCount() == 0) {
    addFirstElement(element);
    return;
  }
  addElementAtEnd(element);
  return;
}


x86 assembly (clang, -O0):
<addElement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getElementCount@plt>
cmp    $0x0,%rax
jne    1159 <addElement+0x29>
mov    -0x4(%rbp),%edi
call   1030 <addFirstElement@plt>
jmp    1161 <addElement+0x31>
mov    -0x4(%rbp),%edi
call   1040 <addElementAtEnd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addElement>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <getElementCount@plt>
mov    %ebx,%edi
test   %rax,%rax
je     1147 <addElement+0x17>
pop    %rbx
jmp    1040 <addElementAtEnd@plt>
pop    %rbx
jmp    1030 <addFirstElement@plt>

LLVM IR (-O0):
define void @addElement(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 (...) @getElementCount()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @addFirstElement(i32 %6)
br label %11
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 @addElementAtEnd(i32 %9)
br label %11
11: ; preds = %8, %5
ret void
}

LLVM IR (-O2):
define void @addElement(i32 %0) {
%2 = tail call i64 (...) @getElementCount()
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @addFirstElement(i32 %0)
br label %8
6: ; preds = %1
%7 = tail call i32 @addElementAtEnd(i32 %0)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fclose(void *);
int /*<<< orphan*/ gzclose(void *);
void fileCloseInput(void *fileDescriptor, int isZip) {
  if (isZip == 1) {
    gzclose(fileDescriptor);
  } else {
    fclose(fileDescriptor);
  }
}


x86 assembly (clang, -O0):
<fileCloseInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1147 <fileCloseInput+0x27>
mov    -0x8(%rbp),%rdi
call   1030 <gzclose@plt>
jmp    1150 <fileCloseInput+0x30>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileCloseInput>:
cmp    $0x1,%esi
jne    112a <fileCloseInput+0xa>
jmp    1030 <gzclose@plt>
jmp    1040 <fclose@plt>

LLVM IR (-O0):
define void @fileCloseInput(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 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 @gzclose(i8* %8)
br label %13
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 @fclose(i8* %11)
br label %13
13: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
define void @fileCloseInput(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @gzclose(i8* %0)
br label %8
6: ; preds = %2
%7 = tail call i32 @fclose(i8* %0)
br label %8
8: ; preds = %6, %4
ret void
}
/* Type definitions */
struct termios {
  int /*<<< orphan*/ c_ospeed;
};
typedef int /*<<< orphan*/ speed_t;

/* Variables and functions */
speed_t cfgetospeed(const struct termios *termios) { return termios->c_ospeed; }


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

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

LLVM IR (-O0):
%struct.termios = type { i32 }
define i32 @cfgetospeed(%struct.termios* %0) {
%2 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %2
%3 = load %struct.termios*, %struct.termios** %2
%4 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.termios = type { i32 }
define i32 @cfgetospeed(%struct.termios* nocapture %0) {
%2 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%3 = load i32, i32* %2
ret i32 %3
}
void omp_set_num_threads(int i) {}


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

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

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

LLVM IR (-O2):
define void @omp_set_num_threads(i32 %0) {
ret void
}
void free_interfaces(char **ifnames, int n) {
  for (int i = 0; i < n; ++i)
    free(ifnames[i]);
  free(ifnames);
}


x86 assembly (clang, -O0):
<free_interfaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_interfaces+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_interfaces+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_interfaces>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_interfaces+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_interfaces+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_interfaces(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = bitcast i8** %0 to i8*
tail call void @free(i8* %7)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %12, %8 ]
%10 = getelementptr inbounds i8*, i8** %0, i64 %9
%11 = load i8*, i8** %10
tail call void @free(i8* %11)
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ ivory_serialize_unpack_prim_1_le(int /*<<< orphan*/ const *);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
void ivory_serialize_unpack_int8_le(const uint8_t *src, uint32_t offs,
                                    int8_t *dst) {
  uint8_t tmp = ivory_serialize_unpack_prim_1_le(src + offs);
  memcpy(dst, &tmp, sizeof(*dst));
}


x86 assembly (clang, -O0):
<ivory_serialize_unpack_int8_le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1030 <ivory_serialize_unpack_prim_1_le@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ivory_serialize_unpack_int8_le>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
movslq %esi,%rax
lea    (%rdi,%rax,4),%rdi
call   1030 <ivory_serialize_unpack_prim_1_le@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <memcpy@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @ivory_serialize_unpack_int8_le(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 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
%12 = call i32 @ivory_serialize_unpack_prim_1_le(i32* %11)
store i32 %12, i32* %7
%13 = load i32*, i32** %6
%14 = call i32 @memcpy(i32* %13, i32* %7, i32 4)
ret void
}

LLVM IR (-O2):
define void @ivory_serialize_unpack_int8_le(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = tail call i32 @ivory_serialize_unpack_prim_1_le(i32* %7)
store i32 %8, i32* %4
%9 = call i32 @memcpy(i32* %2, i32* %4, i32 4)
ret void
}
void FPX_Shutdown() {}


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

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

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

LLVM IR (-O2):
define void @FPX_Shutdown() {
ret void
}
__attribute__((always_)) void __native_flush_tlb_single(unsigned long addr) {
  asm volatile("invlpg (%0)" ::"r"(addr) : "memory");
}


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

x86 assembly (clang, -O2):
<__native_flush_tlb_single>:
invlpg (%rdi)
ret

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

LLVM IR (-O2):
define void @__native_flush_tlb_single(i64 %0) {
tail call void asm sideeffect "invlpg ($0)", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float d_km;
  scanf("%f", &d_km);
  printf("Meters: %f\nCentimeters: %f\n", d_km * 1000, d_km * 100000);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed9(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xec4(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  0xeb3(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm1
movss  0xec0(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  0xeb8(%rip),%xmm1
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [28 x i8] c"Meters: %f\0ACentimeters: %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%3 = load float, float* %1
%4 = fmul float %3, 1.000000e+03
%5 = load float, float* %1
%6 = fmul float %5, 1.000000e+05
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), float %4, float %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [28 x i8] c"Meters: %f\0ACentimeters: %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = load float, float* %1
%5 = fmul float %4, 1.000000e+03
%6 = fmul float %4, 1.000000e+05
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), float %5, float %6)
ret i32 0
}
int fun1240() { return 1240; }


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

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

LLVM IR (-O0):
define i32 @fun1240() {
ret i32 1240
}

LLVM IR (-O2):
define i32 @fun1240() {
ret i32 1240
}
int fun971() { return 971; }


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

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

LLVM IR (-O0):
define i32 @fun971() {
ret i32 971
}

LLVM IR (-O2):
define i32 @fun971() {
ret i32 971
}
void caller_1_2_2_1_2_2_2() {}


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

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

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

LLVM IR (-O2):
define void @caller_1_2_2_1_2_2_2() {
ret void
}
void foo222() {}


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

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

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

LLVM IR (-O2):
define void @foo222() {
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ reverse(char *, char *);
char *put_d(char *p, uint64_t v) {
  char *base = p;
  do {
    *p++ = '0' + (v % 10);
  } while ((v /= 10) != 0);
  reverse(base, p);
  return p;
}


x86 assembly (clang, -O0):
<put_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jne    1127 <put_d+0x17>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <reverse@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_d>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %esi,%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rsi
add    %ecx,%esi
lea    (%rsi,%rsi,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%edx
sub    %ecx,%edx
add    $0x30,%dl
mov    %dl,(%rbx)
add    $0x1,%rbx
add    $0x9,%eax
cmp    $0x12,%eax
ja     1120 <put_d+0x10>
mov    %rbx,%rsi
call   1030 <reverse@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @put_d(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %14, %2
%8 = load i32, i32* %4
%9 = srem i32 %8, 10
%10 = add nsw i32 48, %9
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
store i8 %11, i8* %12
br label %14
14: ; preds = %7
%15 = load i32, i32* %4
%16 = sdiv i32 %15, 10
store i32 %16, i32* %4
%17 = icmp ne i32 %16, 0
br i1 %17, label %7, label %18
18: ; preds = %14
%19 = load i8*, i8** %5
%20 = load i8*, i8** %3
%21 = call i32 @reverse(i8* %19, i8* %20)
%22 = load i8*, i8** %3
ret i8* %22
}

LLVM IR (-O2):
define i8* @put_d(i8* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %1, %2 ], [ %10, %3 ]
%5 = phi i8* [ %0, %2 ], [ %9, %3 ]
%6 = srem i32 %4, 10
%7 = trunc i32 %6 to i8
%8 = add nsw i8 %7, 48
%9 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %8, i8* %5
%10 = sdiv i32 %4, 10
%11 = add i32 %4, 9
%12 = icmp ult i32 %11, 19
br i1 %12, label %13, label %3
13: ; preds = %3
%14 = tail call i32 @reverse(i8* %0, i8* %9)
ret i8* %9
}
/* Variables and functions */
int INT_MAX;
int h1(void) { return INT_MAX + 1 - INT_MAX; }


x86 assembly (clang, -O0):
<h1>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    0x2ed1(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@INT_MAX = global i32 0
define i32 @h1() {
%1 = load i32, i32* @INT_MAX
%2 = add nsw i32 %1, 1
%3 = load i32, i32* @INT_MAX
%4 = sub nsw i32 %2, %3
ret i32 %4
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define i32 @h1() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void fun(int a) { printf("The value of a  : %d\n", a); }


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"The value of a : %d\0A\00"
define void @fun(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"The value of a : %d\0A\00"
define void @fun(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MSP430_Log(int, char *);
int isHalted();
int MSP430_isHalted(void) {
  MSP430_Log(1, "MSP430mspgcc: MSP430_isHalted...\n");
  return isHalted();
}


x86 assembly (clang, -O0):
<MSP430_isHalted>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xed0(%rip),%rsi
call   1030 <MSP430_Log@plt>
mov    $0x0,%al
call   1040 <isHalted@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<MSP430_isHalted>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x1,%edi
call   1030 <MSP430_Log@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <isHalted@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"MSP430mspgcc: MSP430_isHalted...\0A\00"
define i32 @MSP430_isHalted() {
%1 = call i32 @MSP430_Log(i32 1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @isHalted()
ret i32 %2
}

LLVM IR (-O2):
@.str = [34 x i8] c"MSP430mspgcc: MSP430_isHalted...\0A\00"
define i32 @MSP430_isHalted() {
%1 = tail call i32 @MSP430_Log(i32 1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @isHalted()
ret i32 %2
}
__attribute__((__no__, __noclone__)) void g(unsigned *at, unsigned val) {
  asm("");
  __sync_fetch_and_add(at, val);
}


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

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

LLVM IR (-O0):
define void @g(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = atomicrmw add i32* %5, i32 %6 seq_cst
ret void
}

LLVM IR (-O2):
define void @g(i32* nocapture %0, i32 %1) {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
%3 = atomicrmw add i32* %0, i32 %1 seq_cst
ret void
}
/* Type definitions */
struct msghdr {
  int dummy;
};
struct cmsghdr {
  int dummy;
};

/* Variables and functions */
struct cmsghdr *CMSG_NXTHDR(struct msghdr *, struct cmsghdr *);
struct cmsghdr *cmsg_nxthdr(struct msghdr *msgh, struct cmsghdr *cmsg) {
  return CMSG_NXTHDR(msgh, cmsg);
}


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

x86 assembly (clang, -O2):
<cmsg_nxthdr>:
jmp    1030 <CMSG_NXTHDR@plt>

LLVM IR (-O0):
%struct.msghdr = type { i32 }
%struct.cmsghdr = type { i32 }
define %struct.cmsghdr* @cmsg_nxthdr(%struct.msghdr* %0, %struct.cmsghdr* %1) {
%3 = alloca %struct.msghdr*
%4 = alloca %struct.cmsghdr*
store %struct.msghdr* %0, %struct.msghdr** %3
store %struct.cmsghdr* %1, %struct.cmsghdr** %4
%5 = load %struct.msghdr*, %struct.msghdr** %3
%6 = load %struct.cmsghdr*, %struct.cmsghdr** %4
%7 = call %struct.cmsghdr* @CMSG_NXTHDR(%struct.msghdr* %5, %struct.cmsghdr* %6)
ret %struct.cmsghdr* %7
}

LLVM IR (-O2):
%struct.msghdr = type { i32 }
%struct.cmsghdr = type { i32 }
define %struct.cmsghdr* @cmsg_nxthdr(%struct.msghdr* %0, %struct.cmsghdr* %1) {
%3 = tail call %struct.cmsghdr* @CMSG_NXTHDR(%struct.msghdr* %0, %struct.cmsghdr* %1)
ret %struct.cmsghdr* %3
}
long long proc3() { return 0xaabbccdd12345678LL; }


x86 assembly (clang, -O0):
<proc3>:
push   %rbp
mov    %rsp,%rbp
movabs $0xaabbccdd12345678,%rax
cc bb aa
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc3>:
movabs $0xaabbccdd12345678,%rax
cc bb aa
ret

LLVM IR (-O0):
define i64 @proc3() {
ret i64 -6144092016751651208
}

LLVM IR (-O2):
define i64 @proc3() {
ret i64 -6144092016751651208
}
int test_pow(int v) { return v * v; }


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

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

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

LLVM IR (-O2):
define i32 @test_pow(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
void omap_iommu_debugfs_add(struct omap_iommu *obj) {}


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

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

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

LLVM IR (-O2):
%struct.omap_iommu = type opaque
define void @omap_iommu_debugfs_add(%struct.omap_iommu* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ write(int, char *, int);
void _Unwind_GetLanguageSpecificData() {
  char msg[] = "Aborting: "
               "_Unwind_GetLanguageSpecificData"
               " called "
               "(C++ exception handling is disabled)\n";
  write(2, msg, sizeof(msg) - 1);
  abort();
}


x86 assembly (clang, -O0):
<_Unwind_GetLanguageSpecificData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x60(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x57,%edx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rsi
mov    $0x2,%edi
mov    $0x56,%edx
call   1040 <write@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<_Unwind_GetLanguageSpecificData>:
sub    $0x58,%rsp
movaps 0xf15(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xef9(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xea5(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0xa2964656c6261,%rax
mov    %rax,0x4f(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edi
mov    $0x56,%edx
call   1040 <write@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@__const._Unwind_GetLanguageSpecificData.msg = [87 x i8] c"Aborting: _Unwind_GetLanguageSpecificData called (C++ exception handling is disabled)\0A\00"
define void @_Unwind_GetLanguageSpecificData() {
%1 = alloca [87 x i8]
%2 = bitcast [87 x i8]* %1 to i8*
%3 = getelementptr inbounds [87 x i8], [87 x i8]* %1, i64 0, i64 0
%4 = call i32 @write(i32 2, i8* %3, i32 86)
%5 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@__const._Unwind_GetLanguageSpecificData.msg = [87 x i8] c"Aborting: _Unwind_GetLanguageSpecificData called (C++ exception handling is disabled)\0A\00"
define void @_Unwind_GetLanguageSpecificData() {
%1 = alloca [87 x i8]
%2 = getelementptr inbounds [87 x i8], [87 x i8]* %1, i64 0, i64 0
%3 = call i32 @write(i32 2, i8* %2, i32 86)
%4 = tail call i32 (...) @abort()
unreachable
}
int cornerperm_pack(array_in)
int array_in[8];
{ return perm_n_pack(8, array_in); }


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

x86 assembly (clang, -O2):
<cornerperm_pack>:
mov    %rdi,%rsi
mov    $0x8,%edi
xor    %eax,%eax
jmp    1030 <perm_n_pack@plt>

LLVM IR (-O0):
define i32 @cornerperm_pack(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 (i32, i32*, ...) bitcast (i32 (...)* @perm_n_pack to i32 (i32, i32*, ...)*)(i32 8, i32* %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @cornerperm_pack(i32* %0) {
%2 = tail call i32 (i32, i32*, ...) bitcast (i32 (...)* @perm_n_pack to i32 (i32, i32*, ...)*)(i32 8, i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ resolve_forward();
void Then() { resolve_forward(); }


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

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

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

LLVM IR (-O2):
define void @Then() {
%1 = tail call i32 (...) @resolve_forward()
ret void
}
/* Variables and functions */
int tap_finish();
int /*<<< orphan*/ tap_skip_all(char *);
int main(void) {
  tap_skip_all("need to find a way to force readdir to return entries in "
               "unsorted order");
  return tap_finish();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <tap_skip_all@plt>
mov    $0x0,%al
call   1040 <tap_finish@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [72 x i8] c"need to find a way to force readdir to return entries in unsorted order\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @tap_skip_all(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @tap_finish()
ret i32 %3
}

LLVM IR (-O2):
@.str = [72 x i8] c"need to find a way to force readdir to return entries in unsorted order\00"
define i32 @main() {
%1 = tail call i32 @tap_skip_all(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @tap_finish()
ret i32 %2
}
/* Variables and functions */
int sr_compare_u64(char *, char *);
__attribute__((hot)) int
sr_cmpu64_raw_reverse(char *a, int asz __attribute__((unused)), char *b,
                      int bsz __attribute__((unused)),
                      void *arg __attribute__((unused))) {
  return -sr_compare_u64(a, b);
}


x86 assembly (clang, -O0):
<sr_cmpu64_raw_reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <sr_compare_u64@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sr_cmpu64_raw_reverse>:
push   %rax
mov    %rdx,%rsi
call   1030 <sr_compare_u64@plt>
neg    %eax
pop    %rcx
ret
nopl   (%rax)

LLVM IR (-O0):
define i32 @sr_cmpu64_raw_reverse(i8* %0, i32 %1, i8* %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i8*, i8** %8
%13 = call i32 @sr_compare_u64(i8* %11, i8* %12)
%14 = sub nsw i32 0, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @sr_cmpu64_raw_reverse(i8* %0, i32 %1, i8* %2, i32 %3, i8* nocapture readnone %4) {
%6 = tail call i32 @sr_compare_u64(i8* %0, i8* %2)
%7 = sub nsw i32 0, %6
ret i32 %7
}
/* Variables and functions */
int asin(int);
int /*<<< orphan*/ isnan(double);
double sin(int);
double smoothstep_inv(double x) {
  (void)(!isnan(x));
  return (0.5 - sin(asin(1 - 2 * x) / 3));
}


x86 assembly (clang, -O0):
<smoothstep_inv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <isnan@plt>
movsd  -0x8(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xeb0(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <asin@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  0xe81(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smoothstep_inv>:
push   %rax
movsd  %xmm0,(%rsp)
call   1050 <isnan@plt>
movsd  (%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xeb4(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <asin@plt>
cltq
imul   $0x55555556,%rax,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
shr    $0x20,%rdi
add    %eax,%edi
call   1030 <sin@plt>
movsd  0xe8c(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @smoothstep_inv(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @isnan(double %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
%8 = load double, double* %2
%9 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %8, double 1.000000e+00)
%10 = fptosi double %9 to i32
%11 = call i32 @asin(i32 %10)
%12 = sdiv i32 %11, 3
%13 = call double @sin(i32 %12)
%14 = fsub double 5.000000e-01, %13
ret double %14
}

LLVM IR (-O2):
define double @smoothstep_inv(double %0) {
%2 = tail call i32 @isnan(double %0)
%3 = tail call double @llvm.fmuladd.f64(double %0, double -2.000000e+00, double 1.000000e+00)
%4 = fptosi double %3 to i32
%5 = tail call i32 @asin(i32 %4)
%6 = sdiv i32 %5, 3
%7 = tail call double @sin(i32 %6)
%8 = fsub double 5.000000e-01, %7
ret double %8
}
unsigned long long do_div(unsigned long long *n, unsigned base) {
  unsigned long long res;
  res = (*n) % (unsigned long long)base;
  *n = (*n) / (unsigned long long)base;
  return res;
}


x86 assembly (clang, -O0):
<do_div>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0xc(%rbp),%ecx
xor    %edx,%edx
div    %rcx
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0xc(%rbp),%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_div>:
mov    (%rdi),%rax
mov    %esi,%ecx
mov    %rax,%rdx
shr    $0x20,%rdx
je     1115 <do_div+0x15>
xor    %edx,%edx
div    %rcx
jmp    1119 <do_div+0x19>
xor    %edx,%edx
div    %ecx
mov    %rax,(%rdi)
mov    %rdx,%rax
ret

LLVM IR (-O0):
define i64 @do_div(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
%5 = alloca i64
store i64* %0, i64** %3
store i32 %1, i32* %4
%6 = load i64*, i64** %3
%7 = load i64, i64* %6
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = urem i64 %7, %9
store i64 %10, i64* %5
%11 = load i64*, i64** %3
%12 = load i64, i64* %11
%13 = load i32, i32* %4
%14 = zext i32 %13 to i64
%15 = udiv i64 %12, %14
%16 = load i64*, i64** %3
store i64 %15, i64* %16
%17 = load i64, i64* %5
ret i64 %17
}

LLVM IR (-O2):
define i64 @do_div(i64* nocapture %0, i32 %1) {
%3 = load i64, i64* %0
%4 = zext i32 %1 to i64
%5 = urem i64 %3, %4
%6 = udiv i64 %3, %4
store i64 %6, i64* %0
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ check_palindrome(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int InputNumber;
  scanf("%d", &InputNumber);
  while (!check_palindrome(InputNumber)) {
    InputNumber++;
  }
  printf("%X\n", InputNumber);
  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   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1050 <check_palindrome@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    116c <main+0x3c>
jmp    117a <main+0x4a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114f <main+0x1f>
mov    -0x8(%rbp),%esi
lea    0xe7f(%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   1040 <scanf@plt>
mov    0x4(%rsp),%edi
cs nopw 0x0(%rax,%rax,1)
call   1050 <check_palindrome@plt>
test   %eax,%eax
jne    1166 <main+0x36>
mov    0x4(%rsp),%edi
add    $0x1,%edi
mov    %edi,0x4(%rsp)
jmp    1150 <main+0x20>
mov    0x4(%rsp),%esi
lea    0xe92(%rip),%rdi
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"%X\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %4
4: ; preds = %9, %0
%5 = load i32, i32* %2
%6 = call i32 @check_palindrome(i32 %5)
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %4
12: ; preds = %4
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%X\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 @check_palindrome(i32 %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %0, %7
%8 = load i32, i32* %1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %1
%10 = call i32 @check_palindrome(i32 %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %7, label %12
12: ; preds = %7, %0
%13 = load i32, i32* %1
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
ret i32 0
}
/* Variables and functions */
int strcat(char *dst, char *src) {
  while (*dst) {
    dst++;
  }
  while (*dst = *src) {
    dst++;
    src++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     112a <strcat+0x2a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <strcat+0xc>
jmp    112f <strcat+0x2f>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     1160 <strcat+0x60>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    112f <strcat+0x2f>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1100 <strcat>
mov    (%rsi),%al
mov    %al,-0x1(%rdi)
test   %al,%al
je     1130 <strcat+0x30>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x1(%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1120 <strcat+0x20>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strcat(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %1
store i8 %9, i8* %4
%10 = icmp eq i8 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %8, %11
%12 = phi i8* [ %15, %11 ], [ %1, %8 ]
%13 = phi i8* [ %14, %11 ], [ %4, %8 ]
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = getelementptr inbounds i8, i8* %12, i64 1
%16 = load i8, i8* %15
store i8 %16, i8* %14
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %11
18: ; preds = %11, %8
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ unlink(char *);
void control_cleanup(void) { unlink("/var/run/geolocd.sock"); }


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"/var/run/geolocd.sock\00"
define void @control_cleanup() {
%1 = call i32 @unlink(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"/var/run/geolocd.sock\00"
define void @control_cleanup() {
%1 = tail call i32 @unlink(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ g(int);
void f(int n) {
  static int x = 1;
  g(n);
  x--;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <g@plt>
mov    0x2eff(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,0x2ef6(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rax
call   1030 <g@plt>
addl   $0xffffffff,0x2f0b(%rip)
pop    %rax
ret

LLVM IR (-O0):
@f.x = internal global i32 1
define void @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @g(i32 %3)
%5 = load i32, i32* @f.x
%6 = add nsw i32 %5, -1
store i32 %6, i32* @f.x
ret void
}

LLVM IR (-O2):
@f.x = internal unnamed_addr global i32 1
define void @f(i32 %0) {
%2 = tail call i32 @g(i32 %0)
%3 = load i32, i32* @f.x
%4 = add nsw i32 %3, -1
store i32 %4, i32* @f.x
ret void
}
/* Type definitions */
typedef int off_t;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, int);
int expect_vao(off_t expected, off_t ret) {
  printf("\tVAO Expected %d, Got %d\n", expected, ret);
  fflush(NULL);
  if (ret == expected) {
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<expect_vao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <fflush@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1161 <expect_vao+0x41>
movl   $0x0,-0x4(%rbp)
jmp    1168 <expect_vao+0x48>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expect_vao>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xed2(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <fflush@plt>
xor    %eax,%eax
cmp    %ebp,%ebx
setne  %al
neg    %eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"\09VAO Expected %d, Got %d\0A\00"
define i32 @expect_vao(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = call i32 @fflush(i32* null)
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 0, i32* %3
br label %15
14: ; preds = %2
store i32 -1, i32* %3
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@.str = [26 x i8] c"\09VAO Expected %d, Got %d\0A\00"
define i32 @expect_vao(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%4 = tail call i32 @fflush(i32* null)
%5 = icmp ne i32 %1, %0
%6 = sext i1 %5 to i32
ret i32 %6
}
void CRYPTO_get_id_callback(void) {}


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

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

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

LLVM IR (-O2):
define void @CRYPTO_get_id_callback() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ finish(int /*<<< orphan*/);
void uilow_end(void) { finish(0); }


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

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

LLVM IR (-O0):
define void @uilow_end() {
%1 = call i32 @finish(i32 0)
ret void
}

LLVM IR (-O2):
define void @uilow_end() {
%1 = tail call i32 @finish(i32 0)
ret void
}
void foo(int x, double y, double z) {
  _Bool t = z >= y;
  if (!t || x)
    bar(t ? 1 : 16);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
setae  %al
and    $0x1,%al
mov    %al,-0x19(%rbp)
testb  $0x1,-0x19(%rbp)
je     114b <foo+0x3b>
cmpl   $0x0,-0x4(%rbp)
je     1165 <foo+0x55>
mov    -0x19(%rbp),%cl
mov    $0x10,%edi
mov    $0x1,%eax
test   $0x1,%cl
cmovne %eax,%edi
mov    $0x0,%al
call   1030 <bar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %edi,%edi
jne    111b <foo+0xb>
ucomisd %xmm0,%xmm1
jb     111b <foo+0xb>
ret
ucomisd %xmm0,%xmm1
mov    $0x1,%eax
mov    $0x10,%edi
cmovae %eax,%edi
xor    %eax,%eax
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo(i32 %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca i8
store i32 %0, i32* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %6
%9 = load double, double* %5
%10 = fcmp oge double %8, %9
%11 = zext i1 %10 to i8
store i8 %11, i8* %7
%12 = load i8, i8* %7
%13 = trunc i8 %12 to i1
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %14, %3
%18 = load i8, i8* %7
%19 = trunc i8 %18 to i1
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 1, i32 16
%22 = call i32 (i32, ...) bitcast (i32 (...)* @bar to i32 (i32, ...)*)(i32 %21)
br label %23
23: ; preds = %17, %14
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, double %1, double %2) {
%4 = fcmp oge double %2, %1
%5 = icmp eq i32 %0, 0
%6 = and i1 %5, %4
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = select i1 %4, i32 1, i32 16
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @bar to i32 (i32, ...)*)(i32 %8)
br label %10
10: ; preds = %3, %7
ret void
}