xunge/DecIR huggingface dataset:
int ft_strlenz(const char *s) {
  int i;
  i = 0;
  while (*(s + i) != '\0') {
    i++;
  }
  return (i);
}


x86 assembly (clang, -O0):
<ft_strlenz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <ft_strlenz+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <ft_strlenz+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ft_strlenz(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 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%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 @ft_strlenz(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
__attribute__((always_)) void setup_per_cpu_pageset(void) {}


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

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

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

LLVM IR (-O2):
define void @setup_per_cpu_pageset() {
ret void
}
/* Type definitions */
struct iovec {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ INLINE_SYSCALL(
    int /*<<< orphan*/ (*)(int, struct iovec const *, int, int /*<<< orphan*/),
    int, int, struct iovec const *, int, int /*<<< orphan*/);
ssize_t preadv(int fd, const struct iovec *vector, int count, off_t offset) {
  return INLINE_SYSCALL(preadv, 4, fd, vector, count, offset);
}


x86 assembly (clang, -O0):
<preadv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    0x2ea5(%rip),%rdi
mov    $0x4,%esi
call   1030 <INLINE_SYSCALL@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<preadv>:
mov    %ecx,%r9d
mov    %edx,%r8d
mov    %rsi,%rcx
mov    %edi,%edx
mov    0x2ebe(%rip),%rdi
mov    $0x4,%esi
jmp    1030 <INLINE_SYSCALL@plt>

LLVM IR (-O0):
%struct.iovec = type { i32 }
define i32 @preadv(i32 %0, %struct.iovec* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca %struct.iovec*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store %struct.iovec* %1, %struct.iovec** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load %struct.iovec*, %struct.iovec** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @INLINE_SYSCALL(i32 (i32, %struct.iovec*, i32, i32)* @preadv, i32 4, i32 %9, %struct.iovec* %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.iovec = type { i32 }
define i32 @preadv(i32 %0, %struct.iovec* %1, i32 %2, i32 %3) {
%5 = tail call i32 @INLINE_SYSCALL(i32 (i32, %struct.iovec*, i32, i32)* @preadv, i32 4, i32 %0, %struct.iovec* %1, i32 %2, i32 %3)
ret i32 %5
}
int decode_range(unsigned int *range, unsigned int *code, unsigned char **src) {
  if (!((*range) >> 24)) {
    (*range) <<= 8;
    *code = ((*code) << 8) + (*src)++[5];
    return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<decode_range>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
shr    $0x18,%eax
cmp    $0x0,%eax
jne    115f <decode_range+0x5f>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
shl    $0x8,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
shl    $0x8,%ecx
mov    -0x20(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
movzbl 0x5(%rax),%eax
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1166 <decode_range+0x66>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_range>:
mov    (%rdi),%ecx
xor    %eax,%eax
cmp    $0xffffff,%ecx
ja     112d <decode_range+0x2d>
shl    $0x8,%ecx
mov    %ecx,(%rdi)
mov    (%rsi),%eax
shl    $0x8,%eax
mov    (%rdx),%rcx
lea    0x1(%rcx),%rdi
mov    %rdi,(%rdx)
movzbl 0x5(%rcx),%ecx
or     %eax,%ecx
mov    %ecx,(%rsi)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @decode_range(i32* nocapture %0, i32* nocapture %1, i8** nocapture %2) {
%4 = load i32, i32* %0
%5 = icmp ult i32 %4, 16777216
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = shl nuw i32 %4, 8
store i32 %7, i32* %0
%8 = load i32, i32* %1
%9 = shl i32 %8, 8
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %11, i8** %2
%12 = getelementptr inbounds i8, i8* %10, i64 5
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = or i32 %9, %14
store i32 %15, i32* %1
br label %16
16: ; preds = %3, %6
%17 = phi i32 [ 1, %6 ], [ 0, %3 ]
ret i32 %17
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void __u32_val_succ(void *cc, void *k, void *v, bool n) {
  if (!n) {
    (*(uint32_t *)v)++;
  } else {
    *(uint32_t *)v = 1;
  }
}


x86 assembly (clang, -O0):
<__u32_val_succ>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    112d <__u32_val_succ+0x2d>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1137 <__u32_val_succ+0x37>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__u32_val_succ>:
mov    $0x1,%eax
test   %ecx,%ecx
je     110c <__u32_val_succ+0xc>
mov    %eax,(%rdx)
ret
mov    (%rdx),%eax
add    $0x1,%eax
mov    %eax,(%rdx)
ret

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

LLVM IR (-O2):
define void @__u32_val_succ(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture %2, i32 %3) {
%5 = icmp eq i32 %3, 0
%6 = bitcast i8* %2 to i32*
br i1 %5, label %7, label %10
7: ; preds = %4
%8 = load i32, i32* %6
%9 = add nsw i32 %8, 1
br label %10
10: ; preds = %4, %7
%11 = phi i32 [ %9, %7 ], [ 1, %4 ]
store i32 %11, i32* %6
ret void
}
/* Variables and functions */
char *fgets(char *, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int /*<<< orphan*/ stdin;
size_t strlen(char *);
char *read_input() {
  char *result = (char *)malloc(sizeof(char) * 256);
  result = fgets(result, 256, stdin);
  if (result != NULL) {
    size_t len = strlen(result);
    if (len > 0)
      result[len - 1] = '\0';
  }
  return result;
}


x86 assembly (clang, -O0):
<read_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x100,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e97(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1040 <fgets@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1199 <read_input+0x69>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jbe    1194 <read_input+0x64>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1199 <read_input+0x69>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_input>:
push   %rbx
mov    $0x100,%edi
call   1050 <malloc@plt>
mov    0x2ea6(%rip),%rcx
mov    (%rcx),%edx
mov    %rax,%rdi
mov    $0x100,%esi
call   1040 <fgets@plt>
mov    %rax,%rbx
test   %rax,%rax
je     116b <read_input+0x3b>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
je     116b <read_input+0x3b>
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
define i8* @read_input() {
%1 = alloca i8*
%2 = alloca i64
%3 = call i64 @malloc(i32 256)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %1
%5 = load i8*, i8** %1
%6 = load i32, i32* @stdin
%7 = call i8* @fgets(i8* %5, i32 256, i32 %6)
store i8* %7, i8** %1
%8 = load i8*, i8** %1
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %21
10: ; preds = %0
%11 = load i8*, i8** %1
%12 = call i64 @strlen(i8* %11)
store i64 %12, i64* %2
%13 = load i64, i64* %2
%14 = icmp ugt i64 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = load i8*, i8** %1
%17 = load i64, i64* %2
%18 = sub i64 %17, 1
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 0, i8* %19
br label %20
20: ; preds = %15, %10
br label %21
21: ; preds = %20, %0
%22 = load i8*, i8** %1
ret i8* %22
}

LLVM IR (-O2):
@stdin = global i32 0
define i8* @read_input() {
%1 = tail call i64 @malloc(i32 256)
%2 = inttoptr i64 %1 to i8*
%3 = load i32, i32* @stdin
%4 = tail call i8* @fgets(i8* %2, i32 256, i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %12, label %6
6: ; preds = %0
%7 = tail call i64 @strlen(i8* %4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = add i64 %7, -1
%11 = getelementptr inbounds i8, i8* %4, i64 %10
store i8 0, i8* %11
br label %12
12: ; preds = %6, %9, %0
ret i8* %4
}
double ffi_test_8(double x, float y, double z, float t, int w) {
  return x * y + z * t + w;
}


x86 assembly (clang, -O0):
<ffi_test_8>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movsd  %xmm2,-0x18(%rbp)
movss  %xmm3,-0x1c(%rbp)
mov    %edi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  -0x18(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsi2sdl -0x20(%rbp),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffi_test_8>:
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm3,%xmm3
mulsd  %xmm2,%xmm3
mulsd  %xmm1,%xmm0
addsd  %xmm3,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %edi,%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ffi_test_8(double %0, float %1, double %2, float %3, i32 %4) {
%6 = alloca double
%7 = alloca float
%8 = alloca double
%9 = alloca float
%10 = alloca i32
store double %0, double* %6
store float %1, float* %7
store double %2, double* %8
store float %3, float* %9
store i32 %4, i32* %10
%11 = load double, double* %6
%12 = load float, float* %7
%13 = fpext float %12 to double
%14 = load double, double* %8
%15 = load float, float* %9
%16 = fpext float %15 to double
%17 = fmul double %14, %16
%18 = call double @llvm.fmuladd.f64(double %11, double %13, double %17)
%19 = load i32, i32* %10
%20 = sitofp i32 %19 to double
%21 = fadd double %18, %20
ret double %21
}

LLVM IR (-O2):
define double @ffi_test_8(double %0, float %1, double %2, float %3, i32 %4) {
%6 = fpext float %1 to double
%7 = fpext float %3 to double
%8 = fmul double %7, %2
%9 = tail call double @llvm.fmuladd.f64(double %0, double %6, double %8)
%10 = sitofp i32 %4 to double
%11 = fadd double %9, %10
ret double %11
}
/* Variables and functions */
double sin(double);
double fz(double *y, double t, double *par) { return -sin(-t); }


x86 assembly (clang, -O0):
<fz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <sin@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fz>:
jmp    1030 <sin@plt>

LLVM IR (-O0):
define double @fz(double* %0, double %1, double* %2) {
%4 = alloca double*
%5 = alloca double
%6 = alloca double*
store double* %0, double** %4
store double %1, double* %5
store double* %2, double** %6
%7 = load double, double* %5
%8 = fneg double %7
%9 = call double @sin(double %8)
%10 = fneg double %9
ret double %10
}

LLVM IR (-O2):
define double @fz(double* nocapture readnone %0, double %1, double* nocapture readnone %2) {
%4 = tail call double @sin(double %1)
ret double %4
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int focus;
};
typedef TYPE_1__ XEnterWindowEvent;

/* Variables and functions */
void set_XEnterWindowEvent_focus(void *_p, int _v) {
  ((XEnterWindowEvent *)_p)->focus = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XEnterWindowEvent_focus>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XEnterWindowEvent_focus(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 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XEnterWindowEvent_focus(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
void CGDisplayRestoreColorSyncSettings(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ sn3218a_write_reg_single(int, int /*<<< orphan*/);
void sn3218a_set_brightness(int ch, uint8_t brightness) {
  sn3218a_write_reg_single(0x01 + ch, brightness);
}


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

x86 assembly (clang, -O2):
<sn3218a_set_brightness>:
add    $0x1,%edi
jmp    1030 <sn3218a_write_reg_single@plt>

LLVM IR (-O0):
define void @sn3218a_set_brightness(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 = add nsw i32 1, %5
%7 = load i32, i32* %4
%8 = call i32 @sn3218a_write_reg_single(i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
define void @sn3218a_set_brightness(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 1
%4 = tail call i32 @sn3218a_write_reg_single(i32 %3, i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ReadWord(char *, int /*<<< orphan*/ *);
int SearchVocab(char *);
scalar_t__ feof(int /*<<< orphan*/ *);
int ReadWordIndex(FILE *fin) {
  char word[60];
  ReadWord(word, fin);
  if (feof(fin)) {
    return -1;
  }
  return SearchVocab(word);
}


x86 assembly (clang, -O0):
<ReadWordIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <ReadWord@plt>
mov    -0x10(%rbp),%rdi
call   1030 <feof@plt>
cmp    $0x0,%rax
je     1168 <ReadWordIndex+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1174 <ReadWordIndex+0x44>
lea    -0x50(%rbp),%rdi
call   1050 <SearchVocab@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadWordIndex>:
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <ReadWord@plt>
mov    %rbx,%rdi
call   1030 <feof@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1160 <ReadWordIndex+0x30>
mov    %rsp,%rdi
call   1050 <SearchVocab@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ReadWordIndex(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [60 x i8]
store i32* %0, i32** %3
%5 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 0
%6 = load i32*, i32** %3
%7 = call i32 @ReadWord(i8* %5, i32* %6)
%8 = load i32*, i32** %3
%9 = call i64 @feof(i32* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %15
12: ; preds = %1
%13 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 0
%14 = call i32 @SearchVocab(i8* %13)
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %11
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @ReadWordIndex(i32* %0) {
%2 = alloca [60 x i8]
%3 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
%4 = call i32 @ReadWord(i8* %3, i32* %0)
%5 = call i64 @feof(i32* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @SearchVocab(i8* %3)
br label %9
9: ; preds = %1, %7
%10 = phi i32 [ %8, %7 ], [ -1, %1 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/);
int /*<<< orphan*/ fopen(char const *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stdout;
void write_logfile(const char *logfile) {
  fclose(stdout);
  stdout = fopen(logfile, "a");
  if (!stdout) {
    perror("Could not open LOGFILE for writing");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<write_logfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1030 <fclose@plt>
mov    -0x8(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1040 <fopen@plt>
mov    %eax,%ecx
mov    0x2e6d(%rip),%rax
mov    %ecx,(%rax)
mov    0x2e64(%rip),%rax
cmpl   $0x0,(%rax)
jne    119b <write_logfile+0x5b>
lea    0xe76(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_logfile>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e92(%rip),%r14
mov    (%r14),%edi
call   1030 <fclose@plt>
lea    0xea3(%rip),%rsi
mov    %rbx,%rdi
call   1040 <fopen@plt>
mov    %eax,(%r14)
test   %eax,%eax
je     1174 <write_logfile+0x34>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe87(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [2 x i8] c"a\00"
@.str.1 = [35 x i8] c"Could not open LOGFILE for writing\00"
define void @write_logfile(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = call i32 @fclose(i32 %3)
%5 = load i8*, i8** %2
%6 = call i32 @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %6, i32* @stdout
%7 = load i32, i32* @stdout
%8 = icmp ne i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [2 x i8] c"a\00"
@.str.1 = [35 x i8] c"Could not open LOGFILE for writing\00"
define void @write_logfile(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fclose(i32 %2)
%4 = tail call i32 @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %4, i32* @stdout
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = tail call i32 @perror(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret void
}
void hash_table_set() {}


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

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

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

LLVM IR (-O2):
define void @hash_table_set() {
ret void
}
int test_imm_56int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x56 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_56int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 5636096
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ PrintErrorCode();
int /*<<< orphan*/ dxl_write_byte(int, int, int);
void changeP(int Id, int pValue) {
  dxl_write_byte(Id, 28, pValue);
  PrintErrorCode();
}


x86 assembly (clang, -O0):
<changeP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    $0x1c,%esi
call   1030 <dxl_write_byte@plt>
mov    $0x0,%al
call   1040 <PrintErrorCode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<changeP>:
push   %rax
mov    %esi,%edx
mov    $0x1c,%esi
call   1030 <dxl_write_byte@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <PrintErrorCode@plt>

LLVM IR (-O0):
define void @changeP(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 @dxl_write_byte(i32 %5, i32 28, i32 %6)
%8 = call i32 (...) @PrintErrorCode()
ret void
}

LLVM IR (-O2):
define void @changeP(i32 %0, i32 %1) {
%3 = tail call i32 @dxl_write_byte(i32 %0, i32 28, i32 %1)
%4 = tail call i32 (...) @PrintErrorCode()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned short *, int);
void setU2(unsigned char *p, unsigned short u) { memcpy(p, &u, 2); }


x86 assembly (clang, -O0):
<setU2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xa(%rbp),%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setU2>:
push   %rax
mov    %si,0x6(%rsp)
lea    0x6(%rsp),%rsi
mov    $0x2,%edx
call   1030 <memcpy@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @setU2(i8* %0, i16 zeroext %1) {
%3 = alloca i16
store i16 %1, i16* %3
%4 = call i32 @memcpy(i8* %0, i16* %3, i32 2)
ret void
}
/* Type definitions */
struct udcProtocol {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ freez(struct udcProtocol **);
void udcProtocolFree(struct udcProtocol **pProt) { freez(pProt); }


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

x86 assembly (clang, -O2):
<udcProtocolFree>:
jmp    1030 <freez@plt>

LLVM IR (-O0):
%struct.udcProtocol = type { i32 }
define void @udcProtocolFree(%struct.udcProtocol** %0) {
%2 = alloca %struct.udcProtocol**
store %struct.udcProtocol** %0, %struct.udcProtocol*** %2
%3 = load %struct.udcProtocol**, %struct.udcProtocol*** %2
%4 = call i32 @freez(%struct.udcProtocol** %3)
ret void
}

LLVM IR (-O2):
%struct.udcProtocol = type { i32 }
define void @udcProtocolFree(%struct.udcProtocol** %0) {
%2 = tail call i32 @freez(%struct.udcProtocol** %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL;
typedef int /*<<< orphan*/ EVP_MD_CTX;

/* Variables and functions */
int ssl3_handshake_mac(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                       int /*<<< orphan*/ *, int /*<<< orphan*/,
                       unsigned char *);
int ssl3_cert_verify_mac(SSL *s, EVP_MD_CTX *ctx, unsigned char *p) {
  return (ssl3_handshake_mac(s, ctx, NULL, 0, p));
}


x86 assembly (clang, -O0):
<ssl3_cert_verify_mac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%r8
xor    %eax,%eax
mov    %eax,%edx
xor    %ecx,%ecx
call   1030 <ssl3_handshake_mac@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssl3_cert_verify_mac>:
mov    %rdx,%r8
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <ssl3_handshake_mac@plt>

LLVM IR (-O0):
define i32 @ssl3_cert_verify_mac(i32* %0, i32* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = load i32*, i32** %5
%9 = load i8*, i8** %6
%10 = call i32 @ssl3_handshake_mac(i32* %7, i32* %8, i32* null, i32 0, i8* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @ssl3_cert_verify_mac(i32* %0, i32* %1, i8* %2) {
%4 = tail call i32 @ssl3_handshake_mac(i32* %0, i32* %1, i32* null, i32 0, i8* %2)
ret i32 %4
}
void asmif_init(void) {}


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

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

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

LLVM IR (-O2):
define void @asmif_init() {
ret void
}
int device_event_report(void *data, int len) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @device_event_report(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
main() {
  int done, i, x = 6;
  done = i = 0;
  for (i = 0; (i < 100) && (x /= 2) > 1; i++)
    done++;
  printf("%d %d\n", i, done);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x6,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0xc(%rbp)
mov    %al,-0x11(%rbp)
jge    1161 <main+0x51>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmp    $0x1,%eax
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1171 <main+0x61>
jmp    1188 <main+0x78>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113b <main+0x2b>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 1, i32 1)
ret i32 0
}
int isspace(int c) { return ((c == ' ') || ('\t' <= c && c <= '\r')); }


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1139 <isspace+0x39>
xor    %eax,%eax
mov    $0x9,%ecx
cmp    -0x4(%rbp),%ecx
mov    %al,-0x6(%rbp)
jg     1133 <isspace+0x33>
cmpl   $0xd,-0x4(%rbp)
setle  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
cmp    $0x20,%edi
sete   %al
add    $0xfffffff7,%edi
cmp    $0x5,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isspace(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 32
br i1 %4, label %13, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 9, %6
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 13
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ false, %5 ], [ %10, %8 ]
br label %13
13: ; preds = %11, %1
%14 = phi i1 [ true, %1 ], [ %12, %11 ]
%15 = zext i1 %14 to i32
ret i32 %15
}

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
%2 = icmp eq i32 %0, 32
%3 = add i32 %0, -9
%4 = icmp ult i32 %3, 5
%5 = or i1 %2, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ arm_arith_add(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ t16_data_imm8pc_op();
void t16_adr() { arm_arith_add(t16_data_imm8pc_op(), 0); }


x86 assembly (clang, -O0):
<t16_adr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <t16_data_imm8pc_op@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1030 <arm_arith_add@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t16_adr>:
push   %rax
xor    %eax,%eax
call   1040 <t16_data_imm8pc_op@plt>
mov    %eax,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <arm_arith_add@plt>

LLVM IR (-O0):
define void @t16_adr() {
%1 = call i32 (...) @t16_data_imm8pc_op()
%2 = call i32 @arm_arith_add(i32 %1, i32 0)
ret void
}

LLVM IR (-O2):
define void @t16_adr() {
%1 = tail call i32 (...) @t16_data_imm8pc_op()
%2 = tail call i32 @arm_arith_add(i32 %1, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char const *);
void bomb(const char *message) {
  endwin();
  puts(message);
  exit(0);
}


x86 assembly (clang, -O0):
<bomb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <endwin@plt>
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<bomb>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <endwin@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
define void @bomb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @endwin()
%4 = load i8*, i8** %2
%5 = call i32 @puts(i8* %4)
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @bomb(i8* nocapture %0) {
%2 = tail call i32 (...) @endwin()
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_int(int i) { printf("int: %d\n", i); }


x86 assembly (clang, -O0):
<print_int>:
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):
<print_int>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"int: %d\0A\00"
define void @print_int(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int sc_is_alpha(char el) {
  return (('a' <= el && el <= 'z') || ('A' <= el && el <= 'Z')) ? 1 : 0;
}


x86 assembly (clang, -O0):
<sc_is_alpha>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     112d <sc_is_alpha+0x2d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x2(%rbp)
jle    1156 <sc_is_alpha+0x56>
movsbl -0x1(%rbp),%edx
xor    %eax,%eax
mov    $0x41,%ecx
cmp    %edx,%ecx
mov    %al,-0x3(%rbp)
jg     1150 <sc_is_alpha+0x50>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sc_is_alpha>:
and    $0xdf,%dil
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @sc_is_alpha(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sle i32 97, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sle i32 65, %12
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 90
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i64
%23 = select i1 %21, i32 1, i32 0
ret i32 %23
}

LLVM IR (-O2):
define i32 @sc_is_alpha(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int getDbVersion();
int /*<<< orphan*/ printf(char *, char *, int, char *);
char *sqlite3_libversion();
int doVersion() {
  printf("App Version:    %s\n"
         "DB Version:     %d\n"
         "SQLite Version: %s\n",
         "0.7.6.1", getDbVersion(), sqlite3_libversion());
  return 1;
}


x86 assembly (clang, -O0):
<doVersion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <getDbVersion@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <sqlite3_libversion@plt>
mov    -0x4(%rbp),%edx
mov    %rax,%rcx
lea    0xeaa(%rip),%rdi
lea    0xedd(%rip),%rsi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doVersion>:
push   %rbx
xor    %eax,%eax
call   1050 <getDbVersion@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <sqlite3_libversion@plt>
lea    0xeb8(%rip),%rdi
lea    0xeeb(%rip),%rsi
mov    %ebx,%edx
mov    %rax,%rcx
call   1040 <printf@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [58 x i8] c"App Version: %s\0ADB Version: %d\0ASQLite Version: %s\0A\00"
@.str.1 = [8 x i8] c"0.7.6.1\00"
define i32 @doVersion() {
%1 = call i32 (...) @getDbVersion()
%2 = call i8* (...) @sqlite3_libversion()
%3 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %2)
ret i32 1
}

LLVM IR (-O2):
@.str = [58 x i8] c"App Version: %s\0ADB Version: %d\0ASQLite Version: %s\0A\00"
@.str.1 = [8 x i8] c"0.7.6.1\00"
define i32 @doVersion() {
%1 = tail call i32 (...) @getDbVersion()
%2 = tail call i8* (...) @sqlite3_libversion()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %2)
ret i32 1
}
/* Type definitions */
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned long gettimemicroseconds() {
  struct timeval t;
  unsigned long r;
  (void)gettimeofday(&t, NULL);
  r = t.tv_sec * 1000000;
  r += t.tv_usec;
  return r;
}


x86 assembly (clang, -O0):
<gettimemicroseconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x10(%rbp),%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettimemicroseconds>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @gettimemicroseconds() {
%1 = alloca %struct.timeval
%2 = alloca i64
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
store i64 %7, i64* %2
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%9 = load i64, i64* %8
%10 = load i64, i64* %2
%11 = add i64 %10, %9
store i64 %11, i64* %2
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @gettimemicroseconds() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add i64 %9, %7
ret i64 %10
}
/* Variables and functions */
int strlen(char *);
char tolower(char);
char *lowerstr(char *str) {
  int x;
  for (x = 0; x < strlen(str); x++) {
    str[x] = tolower(str[x]);
  }
  return str;
}


x86 assembly (clang, -O0):
<lowerstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    117b <lowerstr+0x5b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <lowerstr+0x13>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowerstr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
jle    1161 <lowerstr+0x41>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1040 <tolower@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1140 <lowerstr+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @lowerstr(i8* returned %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = tail call signext i8 @tolower(i8 signext %7)
store i8 %8, i8* %6
%9 = add nuw nsw i64 %5, 1
%10 = tail call i32 @strlen(i8* %0)
%11 = sext i32 %10 to i64
%12 = icmp slt i64 %9, %11
br i1 %12, label %4, label %13
13: ; preds = %4, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *const);
int /*<<< orphan*/ stderr;
int assert_has_file(int index, int argc, char *const argv[]) {
  if (index + 1 >= argc) {
    fprintf(stderr, "missing argument for parameter %s!", argv[index]);
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<assert_has_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cmp    -0xc(%rbp),%eax
jl     1170 <assert_has_file+0x50>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xea3(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_has_file>:
lea    0x1(%rdi),%eax
cmp    %esi,%eax
jge    1128 <assert_has_file+0x8>
ret
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
movslq %edi,%rcx
mov    (%rdx,%rcx,8),%rdx
lea    0xec0(%rip),%rsi
mov    %eax,%edi
call   1030 <fprintf@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"missing argument for parameter %s!\00"
@EXIT_FAILURE = global i32 0
define i32 @assert_has_file(i32 %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%8 = load i32, i32* %5
%9 = add nsw i32 %8, 1
%10 = load i32, i32* %6
%11 = icmp sge i32 %9, %10
br i1 %11, label %12, label %22
12: ; preds = %3
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %7
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %3
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"missing argument for parameter %s!\00"
@EXIT_FAILURE = global i32 0
define i32 @assert_has_file(i32 %0, i32 %1, i8** nocapture %2) {
%4 = add nsw i32 %0, 1
%5 = icmp slt i32 %4, %1
br i1 %5, label %14, label %6
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = sext i32 %0 to i64
%9 = getelementptr inbounds i8*, i8** %2, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %3
ret i32 undef
}
void gtk_text_view_buffer_to_window_coords() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_view_buffer_to_window_coords() {
ret void
}
int foo2() { return 2; }


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

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

LLVM IR (-O0):
define i32 @foo2() {
ret i32 2
}

LLVM IR (-O2):
define i32 @foo2() {
ret i32 2
}
void __lngAdd(unsigned short acc[2], unsigned short addend[2]) {
  acc[1] += addend[1] + (*addend > (unsigned short)-1 - *acc);
  *acc += *addend;
}


x86 assembly (clang, -O0):
<__lngAdd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzwl 0x2(%rax),%edx
mov    -0x10(%rbp),%rax
movzwl (%rax),%eax
mov    -0x8(%rbp),%rcx
movzwl (%rcx),%esi
mov    $0xffff,%ecx
sub    %esi,%ecx
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    %eax,%edx
mov    -0x8(%rbp),%rax
movzwl 0x2(%rax),%ecx
add    %edx,%ecx
mov    %cx,0x2(%rax)
mov    -0x10(%rbp),%rax
movzwl (%rax),%edx
mov    -0x8(%rbp),%rax
movzwl (%rax),%ecx
add    %edx,%ecx
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__lngAdd>:
movzwl 0x2(%rsi),%eax
movzwl (%rdi),%ecx
movzwl (%rsi),%edx
add    %cx,%dx
adc    %ax,0x2(%rdi)
add    (%rsi),%cx
mov    %cx,(%rdi)
ret

LLVM IR (-O0):
define void @__lngAdd(i16* %0, i16* %1) {
%3 = alloca i16*
%4 = alloca i16*
store i16* %0, i16** %3
store i16* %1, i16** %4
%5 = load i16*, i16** %4
%6 = getelementptr inbounds i16, i16* %5, i64 1
%7 = load i16, i16* %6
%8 = zext i16 %7 to i32
%9 = load i16*, i16** %4
%10 = load i16, i16* %9
%11 = zext i16 %10 to i32
%12 = load i16*, i16** %3
%13 = load i16, i16* %12
%14 = zext i16 %13 to i32
%15 = sub nsw i32 65535, %14
%16 = icmp sgt i32 %11, %15
%17 = zext i1 %16 to i32
%18 = add nsw i32 %8, %17
%19 = load i16*, i16** %3
%20 = getelementptr inbounds i16, i16* %19, i64 1
%21 = load i16, i16* %20
%22 = zext i16 %21 to i32
%23 = add nsw i32 %22, %18
%24 = trunc i32 %23 to i16
store i16 %24, i16* %20
%25 = load i16*, i16** %4
%26 = load i16, i16* %25
%27 = zext i16 %26 to i32
%28 = load i16*, i16** %3
%29 = load i16, i16* %28
%30 = zext i16 %29 to i32
%31 = add nsw i32 %30, %27
%32 = trunc i32 %31 to i16
store i16 %32, i16* %28
ret void
}

LLVM IR (-O2):
define void @__lngAdd(i16* nocapture %0, i16* nocapture %1) {
%3 = getelementptr inbounds i16, i16* %1, i64 1
%4 = load i16, i16* %3
%5 = load i16, i16* %1
%6 = load i16, i16* %0
%7 = xor i16 %6, -1
%8 = icmp ugt i16 %5, %7
%9 = zext i1 %8 to i16
%10 = getelementptr inbounds i16, i16* %0, i64 1
%11 = load i16, i16* %10
%12 = add i16 %11, %4
%13 = add i16 %12, %9
store i16 %13, i16* %10
%14 = load i16, i16* %1
%15 = add i16 %14, %6
store i16 %15, i16* %0
ret void
}