xunge/DecIR huggingface dataset:
double URan(long *seed) {
  do
    *seed = ((long)1317 * *seed + (long)27699) % (long)131072;
  while (*seed == 0);
  return ((double)*seed / (double)(long)131072);
}


x86 assembly (clang, -O0):
<URan>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x525,(%rax),%rax
add    $0x6c33,%rax
mov    $0x20000,%ecx
cqto
idiv   %rcx
mov    -0x8(%rbp),%rax
mov    %rdx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1108 <URan+0x8>
mov    -0x8(%rbp),%rax
cvtsi2sdq (%rax),%xmm0
movsd  0xeb7(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<URan>:
imul   $0x525,(%rdi),%rax
lea    0x6c33(%rax),%rcx
lea    0x26c32(%rax),%rdx
test   %rcx,%rcx
cmovns %rcx,%rdx
and    $0xfffffffffffe0000,%rdx
neg    %rdx
add    %rdx,%rax
add    $0x6c33,%rax
test   %rax,%rax
mov    $0x6c33,%ecx
cmovne %rax,%rcx
mov    %rcx,(%rdi)
cvtsi2sd %rcx,%xmm0
mulsd  0xeb5(%rip),%xmm0
ret

LLVM IR (-O0):
define double @URan(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
br label %3
3: ; preds = %10, %1
%4 = load i64*, i64** %2
%5 = load i64, i64* %4
%6 = mul nsw i64 1317, %5
%7 = add nsw i64 %6, 27699
%8 = srem i64 %7, 131072
%9 = load i64*, i64** %2
store i64 %8, i64* %9
br label %10
10: ; preds = %3
%11 = load i64*, i64** %2
%12 = load i64, i64* %11
%13 = icmp eq i64 %12, 0
br i1 %13, label %3, label %14
14: ; preds = %10
%15 = load i64*, i64** %2
%16 = load i64, i64* %15
%17 = sitofp i64 %16 to double
%18 = fdiv double %17, 1.310720e+05
ret double %18
}

LLVM IR (-O2):
define double @URan(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = mul i64 %2, 1317
%4 = add i64 %3, 27699
%5 = srem i64 %4, 131072
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i64 27699, i64 %5
store i64 %7, i64* %0
%8 = sitofp i64 %7 to double
%9 = fmul double %8, 0x3EE0000000000000
ret double %9
}
void arch_reset(int mode, const char *cmd) {}


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

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

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

LLVM IR (-O2):
define void @arch_reset(i32 %0, i8* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128d;

/* Variables and functions */
int /*<<< orphan*/ _mm_cmpneq_pd(int /*<<< orphan*/, int /*<<< orphan*/);
__m128d test_mm_cmpneq_pd(__m128d A, __m128d B) { return _mm_cmpneq_pd(A, B); }


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

x86 assembly (clang, -O2):
<test_mm_cmpneq_pd>:
jmp    1030 <_mm_cmpneq_pd@plt>

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

LLVM IR (-O2):
define i32 @test_mm_cmpneq_pd(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_cmpneq_pd(i32 %0, i32 %1)
ret i32 %3
}
void ff_hevc_put_hevc_bi_epel_h8_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_epel_h8_12_sse4() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
unsigned get_16_pixel(uint8_t *buf, unsigned row_bytes, unsigned x,
                      unsigned y) {
  return ((uint16_t *)buf)[(row_bytes / 2) * y + x];
}


x86 assembly (clang, -O0):
<get_16_pixel>:
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
mov    -0xc(%rbp),%ecx
shr    $0x1,%ecx
imul   -0x14(%rbp),%ecx
add    -0x10(%rbp),%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_16_pixel>:
shr    %esi
imul   %ecx,%esi
add    %edx,%esi
mov    (%rdi,%rsi,4),%eax
ret

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

LLVM IR (-O2):
define i32 @get_16_pixel(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = lshr i32 %1, 1
%6 = mul i32 %5, %3
%7 = add i32 %6, %2
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
ret i32 %10
}
int grid_xsurveyor_ispeer(int socktype) {
  return socktype == (6 * 16 + 3) ? 1 : 0;
}


x86 assembly (clang, -O0):
<grid_xsurveyor_ispeer>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x63,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_xsurveyor_ispeer>:
xor    %eax,%eax
cmp    $0x63,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @grid_xsurveyor_ispeer(i32 %0) {
%2 = icmp eq i32 %0, 99
%3 = zext i1 %2 to i32
ret i32 %3
}
void ff_hevc_put_hevc_qpel_h8_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_qpel_h8_8_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ writestr(char *);
int main() {
  writestr("hello, world\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <writestr@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"hello, world\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @writestr(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"hello, world\0A\00"
define i32 @main() {
%1 = tail call i32 @writestr(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
double orient2d(double *, double *, double *);
double det2i3(double *vertex, int v1, int v2, int v3) {
  double r;
  r = orient2d(vertex + 2 * v1, vertex + 2 * v2, vertex + 2 * v3);
  return r;
}


x86 assembly (clang, -O0):
<det2i3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rsi
mov    -0x8(%rbp),%rdx
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
cltq
shl    $0x3,%rax
add    %rax,%rdx
call   1030 <orient2d@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<det2i3>:
add    %esi,%esi
movslq %esi,%rax
lea    (%rdi,%rax,8),%rax
add    %edx,%edx
movslq %edx,%rdx
lea    (%rdi,%rdx,8),%rsi
add    %ecx,%ecx
movslq %ecx,%rcx
lea    (%rdi,%rcx,8),%rdx
mov    %rax,%rdi
jmp    1030 <orient2d@plt>

LLVM IR (-O0):
define double @det2i3(double* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
store double* %0, double** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load double*, double** %5
%11 = load i32, i32* %6
%12 = mul nsw i32 2, %11
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds double, double* %10, i64 %13
%15 = load double*, double** %5
%16 = load i32, i32* %7
%17 = mul nsw i32 2, %16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %15, i64 %18
%20 = load double*, double** %5
%21 = load i32, i32* %8
%22 = mul nsw i32 2, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %20, i64 %23
%25 = call double @orient2d(double* %14, double* %19, double* %24)
store double %25, double* %9
%26 = load double, double* %9
ret double %26
}

LLVM IR (-O2):
define double @det2i3(double* %0, i32 %1, i32 %2, i32 %3) {
%5 = shl nsw i32 %1, 1
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds double, double* %0, i64 %6
%8 = shl nsw i32 %2, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds double, double* %0, i64 %9
%11 = shl nsw i32 %3, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds double, double* %0, i64 %12
%14 = tail call double @orient2d(double* %7, double* %10, double* %13)
ret double %14
}
void add_close(fd) int fd;
{
  if (fd != 0)
    close(fd);
}


x86 assembly (clang, -O0):
<add_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112f <add_close+0x1f>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_close>:
test   %edi,%edi
je     111b <add_close+0xb>
xor    %eax,%eax
jmp    1030 <close@plt>
ret

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

LLVM IR (-O2):
define void @add_close(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, unsigned int, char const *);
void _assert(char *expr, const char *filename, unsigned int linenumber) {
  printf("Assert(%s) failed at line %u in file %s.\n", expr, linenumber,
         filename);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<_assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
jmp    113a <_assert+0x2a>

x86 assembly (clang, -O2):
<_assert>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rsi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
jmp    1130 <_assert+0x20>

LLVM IR (-O0):
@.str = [42 x i8] c"Assert(%s) failed at line %u in file %s.\0A\00"
define void @_assert(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %6
%9 = load i8*, i8** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i8* %9)
br label %11
11: ; preds = %3, %11
br label %11
}

LLVM IR (-O2):
@.str = [42 x i8] c"Assert(%s) failed at line %u in file %s.\0A\00"
define void @_assert(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %2, i8* %1)
br label %5
5: ; preds = %3, %5
br label %5
}
/* Variables and functions */
int I2I(int);
__attribute__((__visibility__("default"))) __attribute__((used)) signed int
rI2I(signed int *x) {
  return I2I(*x);
}


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

x86 assembly (clang, -O2):
<rI2I>:
mov    (%rdi),%edi
jmp    1030 <I2I@plt>

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32*)* @rI2I to i8*)], section "llvm.metadata"
define i32 @rI2I(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = call i32 @I2I(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i32*)* @rI2I to i8*)], section "llvm.metadata"
define i32 @rI2I(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @I2I(i32 %2)
ret i32 %3
}
/* Type definitions */
typedef int ssize_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
ssize_t readlink(const char *path, char *buf, size_t bufsize) {
  assert(!"NYI");
  return -1;
}


x86 assembly (clang, -O0):
<readlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readlink>:
push   %rax
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"NYI\00"
define i32 @readlink(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = call i32 @assert(i32 0)
ret i32 -1
}

LLVM IR (-O2):
define i32 @readlink(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
%4 = tail call i32 @assert(i32 0)
ret i32 -1
}
int llama_version_minor(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @llama_version_minor() {
ret i32 0
}
/* Type definitions */
struct timeval {
  long member_0;
  long member_1;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int kbhit() {
  struct timeval tv = {0L, 0L};
  fd_set fds;
  FD_ZERO(&fds);
  FD_SET(0, &fds);
  return select(1, &fds, NULL, NULL, &tv);
}


x86 assembly (clang, -O0):
<kbhit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1030 <memset@plt>
lea    -0x14(%rbp),%rdi
call   1040 <FD_ZERO@plt>
xor    %edi,%edi
lea    -0x14(%rbp),%rsi
call   1060 <FD_SET@plt>
mov    $0x1,%edi
lea    -0x14(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
mov    %rcx,%rdx
call   1050 <select@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kbhit>:
push   %rbx
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <FD_ZERO@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <FD_SET@plt>
lea    0x10(%rsp),%r8
mov    $0x1,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <select@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i32 @kbhit() {
%1 = alloca %struct.timeval
%2 = alloca i32
%3 = bitcast %struct.timeval* %1 to i8*
%4 = call i32 @FD_ZERO(i32* %2)
%5 = call i32 @FD_SET(i32 0, i32* %2)
%6 = call i32 @select(i32 1, i32* %2, i32* null, i32* null, %struct.timeval* %1)
ret i32 %6
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i32 @kbhit() {
%1 = alloca %struct.timeval
%2 = alloca i32
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @FD_ZERO(i32* %2)
%6 = call i32 @FD_SET(i32 0, i32* %2)
%7 = call i32 @select(i32 1, i32* %2, i32* null, i32* null, %struct.timeval* %1)
ret i32 %7
}
main() {
  f("");
  g(&(char){1});
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <f@plt>
movb   $0x1,-0x1(%rbp)
lea    -0x1(%rbp),%rdi
mov    $0x0,%al
call   1040 <g@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <f@plt>
movb   $0x1,0x7(%rsp)
lea    0x7(%rsp),%rdi
xor    %eax,%eax
call   1040 <g@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i8
%2 = call i32 (i8*, ...) bitcast (i32 (...)* @f to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i8 1, i8* %1
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @g to i32 (i8*, ...)*)(i8* %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @f to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
store i8 1, i8* %1
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @g to i32 (i8*, ...)*)(i8* %1)
ret i32 0
}
void ble_rsp_attclient_write_command(
    const struct ble_msg_attclient_write_command_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.ble_msg_attclient_write_command_rsp_t = type opaque
define void @ble_rsp_attclient_write_command(%struct.ble_msg_attclient_write_command_rsp_t* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double const, double const);
void print_vec2(const double *v2) { printf("v2 = {%f, %f}\n", v2[0], v2[1]); }


x86 assembly (clang, -O0):
<print_vec2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_vec2>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
lea    0xee0(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"v2 = {%f, %f}\0A\00"
define void @print_vec2(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 1
%8 = load double, double* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), double %5, double %8)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"v2 = {%f, %f}\0A\00"
define void @print_vec2(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), double %2, double %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void MMX_PSRLQ_imm(int dst_reg, int amount) {
  addbyte(0x66);
  addbyte(0x0f);
  addbyte(0x73);
  addbyte(0xc0 | dst_reg | 0x10);
  addbyte(amount);
}


x86 assembly (clang, -O0):
<MMX_PSRLQ_imm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0x73,%edi
call   1030 <addbyte@plt>
mov    -0x4(%rbp),%edi
or     $0xc0,%edi
or     $0x10,%edi
call   1030 <addbyte@plt>
mov    -0x8(%rbp),%edi
call   1030 <addbyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MMX_PSRLQ_imm>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x66,%edi
call   1030 <addbyte@plt>
mov    $0xf,%edi
call   1030 <addbyte@plt>
mov    $0x73,%edi
call   1030 <addbyte@plt>
or     $0xd0,%ebp
mov    %ebp,%edi
call   1030 <addbyte@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @MMX_PSRLQ_imm(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @addbyte(i32 102)
%6 = call i32 @addbyte(i32 15)
%7 = call i32 @addbyte(i32 115)
%8 = load i32, i32* %3
%9 = or i32 192, %8
%10 = or i32 %9, 16
%11 = call i32 @addbyte(i32 %10)
%12 = load i32, i32* %4
%13 = call i32 @addbyte(i32 %12)
ret void
}

LLVM IR (-O2):
define void @MMX_PSRLQ_imm(i32 %0, i32 %1) {
%3 = tail call i32 @addbyte(i32 102)
%4 = tail call i32 @addbyte(i32 15)
%5 = tail call i32 @addbyte(i32 115)
%6 = or i32 %0, 208
%7 = tail call i32 @addbyte(i32 %6)
%8 = tail call i32 @addbyte(i32 %1)
ret void
}
double mbar_to_atm(int mbar) { return (double)mbar / 1013; }


x86 assembly (clang, -O0):
<mbar_to_atm>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeec(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mbar_to_atm>:
cvtsi2sd %edi,%xmm0
divsd  0xef4(%rip),%xmm0
ret

LLVM IR (-O0):
define double @mbar_to_atm(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 1.013000e+03
ret double %5
}

LLVM IR (-O2):
define double @mbar_to_atm(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fdiv double %2, 1.013000e+03
ret double %3
}
/* Variables and functions */
int _cdio_len2blocks(unsigned int, int);
unsigned _cdio_ceil2block(unsigned offset, int blocksize) {
  return _cdio_len2blocks(offset, blocksize) * blocksize;
}


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

x86 assembly (clang, -O2):
<_cdio_ceil2block>:
push   %rbx
mov    %esi,%ebx
call   1030 <_cdio_len2blocks@plt>
imul   %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_cdio_ceil2block(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 = call i32 @_cdio_len2blocks(i32 %5, i32 %6)
%8 = load i32, i32* %4
%9 = mul nsw i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @_cdio_ceil2block(i32 %0, i32 %1) {
%3 = tail call i32 @_cdio_len2blocks(i32 %0, i32 %1)
%4 = mul nsw i32 %3, %1
ret i32 %4
}
/* Variables and functions */
int countargs(char **argv) {
  int i;
  for (i = 0; argv[i] != NULL; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<countargs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1135 <countargs+0x35>
jmp    1127 <countargs+0x27>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <countargs+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @countargs(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
double volume(double r, double t) {
  double pi = 3.14159265358979323846;
  return pi * (r * r) * t;
}


x86 assembly (clang, -O0):
<volume>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xeea(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<volume>:
mulsd  %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @volume(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
store double 0x400921FB54442D18, double* %5
%6 = load double, double* %5
%7 = load double, double* %3
%8 = load double, double* %3
%9 = fmul double %7, %8
%10 = fmul double %6, %9
%11 = load double, double* %4
%12 = fmul double %10, %11
ret double %12
}

LLVM IR (-O2):
define double @volume(double %0, double %1) {
%3 = fmul double %0, %0
%4 = fmul double %3, 0x400921FB54442D18
%5 = fmul double %4, %1
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ fatal_error(int, char *);
void *realloc(void *, size_t);
void *bfm_realloc(void *block, size_t bytes) {
  block = realloc(block, bytes);
  if (!block)
    fatal_error(-1, "out of memory.");
  return block;
}


x86 assembly (clang, -O0):
<bfm_realloc>:
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   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115d <bfm_realloc+0x3d>
mov    $0xffffffff,%edi
lea    0xea8(%rip),%rsi
call   1030 <fatal_error@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bfm_realloc>:
push   %rbx
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113f <bfm_realloc+0x1f>
lea    0xecb(%rip),%rsi
mov    $0xffffffff,%edi
call   1030 <fatal_error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"out of memory.\00"
define i8* @bfm_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 @fatal_error(i32 -1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@.str = [15 x i8] c"out of memory.\00"
define noalias i8* @bfm_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @fatal_error(i32 -1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
void on_key_press_msg(unsigned char key, int x, int y) {}


x86 assembly (clang, -O0):
<on_key_press_msg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @on_key_press_msg(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
define void @on_key_press_msg(i8 zeroext %0, i32 %1, i32 %2) {
ret void
}
/* Variables and functions */
scalar_t__ malloc(unsigned long);
int /*<<< orphan*/ memcpy(char *, char *, unsigned long);
unsigned char *_bdf_strdup(unsigned char *s, unsigned long len) {
  unsigned char *ns;
  if (s == 0 || len == 0)
    return 0;
  ns = (unsigned char *)malloc(len);
  (void)memcpy((char *)ns, (char *)s, len);
  return ns;
}


x86 assembly (clang, -O0):
<_bdf_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1146 <_bdf_strdup+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1153 <_bdf_strdup+0x33>
movq   $0x0,-0x8(%rbp)
jmp    1179 <_bdf_strdup+0x59>
mov    -0x18(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_bdf_strdup>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
test   %rdi,%rdi
je     1150 <_bdf_strdup+0x30>
mov    %rsi,%r14
test   %rsi,%rsi
je     1150 <_bdf_strdup+0x30>
mov    %rdi,%r15
mov    %r14,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @_bdf_strdup(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i64 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = tail call i64 @malloc(i64 %1)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @memcpy(i8* %8, i8* %0, i64 %1)
br label %10
10: ; preds = %2, %6
%11 = phi i8* [ %8, %6 ], [ null, %2 ]
ret i8* %11
}
long int getlong(unsigned char *buffer, int offset) {
  return (long)buffer[offset] | ((long)buffer[offset + 1] << 8L) |
         ((long)buffer[offset + 2] << 16L) | ((long)buffer[offset + 3] << 24L);
}


x86 assembly (clang, -O0):
<getlong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x8,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x2,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x10,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%edx
add    $0x3,%edx
movslq %edx,%rdx
movzbl (%rcx,%rdx,1),%ecx
shl    $0x18,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getlong>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%eax
ret

LLVM IR (-O0):
define i64 @getlong(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i64
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %11, i64 %14
%16 = load i8, i8* %15
%17 = zext i8 %16 to i64
%18 = shl i64 %17, 8
%19 = or i64 %10, %18
%20 = load i8*, i8** %3
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
%25 = load i8, i8* %24
%26 = zext i8 %25 to i64
%27 = shl i64 %26, 16
%28 = or i64 %19, %27
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
%34 = load i8, i8* %33
%35 = zext i8 %34 to i64
%36 = shl i64 %35, 24
%37 = or i64 %28, %36
ret i64 %37
}

LLVM IR (-O2):
define i64 @getlong(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = zext i8 %5 to i64
%7 = add nsw i32 %1, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = zext i8 %10 to i64
%12 = shl nuw nsw i64 %11, 8
%13 = or i64 %12, %6
%14 = add nsw i32 %1, 2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i64
%19 = shl nuw nsw i64 %18, 16
%20 = or i64 %13, %19
%21 = add nsw i32 %1, 3
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %0, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i64
%26 = shl nuw nsw i64 %25, 24
%27 = or i64 %20, %26
ret i64 %27
}
int fatten(int j) { return (35 + 3) + j + 2 * (j / 35); }


x86 assembly (clang, -O0):
<fatten>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x26,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x23,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
shl    $0x1,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fatten>:
movslq %edi,%rax
imul   $0xffffffffea0ea0eb,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
lea    (%rax,%rcx,2),%eax
add    $0x26,%eax
ret

LLVM IR (-O0):
define i32 @fatten(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 38, %3
%5 = load i32, i32* %2
%6 = sdiv i32 %5, 35
%7 = mul nsw i32 2, %6
%8 = add nsw i32 %4, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @fatten(i32 %0) {
%2 = add nsw i32 %0, 38
%3 = sdiv i32 %0, 35
%4 = shl nsw i32 %3, 1
%5 = add nsw i32 %2, %4
ret i32 %5
}
int foo(int n) {
  static int x3;
  int x1, x2;
  x1 = 2;
  x2 = 3;
  x1 = x1 + 1;
  return n + 1;
}


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

x86 assembly (clang, -O2):
<foo>:
lea    0x1(%rdi),%eax
ret

LLVM IR (-O0):
@foo.x3 = internal global i32 0
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 1
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(unsigned int);
int /*<<< orphan*/ stderr;
void *allocate(unsigned int size) {
  void *ptr = malloc(size);
  if (ptr == NULL) {
    fprintf(stderr, "Memory allocation error, terminating\n");
    exit(EXIT_FAILURE);
  }
  return (ptr);
}


x86 assembly (clang, -O0):
<allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1175 <allocate+0x45>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocate>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <allocate+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c"Memory allocation error, terminating\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @allocate(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c"Memory allocation error, terminating\0A\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @allocate(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void ln() { printf("\n"); }


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

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

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

LLVM IR (-O2):
define void @ln() {
%1 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printHomeMenu() {
  printf("Opcoes:\n\n1 - Cadastrar mensagem\n\n2 - Ler mensagens\n\n3 - Apagar "
         "mensagens\n\n4 - Sair da Aplicacao\n\n");
}


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

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

LLVM IR (-O0):
@.str = [98 x i8] c"Opcoes:\0A\0A1 - Cadastrar mensagem\0A\0A2 - Ler mensagens\0A\0A3 - Apagar mensagens\0A\0A4 - Sair da Aplicacao\0A\0A\00"
define void @printHomeMenu() {
%1 = call i32 @printf(i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [97 x i8] c"Opcoes:\0A\0A1 - Cadastrar mensagem\0A\0A2 - Ler mensagens\0A\0A3 - Apagar mensagens\0A\0A4 - Sair da Aplicacao\0A\00"
define void @printHomeMenu() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([97 x i8], [97 x i8]* @str, i64 0, i64 0))
ret void
}
int drop_rev_spaces(char const *s, int i) {
  while ((s[i] >= 9 && s[i] <= 13) || s[i] == 32)
    i--;
  return (i);
}


x86 assembly (clang, -O0):
<drop_rev_spaces>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x9,%eax
jl     113a <drop_rev_spaces+0x3a>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0xd(%rbp)
jle    114f <drop_rev_spaces+0x4f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    115f <drop_rev_spaces+0x5f>
jmp    116d <drop_rev_spaces+0x6d>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110b <drop_rev_spaces+0xb>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<drop_rev_spaces>:
mov    %esi,%eax
movslq %esi,%rcx
add    %rdi,%rcx
jmp    1117 <drop_rev_spaces+0x17>
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%eax
add    $0xffffffffffffffff,%rcx
movzbl (%rcx),%edx
lea    -0x9(%rdx),%esi
cmp    $0x5,%sil
jb     1110 <drop_rev_spaces+0x10>
cmp    $0x20,%dl
je     1110 <drop_rev_spaces+0x10>
ret

LLVM IR (-O0):
define i32 @drop_rev_spaces(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %31, %2
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp sge i32 %11, 9
br i1 %12, label %13, label %21
13: ; preds = %5
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp sle i32 %19, 13
br i1 %20, label %29, label %21
21: ; preds = %13, %5
%22 = load i8*, i8** %3
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 32
br label %29
29: ; preds = %21, %13
%30 = phi i1 [ true, %13 ], [ %28, %21 ]
br i1 %30, label %31, label %34
31: ; preds = %29
%32 = load i32, i32* %4
%33 = add nsw i32 %32, -1
store i32 %33, i32* %4
br label %5
34: ; preds = %29
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
define i32 @drop_rev_spaces(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
br label %4
4: ; preds = %8, %2
%5 = phi i64 [ %9, %8 ], [ %3, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
switch i8 %7, label %10 [
i8 32, label %8
i8 13, label %8
i8 12, label %8
i8 11, label %8
i8 10, label %8
i8 9, label %8
]
8: ; preds = %4, %4, %4, %4, %4, %4
%9 = add i64 %5, -1
br label %4
10: ; preds = %4
%11 = trunc i64 %5 to i32
ret i32 %11
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void USBEndpointDMAEnable(uint32_t ui32Base, uint32_t ui32Endpoint,
                          uint32_t ui32Flags) {
  if (ui32Flags & 0x00002000) {
    (*((volatile uint8_t *)(ui32Base + (ui32Endpoint - 0x10) + 0x00000113))) |=
        0x00000010;
  } else {
    (*((volatile uint8_t *)(ui32Base + (ui32Endpoint - 0x10) + 0x00000117))) |=
        0x00000020;
  }
}


x86 assembly (clang, -O0):
<USBEndpointDMAEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     113c <USBEndpointDMAEnable+0x3c>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
add    $0x113,%eax
cltq
mov    (%rax),%ecx
or     $0x10,%ecx
mov    %ecx,(%rax)
jmp    1155 <USBEndpointDMAEnable+0x55>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x10,%ecx
add    %ecx,%eax
add    $0x117,%eax
cltq
mov    (%rax),%ecx
or     $0x20,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBEndpointDMAEnable>:
xor    %eax,%eax
test   $0x2000,%edx
sete   %al
add    %esi,%edi
lea    (%rdi,%rax,4),%ecx
add    $0x103,%ecx
shl    $0x4,%eax
add    $0x10,%eax
movslq %ecx,%rcx
or     %eax,(%rcx)
ret

LLVM IR (-O0):
define void @USBEndpointDMAEnable(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = and i32 %7, 8192
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %20
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 16
%14 = add nsw i32 %11, %13
%15 = add nsw i32 %14, 275
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
%19 = or i32 %18, 16
store volatile i32 %19, i32* %17
br label %30
20: ; preds = %3
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = sub nsw i32 %22, 16
%24 = add nsw i32 %21, %23
%25 = add nsw i32 %24, 279
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i32*
%28 = load volatile i32, i32* %27
%29 = or i32 %28, 32
store volatile i32 %29, i32* %27
br label %30
30: ; preds = %20, %10
ret void
}

LLVM IR (-O2):
define void @USBEndpointDMAEnable(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, 8192
%5 = icmp eq i32 %4, 0
%6 = add i32 %1, %0
%7 = select i1 %5, i32 263, i32 259
%8 = select i1 %5, i32 32, i32 16
%9 = add i32 %6, %7
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = or i32 %12, %8
store volatile i32 %13, i32* %11
ret void
}
long long variable_shift(long long x, int i) { return x >> i; }


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

x86 assembly (clang, -O2):
<variable_shift>:
mov    %esi,%ecx
mov    %rdi,%rax
sar    %cl,%rax
ret

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

LLVM IR (-O2):
define i64 @variable_shift(i64 %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = ashr i64 %0, %3
ret i64 %4
}
int a_fun(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @a_fun() {
ret i32 1
}

LLVM IR (-O2):
define i32 @a_fun() {
ret i32 1
}
char CAS(volatile void *addr, volatile void *value, void *newvalue) {
  register char ret;
  __asm__ __volatile__("# CAS \n\t"
                       "lock ; "
                       "cmpxchg %2, (%1) \n\t"
                       "sete %0               \n\t"
                       : "=a"(ret)
                       : "c"(addr), "d"(newvalue), "a"(value));
  return ret;
}


x86 assembly (clang, -O0):
<CAS>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rax
lock cmpxchg %rdx,(%rcx)
sete   %al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CAS>:
mov    %rsi,%rax
mov    %rdi,%rcx
lock cmpxchg %rdx,(%rcx)
sete   %al
ret

LLVM IR (-O0):
define signext i8 @CAS(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %6
%10 = load i8*, i8** %5
%11 = call i8 asm sideeffect "# CAS \0A\09lock ; cmpxchg $2, ($1) \0A\09sete $0 \0A\09", "={ax},{cx},{dx},{ax},~{dirflag},~{fpsr},~{flags}"(i8* %8, i8* %9, i8* %10)
store i8 %11, i8* %7
%12 = load i8, i8* %7
ret i8 %12
}

LLVM IR (-O2):
define signext i8 @CAS(i8* %0, i8* %1, i8* %2) {
%4 = tail call i8 asm sideeffect "# CAS \0A\09lock ; cmpxchg $2, ($1) \0A\09sete $0 \0A\09", "={ax},{cx},{dx},{ax},~{dirflag},~{fpsr},~{flags}"(i8* %0, i8* %2, i8* %1)
ret i8 %4
}
void CMovableBrushEntity_OnInitClass(void) {}


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

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

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

LLVM IR (-O2):
define void @CMovableBrushEntity_OnInitClass() {
ret void
}
void XSetClassHint() {}


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

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

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

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