xunge/DecIR huggingface dataset:
int f() { return 10000 - 729 - 918; }


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

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

LLVM IR (-O0):
define i32 @f() {
ret i32 8353
}

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

/* Variables and functions */
uint8_t head_bytearray(uint8_t *arr) { return arr[0]; }


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

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

LLVM IR (-O0):
define i32 @head_bytearray(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @head_bytearray(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
extern char *strstr(const char *cs, const char *ct) {
  register char *__res;
  __asm__("cld\n\t"
          "movl %4,%%edi\n\t"
          "repne\n\t"
          "scasb\n\t"
          "notl %%ecx\n\t"
          "decl %%ecx\n\t"
          "movl %%ecx,%%edx\n"
          "1:\tmovl %4,%%edi\n\t"
          "movl %%esi,%%eax\n\t"
          "movl %%edx,%%ecx\n\t"
          "repe\n\t"
          "cmpsb\n\t"
          "je 2f\n\t"
          "xchgl %%eax,%%esi\n\t"
          "incl %%esi\n\t"
          "cmpb $0,-1(%%eax)\n\t"
          "jne 1b\n\t"
          "xorl %%eax,%%eax\n\t"
          "2:"
          : "=a"(__res)
          : "0"(0), "c"(0xffffffff), "S"(cs), "g"(ct));
  return __res;
}


x86 assembly (clang, -O0):
<strstr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
mov    $0xffffffff,%ecx
cld
mov    -0x20(%rbp),%edi
repnz scas %es:(%rdi),%al
not    %ecx
dec    %ecx
mov    %ecx,%edx
mov    -0x20(%rbp),%edi
mov    %esi,%eax
mov    %edx,%ecx
repz cmpsb %es:(%rdi),%ds:(%rsi)
je     114a <strstr+0x4a>
xchg   %eax,%esi
inc    %esi
cmpb   $0x0,-0x1(%eax)
jne    112b <strstr+0x2b>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i8* @strstr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i8* asm "cld\0A\09movl $4,%edi\0A\09repne\0A\09scasb\0A\09notl %ecx\0A\09decl %ecx\0A\09movl %ecx,%edx\0A1:\09movl $4,%edi\0A\09movl %esi,%eax\0A\09movl %edx,%ecx\0A\09repe\0A\09cmpsb\0A\09je 2f\0A\09xchgl %eax,%esi\0A\09incl %esi\0A\09cmpb $$0,-1(%eax)\0A\09jne 1b\0A\09xorl %eax,%eax\0A\092:", "={ax},0,{cx},{si},imr,~{dirflag},~{fpsr},~{flags}"(i64 0, i32 -1, i8* %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
ret i8* %9
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ go(int /*<<< orphan*/);
void handler(int a) { go(0); }


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

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

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

LLVM IR (-O2):
define void @handler(i32 %0) {
%2 = tail call i32 @go(i32 0)
ret void
}
int convertMilesToKMS(double miles, double *kms) {
  *kms = 0;
  if (miles > 0) {
    *kms = (miles * 1.60934);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<convertMilesToKMS>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114b <convertMilesToKMS+0x4b>
movsd  0xece(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    1152 <convertMilesToKMS+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertMilesToKMS>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %cl
jbe    111b <convertMilesToKMS+0x1b>
mulsd  0xee9(%rip),%xmm0
movapd %xmm0,%xmm1
mov    %cl,%al
movsd  %xmm1,(%rdi)
ret

LLVM IR (-O0):
define i32 @convertMilesToKMS(double %0, double* %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double*
store double %0, double* %4
store double* %1, double** %5
%6 = load double*, double** %5
store double 0.000000e+00, double* %6
%7 = load double, double* %4
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load double, double* %4
%11 = fmul double %10, 1.609340e+00
%12 = load double*, double** %5
store double %11, double* %12
store i32 1, i32* %3
br label %14
13: ; preds = %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %9
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @convertMilesToKMS(double %0, double* nocapture writeonly %1) {
%3 = fcmp ogt double %0, 0.000000e+00
%4 = fmul double %0, 1.609340e+00
%5 = select i1 %3, double %4, double 0.000000e+00
%6 = zext i1 %3 to i32
store double %5, double* %1
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ newline();
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("First Line.\n");
  newline();
  printf("Second Line.\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"First Line.\0A\00"
@.str.1 = [14 x i8] c"Second Line.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @newline()
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"First Line.\00"
@str.2 = [13 x i8] c"Second Line.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @newline()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int unlink(char *);
int sr_fileunlink(char *path) { return unlink(path); }


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

x86 assembly (clang, -O2):
<sr_fileunlink>:
jmp    1030 <unlink@plt>

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

LLVM IR (-O2):
define i32 @sr_fileunlink(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ system(char const *);
void exec_via_cmd(const char *command, int command_size) {
  0;
  0;
  system(command);
}


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

x86 assembly (clang, -O2):
<exec_via_cmd>:
jmp    1030 <system@plt>

LLVM IR (-O0):
define void @exec_via_cmd(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 = call i32 @system(i8* %5)
ret void
}

LLVM IR (-O2):
define void @exec_via_cmd(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @system(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ load_border_images();
void roadmap_border_load_images() { load_border_images(); }


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

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

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

LLVM IR (-O2):
define void @roadmap_border_load_images() {
%1 = tail call i32 (...) @load_border_images()
ret void
}
/* Variables and functions */
int fabs(double);
int imax(int, int /*<<< orphan*/);
int imin(int, int);
double zscore2pvalue(double z, double *z2p) {
  int i = (int)(fabs(z) * 100) - 1;
  i = imax(i, 0);
  i = imin(i, 1999);
  return z2p[i * 2 + 1];
}


x86 assembly (clang, -O0):
<zscore2pvalue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <fabs@plt>
imul   $0x64,%eax,%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1040 <imax@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x7cf,%esi
call   1030 <imin@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zscore2pvalue>:
push   %rbx
mov    %rdi,%rbx
call   1050 <fabs@plt>
imul   $0x64,%eax,%edi
add    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <imax@plt>
mov    %eax,%edi
mov    $0x7cf,%esi
call   1030 <imin@plt>
add    %eax,%eax
add    $0x1,%eax
cltq
movsd  (%rbx,%rax,8),%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @zscore2pvalue(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca i32
store double %0, double* %3
store double* %1, double** %4
%6 = load double, double* %3
%7 = call i32 @fabs(double %6)
%8 = mul nsw i32 %7, 100
%9 = sub nsw i32 %8, 1
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = call i32 @imax(i32 %10, i32 0)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = call i32 @imin(i32 %12, i32 1999)
store i32 %13, i32* %5
%14 = load double*, double** %4
%15 = load i32, i32* %5
%16 = mul nsw i32 %15, 2
%17 = add nsw i32 %16, 1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %14, i64 %18
%20 = load double, double* %19
ret double %20
}

LLVM IR (-O2):
define double @zscore2pvalue(double %0, double* nocapture %1) {
%3 = tail call i32 @fabs(double %0)
%4 = mul nsw i32 %3, 100
%5 = add nsw i32 %4, -1
%6 = tail call i32 @imax(i32 %5, i32 0)
%7 = tail call i32 @imin(i32 %6, i32 1999)
%8 = shl nsw i32 %7, 1
%9 = or i32 %8, 1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds double, double* %1, i64 %10
%12 = load double, double* %11
ret double %12
}
void termbegin() {}


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

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

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

LLVM IR (-O2):
define void @termbegin() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ console_tx_char(unsigned char);
void print_spew_char(unsigned char byte) { console_tx_char(byte); }


x86 assembly (clang, -O0):
<print_spew_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <console_tx_char@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_spew_char>:
jmp    1030 <console_tx_char@plt>

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

LLVM IR (-O2):
define void @print_spew_char(i8 zeroext %0) {
%2 = tail call i32 @console_tx_char(i8 zeroext %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char const *);
void uninitvar_fopen(void) {
  const char *filename, *mode;
  FILE *fp;
  fp = fopen(filename, "rt");
  fclose(fp);
  fp = fopen("filename.txt", mode);
  fclose(fp);
}


x86 assembly (clang, -O0):
<uninitvar_fopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_fopen>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rdi
call   1030 <fclose@plt>
lea    0xec7(%rip),%rdi
call   1040 <fopen@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rt\00"
@.str.1 = [13 x i8] c"filename.txt\00"
define void @uninitvar_fopen() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32*
%4 = load i8*, i8** %1
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 @fclose(i32* %6)
%8 = load i8*, i8** %2
%9 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %8)
store i32* %9, i32** %3
%10 = load i32*, i32** %3
%11 = call i32 @fclose(i32* %10)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
@.str.1 = [13 x i8] c"filename.txt\00"
define void @uninitvar_fopen() {
%1 = tail call i32* @fopen(i8* undef, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @fclose(i32* %1)
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* undef)
%4 = tail call i32 @fclose(i32* %3)
ret void
}
/* Type definitions */
struct xmalloc_stat {
  int dummy;
};

/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ xmalloc_stat_inc(struct xmalloc_stat *);
void *xcalloc(size_t nmemb, size_t size, struct xmalloc_stat *st) {
  void *ptr = calloc(nmemb, size);
  if (ptr)
    xmalloc_stat_inc(st);
  return ptr;
}


x86 assembly (clang, -O0):
<xcalloc>:
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
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1159 <xcalloc+0x39>
mov    -0x18(%rbp),%rdi
call   1040 <xmalloc_stat_inc@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113c <xcalloc+0x1c>
mov    %r14,%rdi
call   1040 <xmalloc_stat_inc@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.xmalloc_stat = type { i32 }
define i8* @xcalloc(i64 %0, i64 %1, %struct.xmalloc_stat* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca %struct.xmalloc_stat*
%7 = alloca i8*
store i64 %0, i64* %4
store i64 %1, i64* %5
store %struct.xmalloc_stat* %2, %struct.xmalloc_stat** %6
%8 = load i64, i64* %4
%9 = load i64, i64* %5
%10 = call i8* @calloc(i64 %8, i64 %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load %struct.xmalloc_stat*, %struct.xmalloc_stat** %6
%15 = call i32 @xmalloc_stat_inc(%struct.xmalloc_stat* %14)
br label %16
16: ; preds = %13, %3
%17 = load i8*, i8** %7
ret i8* %17
}

LLVM IR (-O2):
%struct.xmalloc_stat = type { i32 }
define noalias i8* @xcalloc(i64 %0, i64 %1, %struct.xmalloc_stat* %2) {
%4 = tail call i8* @calloc(i64 %0, i64 %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @xmalloc_stat_inc(%struct.xmalloc_stat* %2)
br label %8
8: ; preds = %6, %3
ret i8* %4
}
/* Type definitions */
typedef int u_int;

/* Variables and functions */
u_int normalize_size(u_int val, u_int nb, int shift) {
  return (((val + nb - 1) & ~(nb - 1)) >> shift);
}


x86 assembly (clang, -O0):
<normalize_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0xc(%rbp),%ecx
sar    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize_size>:
mov    %edx,%ecx
lea    (%rdi,%rsi,1),%eax
add    $0xffffffff,%eax
neg    %esi
and    %esi,%eax
sar    %cl,%eax
ret

LLVM IR (-O0):
define i32 @normalize_size(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add nsw i32 %7, %8
%10 = sub nsw i32 %9, 1
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 1
%13 = xor i32 %12, -1
%14 = and i32 %10, %13
%15 = load i32, i32* %6
%16 = ashr i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @normalize_size(i32 %0, i32 %1, i32 %2) {
%4 = add i32 %0, -1
%5 = add i32 %4, %1
%6 = sub i32 0, %1
%7 = and i32 %5, %6
%8 = ashr i32 %7, %2
ret i32 %8
}
int sequence_four(int b) { return ((2 * b * b) % 5) + 11 * 4; }


x86 assembly (clang, -O0):
<sequence_four>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
imul   -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x2c,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sequence_four>:
imul   %edi,%edi
add    %edi,%edi
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x2c,%eax
ret

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

LLVM IR (-O2):
define i32 @sequence_four(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = mul nsw i32 %2, %0
%4 = srem i32 %3, 5
%5 = add nsw i32 %4, 44
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void str_deallocate(void *ptr) {
  free(ptr);
  return;
}


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

x86 assembly (clang, -O2):
<str_deallocate>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @str_deallocate(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ wait3(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/ *);
void sigCatcher(int n) { wait3(NULL, WNOHANG, NULL); }


x86 assembly (clang, -O0):
<sigCatcher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rdi
call   1030 <wait3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigCatcher>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
xor    %edx,%edx
jmp    1030 <wait3@plt>

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @sigCatcher(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @WNOHANG
%4 = call i32 @wait3(i32* null, i32 %3, i32* null)
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @sigCatcher(i32 %0) {
%2 = load i32, i32* @WNOHANG
%3 = tail call i32 @wait3(i32* null, i32 %2, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
void func_2d(int const *const *i) {
  printf("func_2d : %d >> ", **i);
  {
    int const *const *bkup = i;
    int x = 30;
    int const *y = &x;
    int const *const *z = &y;
    i = z;
    printf("%d\n", **i);
    i = bkup;
  }
}


x86 assembly (clang, -O0):
<func_2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x1e,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_2d>:
push   %rax
mov    (%rdi),%rax
mov    (%rax),%esi
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x1e,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"func_2d : %d >> \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @func_2d(i32** %0) {
%2 = alloca i32**
%3 = alloca i32**
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32**
store i32** %0, i32*** %2
%7 = load i32**, i32*** %2
%8 = load i32*, i32** %7
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32**, i32*** %2
store i32** %11, i32*** %3
store i32 30, i32* %4
store i32* %4, i32** %5
store i32** %5, i32*** %6
%12 = load i32**, i32*** %6
store i32** %12, i32*** %2
%13 = load i32**, i32*** %2
%14 = load i32*, i32** %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32**, i32*** %3
store i32** %17, i32*** %2
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"func_2d : %d >> \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @func_2d(i32** nocapture %0) {
%2 = load i32*, i32** %0
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 30)
ret void
}
void endElement(void *userData, const char *name) {
  int *depthPtr = (int *)userData;
  *depthPtr -= 1;
}


x86 assembly (clang, -O0):
<endElement>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<endElement>:
addl   $0xffffffff,(%rdi)
ret

LLVM IR (-O0):
define void @endElement(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %8
ret void
}

LLVM IR (-O2):
define void @endElement(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = add nsw i32 %4, -1
store i32 %5, i32* %3
ret void
}
/* Type definitions */
typedef size_t uint64_t;

/* Variables and functions */
int sbpGethostname64(char *, size_t *);
void sbphostn64n(int *ierr, char *name, uint64_t namelen) {
  uint64_t i, newLen = namelen;
  *ierr = sbpGethostname64(name, &newLen);
  for (i = newLen; i < namelen; ++i) {
    name[i] = ' ';
  }
}


x86 assembly (clang, -O0):
<sbphostn64n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <sbpGethostname64@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1174 <sbphostn64n+0x64>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1149 <sbphostn64n+0x39>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sbphostn64n>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1040 <sbpGethostname64@plt>
mov    %eax,(%r15)
mov    0x8(%rsp),%rax
cmp    %rbx,%rax
jae    1167 <sbphostn64n+0x47>
add    %rax,%r14
sub    %rax,%rbx
mov    %r14,%rdi
mov    $0x20,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @sbphostn64n(i32* nocapture writeonly %0, i8* %1, i64 %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
store i64 %2, i64* %4
%6 = call i32 @sbpGethostname64(i8* %1, i64* %4)
store i32 %6, i32* %0
%7 = load i64, i64* %4
%8 = icmp ult i64 %7, %2
br i1 %8, label %9, label %12
9: ; preds = %3
%10 = getelementptr i8, i8* %1, i64 %7
%11 = sub i64 %2, %7
br label %12
12: ; preds = %9, %3
ret void
}
/* Type definitions */
struct snd_kcontrol {
  int dummy;
};
struct snd_ctl_elem_info {
  int dummy;
};

/* Variables and functions */
int snd_ctl_enum_info(struct snd_ctl_elem_info *, int, int,
                      char const *const *);
int snd_ac97_ymf7x3_spdif_source_info(struct snd_kcontrol *kcontrol,
                                      struct snd_ctl_elem_info *uinfo) {
  static const char *const texts[2] = {"AC-Link", "A/D Converter"};
  return snd_ctl_enum_info(uinfo, 1, 2, texts);
}


x86 assembly (clang, -O0):
<snd_ac97_ymf7x3_spdif_source_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x2,%edx
lea    0x2cdb(%rip),%rcx
call   1030 <snd_ctl_enum_info@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snd_ac97_ymf7x3_spdif_source_info>:
mov    %rsi,%rdi
lea    0x2cf6(%rip),%rcx
mov    $0x1,%esi
mov    $0x2,%edx
jmp    1030 <snd_ctl_enum_info@plt>

LLVM IR (-O0):
%struct.snd_kcontrol = type { i32 }
%struct.snd_ctl_elem_info = type { i32 }
@snd_ac97_ymf7x3_spdif_source_info.texts = internal constant [2 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0)]
@.str = [8 x i8] c"AC-Link\00"
@.str.1 = [14 x i8] c"A/D Converter\00"
define i32 @snd_ac97_ymf7x3_spdif_source_info(%struct.snd_kcontrol* %0, %struct.snd_ctl_elem_info* %1) {
%3 = alloca %struct.snd_kcontrol*
%4 = alloca %struct.snd_ctl_elem_info*
store %struct.snd_kcontrol* %0, %struct.snd_kcontrol** %3
store %struct.snd_ctl_elem_info* %1, %struct.snd_ctl_elem_info** %4
%5 = load %struct.snd_ctl_elem_info*, %struct.snd_ctl_elem_info** %4
%6 = call i32 @snd_ctl_enum_info(%struct.snd_ctl_elem_info* %5, i32 1, i32 2, i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @snd_ac97_ymf7x3_spdif_source_info.texts, i64 0, i64 0))
ret i32 %6
}

LLVM IR (-O2):
%struct.snd_kcontrol = type { i32 }
%struct.snd_ctl_elem_info = type { i32 }
@snd_ac97_ymf7x3_spdif_source_info.texts = internal constant [2 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i32 0, i32 0)]
@.str = [8 x i8] c"AC-Link\00"
@.str.1 = [14 x i8] c"A/D Converter\00"
define i32 @snd_ac97_ymf7x3_spdif_source_info(%struct.snd_kcontrol* nocapture readnone %0, %struct.snd_ctl_elem_info* %1) {
%3 = tail call i32 @snd_ctl_enum_info(%struct.snd_ctl_elem_info* %1, i32 1, i32 2, i8** getelementptr inbounds ([2 x i8*], [2 x i8*]* @snd_ac97_ymf7x3_spdif_source_info.texts, i64 0, i64 0))
ret i32 %3
}
/* Type definitions */
typedef long off_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
off_t get_file_size(FILE *f) {
  long begin = ftell(f);
  fseek(f, 0, SEEK_END);
  long size = ftell(f) - begin;
  fseek(f, begin, SEEK_SET);
  return size;
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea4(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
sub    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2e69(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
call   1030 <ftell@plt>
mov    %rax,%r14
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %r15,%rdi
call   1030 <ftell@plt>
mov    %rax,%rbx
sub    %r14,%rbx
mov    0x2e80(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <fseek@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @get_file_size(i32* %0) {
%2 = alloca i32*
%3 = alloca i64
%4 = alloca i64
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i64 @ftell(i32* %5)
store i64 %6, i64* %3
%7 = load i32*, i32** %2
%8 = load i32, i32* @SEEK_END
%9 = call i32 @fseek(i32* %7, i64 0, i32 %8)
%10 = load i32*, i32** %2
%11 = call i64 @ftell(i32* %10)
%12 = load i64, i64* %3
%13 = sub nsw i64 %11, %12
store i64 %13, i64* %4
%14 = load i32*, i32** %2
%15 = load i64, i64* %3
%16 = load i32, i32* @SEEK_SET
%17 = call i32 @fseek(i32* %14, i64 %15, i32 %16)
%18 = load i64, i64* %4
ret i64 %18
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @get_file_size(i32* nocapture %0) {
%2 = tail call i64 @ftell(i32* %0)
%3 = load i32, i32* @SEEK_END
%4 = tail call i32 @fseek(i32* %0, i64 0, i32 %3)
%5 = tail call i64 @ftell(i32* %0)
%6 = sub nsw i64 %5, %2
%7 = load i32, i32* @SEEK_SET
%8 = tail call i32 @fseek(i32* %0, i64 %2, i32 %7)
ret i64 %6
}
void test6() {
  char ch = 'a';
  switch (ch) {
  case 1234:
    break;
  }
}


x86 assembly (clang, -O0):
<test6>:
push   %rbp
mov    %rsp,%rbp
movb   $0x61,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x4d2,%eax
jne    1121 <test6+0x21>
jmp    111c <test6+0x1c>
jmp    1121 <test6+0x21>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test6() {
%1 = alloca i8
store i8 97, i8* %1
%2 = load i8, i8* %1
%3 = sext i8 %2 to i32
switch i32 %3, label %5 [
i32 1234, label %4
]
4: ; preds = %0
br label %5
5: ; preds = %0, %4
ret void
}

LLVM IR (-O2):
define void @test6() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mmio_write(int, int);
void timer_init(void) {
  mmio_write(0x2000B408, 0x00F90000);
  mmio_write(0x2000B408, 0x00F90200);
}


x86 assembly (clang, -O0):
<timer_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2000b408,%edi
mov    $0xf90000,%esi
call   1030 <mmio_write@plt>
mov    $0x2000b408,%edi
mov    $0xf90200,%esi
call   1030 <mmio_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_init>:
push   %rax
mov    $0x2000b408,%edi
mov    $0xf90000,%esi
call   1030 <mmio_write@plt>
mov    $0x2000b408,%edi
mov    $0xf90200,%esi
pop    %rax
jmp    1030 <mmio_write@plt>

LLVM IR (-O0):
define void @timer_init() {
%1 = call i32 @mmio_write(i32 536917000, i32 16318464)
%2 = call i32 @mmio_write(i32 536917000, i32 16318976)
ret void
}

LLVM IR (-O2):
define void @timer_init() {
%1 = tail call i32 @mmio_write(i32 536917000, i32 16318464)
%2 = tail call i32 @mmio_write(i32 536917000, i32 16318976)
ret void
}
/* Type definitions */
struct sembuf {
  int sem_op;
  int /*<<< orphan*/ sem_flg;
  scalar_t__ sem_num;
};

/* Variables and functions */
int /*<<< orphan*/ SEM_UNDO;
int /*<<< orphan*/ semop(int, struct sembuf *, int);
void sem1VO(int id_sem) {
  struct sembuf op;
  op.sem_num = 0;
  op.sem_op = 1;
  op.sem_flg = SEM_UNDO;
  semop(id_sem, &op, 1);
}


x86 assembly (clang, -O0):
<sem1VO>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
mov    0x2ebf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1030 <semop@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem1VO>:
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
movl   $0x1,0x8(%rsp)
mov    0x2ec4(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
lea    0x8(%rsp),%rsi
mov    $0x1,%edx
call   1030 <semop@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.sembuf = type { i32, i32, i64 }
@SEM_UNDO = global i32 0
define void @sem1VO(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sembuf
store i32 %0, i32* %2
%4 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i32 0, i32 2
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i32 0, i32 0
store i32 1, i32* %5
%6 = load i32, i32* @SEM_UNDO
%7 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %3, i32 0, i32 1
store i32 %6, i32* %7
%8 = load i32, i32* %2
%9 = call i32 @semop(i32 %8, %struct.sembuf* %3, i32 1)
ret void
}

LLVM IR (-O2):
%struct.sembuf = type { i32, i32, i64 }
@SEM_UNDO = global i32 0
define void @sem1VO(i32 %0) {
%2 = alloca %struct.sembuf
%3 = bitcast %struct.sembuf* %2 to i8*
%4 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 2
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 0
store i32 1, i32* %5
%6 = load i32, i32* @SEM_UNDO
%7 = getelementptr inbounds %struct.sembuf, %struct.sembuf* %2, i64 0, i32 1
store i32 %6, i32* %7
%8 = call i32 @semop(i32 %0, %struct.sembuf* %2, i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int __infer_nondet_int();
int fflush(FILE *stream) { return __infer_nondet_int(); }


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

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

LLVM IR (-O0):
define i32 @fflush(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 (...) @__infer_nondet_int()
ret i32 %3
}

LLVM IR (-O2):
define i32 @fflush(i32* nocapture readnone %0) {
%2 = tail call i32 (...) @__infer_nondet_int()
ret i32 %2
}
void nop3(void *a1, void *a2, void *a3) { return; }


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

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

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

LLVM IR (-O2):
define void @nop3(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __chk_fail();
int getlogin_r(char *, size_t);
int __getlogin_r_chk(char *buf, size_t buflen, size_t nreal) {
  if (buflen > nreal)
    __chk_fail();
  return getlogin_r(buf, buflen);
}


x86 assembly (clang, -O0):
<__getlogin_r_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1149 <__getlogin_r_chk+0x29>
mov    $0x0,%al
call   1030 <__chk_fail@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <getlogin_r@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__getlogin_r_chk>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
cmp    %rdx,%rsi
jbe    1136 <__getlogin_r_chk+0x16>
xor    %eax,%eax
call   1030 <__chk_fail@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <getlogin_r@plt>

LLVM IR (-O0):
define i32 @__getlogin_r_chk(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %5
%8 = load i64, i64* %6
%9 = icmp ugt i64 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 (...) @__chk_fail()
br label %12
12: ; preds = %10, %3
%13 = load i8*, i8** %4
%14 = load i64, i64* %5
%15 = call i32 @getlogin_r(i8* %13, i64 %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @__getlogin_r_chk(i8* nocapture %0, i64 %1, i64 %2) {
%4 = icmp ugt i64 %1, %2
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 (...) @__chk_fail()
br label %7
7: ; preds = %5, %3
%8 = tail call i32 @getlogin_r(i8* %0, i64 %1)
ret i32 %8
}
char *hash_plugin_detailed(void) {
  return ("lm - LM plugin\n"
          "------------------------\n"
          "Use this module to crack simple LM hashes\n"
          "Input should be in form: \'user:hash\', \'hash\' or pwdump format\n"
          "Known software that uses this password hashing method:\n"
          "Older Microsoft Windows versions\n"
          "\nAuthor: Milen Rangelov <gat3way@gat3way.eu>\n");
}


x86 assembly (clang, -O0):
<hash_plugin_detailed>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_plugin_detailed>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [278 x i8] c"lm - LM plugin\0A------------------------\0AUse this module to crack simple LM hashes\0AInput should be in form: 'user:hash', 'hash' or pwdump format\0AKnown software that uses this password hashing method:\0AOlder Microsoft Windows versions\0A\0AAuthor: Milen Rangelov <gat3way@gat3way.eu>\0A\00"
define i8* @hash_plugin_detailed() {
ret i8* getelementptr inbounds ([278 x i8], [278 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [278 x i8] c"lm - LM plugin\0A------------------------\0AUse this module to crack simple LM hashes\0AInput should be in form: 'user:hash', 'hash' or pwdump format\0AKnown software that uses this password hashing method:\0AOlder Microsoft Windows versions\0A\0AAuthor: Milen Rangelov <gat3way@gat3way.eu>\0A\00"
define i8* @hash_plugin_detailed() {
ret i8* getelementptr inbounds ([278 x i8], [278 x i8]* @.str, i64 0, i64 0)
}
void wpas_dbus_signal_wps_event_success(struct wpa_supplicant *wpa_s) {}


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

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

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

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
define void @wpas_dbus_signal_wps_event_success(%struct.wpa_supplicant* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ i3(int, int, int);
void t(int *x) { i3(x[1], x[2], x[3]); }


x86 assembly (clang, -O0):
<t>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%esi
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edx
call   1030 <i3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t>:
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%esi
mov    0xc(%rdi),%edx
mov    %eax,%edi
jmp    1030 <i3@plt>

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

LLVM IR (-O2):
define void @t(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = getelementptr inbounds i32, i32* %0, i64 2
%5 = load i32, i32* %4
%6 = getelementptr inbounds i32, i32* %0, i64 3
%7 = load i32, i32* %6
%8 = tail call i32 @i3(i32 %3, i32 %5, i32 %7)
ret void
}
double _ProblemFunction(double x) { return x * x; }


x86 assembly (clang, -O0):
<_ProblemFunction>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ProblemFunction>:
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @_ProblemFunction(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @_ProblemFunction(double %0) {
%2 = fmul double %0, %0
ret double %2
}
int __attribute__((__always___)) foo(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @foo() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ adc8(int /*<<< orphan*/);
int /*<<< orphan*/ indirectyE();
int /*<<< orphan*/ readmem65816(int /*<<< orphan*/);
void adcIndirectyE(void) { adc8(readmem65816(indirectyE())); }


x86 assembly (clang, -O0):
<adcIndirectyE>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <indirectyE@plt>
mov    %eax,%edi
call   1050 <readmem65816@plt>
mov    %eax,%edi
call   1030 <adc8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<adcIndirectyE>:
push   %rax
xor    %eax,%eax
call   1040 <indirectyE@plt>
mov    %eax,%edi
call   1050 <readmem65816@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <adc8@plt>

LLVM IR (-O0):
define void @adcIndirectyE() {
%1 = call i32 (...) @indirectyE()
%2 = call i32 @readmem65816(i32 %1)
%3 = call i32 @adc8(i32 %2)
ret void
}

LLVM IR (-O2):
define void @adcIndirectyE() {
%1 = tail call i32 (...) @indirectyE()
%2 = tail call i32 @readmem65816(i32 %1)
%3 = tail call i32 @adc8(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_putc(unsigned char);
void uart_putbin(unsigned int d) {
  signed int i;
  unsigned char b;
  for (i = 31; i >= 0; i--) {
    b = ((d >> i) & 1) + 48;
    uart_putc(b);
  }
}


x86 assembly (clang, -O0):
<uart_putbin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1f,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1154 <uart_putbin+0x44>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
and    $0x1,%eax
add    $0x30,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%edi
call   1030 <uart_putc@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <uart_putbin+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_putbin>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x1f,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebx,%eax
mov    %ebp,%ecx
shr    %cl,%eax
and    $0x1,%al
or     $0x30,%al
movzbl %al,%edi
call   1030 <uart_putc@plt>
add    $0xffffffff,%ebp
jb     1120 <uart_putbin+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @uart_putbin(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %2
store i32 31, i32* %3
br label %5
5: ; preds = %17, %1
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = lshr i32 %9, %10
%12 = and i32 %11, 1
%13 = add i32 %12, 48
%14 = trunc i32 %13 to i8
store i8 %14, i8* %4
%15 = load i8, i8* %4
%16 = call i32 @uart_putc(i8 zeroext %15)
br label %17
17: ; preds = %8
%18 = load i32, i32* %3
%19 = add nsw i32 %18, -1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @uart_putbin(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 31, %1 ], [ %9, %2 ]
%4 = lshr i32 %0, %3
%5 = trunc i32 %4 to i8
%6 = and i8 %5, 1
%7 = or i8 %6, 48
%8 = tail call i32 @uart_putc(i8 zeroext %7)
%9 = add nsw i32 %3, -1
%10 = icmp eq i32 %3, 0
br i1 %10, label %11, label %2
11: ; preds = %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t
hsp_subevent_audio_connection_complete_get_status(const uint8_t *event) {
  return event[3];
}


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

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

LLVM IR (-O0):
define i32 @hsp_subevent_audio_connection_complete_get_status(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @hsp_subevent_audio_connection_complete_get_status(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
ret i32 %3
}
int test_imm_2Cuint16_mem(unsigned short *val) {
  return ((*val) & (0x2C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_2Cuint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0x2c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_2Cuint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 44
%7 = icmp ne i32 %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_2Cuint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 44
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int __xstat(int /*<<< orphan*/, char const *, struct stat *);
int stat(const char *path, struct stat *buf) { return __xstat(0, path, buf); }


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

x86 assembly (clang, -O2):
<stat>:
mov    %rsi,%rdx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <__xstat@plt>

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @stat(i8* %0, %struct.stat* %1) {
%3 = tail call i32 @__xstat(i32 0, i8* %0, %struct.stat* %1)
ret i32 %3
}