xunge/DecIR huggingface dataset:
int box_num_gene(int box_num[3], unsigned char random[3], int pwd_len) {
  do {
  } while (0);
  box_num[1] = (int)random[1] % (pwd_len - 2) + 1;
  box_num[2] = (int)random[2] % 2 + 1;
  box_num[0] = (int)(pwd_len - box_num[1] - box_num[2]);
  return 0;
}


x86 assembly (clang, -O0):
<box_num_gene>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
jmp    1114 <box_num_gene+0x14>
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    -0x8(%rbp),%rax
mov    %edx,0x4(%rax)
mov    -0x10(%rbp),%rax
movzbl 0x2(%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    -0x8(%rbp),%rax
mov    %edx,0x8(%rax)
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
sub    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
sub    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<box_num_gene>:
mov    %edx,%r8d
movzbl 0x1(%rsi),%eax
lea    -0x2(%r8),%ecx
xor    %edx,%edx
idiv   %ecx
lea    0x1(%rdx),%eax
mov    %eax,0x4(%rdi)
movzbl 0x2(%rsi),%eax
and    $0x1,%eax
add    $0x1,%eax
mov    %eax,0x8(%rdi)
not    %edx
add    %r8d,%edx
sub    %eax,%edx
mov    %edx,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @box_num_gene(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = getelementptr inbounds i8, i8* %1, i64 1
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = add nsw i32 %2, -2
%8 = srem i32 %6, %7
%9 = add nuw nsw i32 %8, 1
%10 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %9, i32* %10
%11 = getelementptr inbounds i8, i8* %1, i64 2
%12 = load i8, i8* %11
%13 = and i8 %12, 1
%14 = add nuw nsw i8 %13, 1
%15 = zext i8 %14 to i32
%16 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %15, i32* %16
%17 = xor i32 %8, -1
%18 = add i32 %17, %2
%19 = sub i32 %18, %15
store i32 %19, i32* %0
ret i32 0
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
double ranf() {
  double x = (double)rand() / (double)RAND_MAX;
  return x;
}


x86 assembly (clang, -O0):
<ranf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ebd(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ranf>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @ranf() {
%1 = alloca double
%2 = call i64 (...) @rand()
%3 = sitofp i64 %2 to double
%4 = load i64, i64* @RAND_MAX
%5 = sitofp i64 %4 to double
%6 = fdiv double %3, %5
store double %6, double* %1
%7 = load double, double* %1
ret double %7
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @ranf() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
int fun2(int n) { return n + 1; }


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

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

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

LLVM IR (-O2):
define i32 @fun2(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
__attribute__((no)) double direct(int x, ...) { return x * x; }


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

x86 assembly (clang, -O2):
<direct>:
imul   %edi,%edi
cvtsi2sd %edi,%xmm0
ret

LLVM IR (-O0):
define double @direct(i32 %0, ...) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %3, %4
%6 = sitofp i32 %5 to double
ret double %6
}

LLVM IR (-O2):
define double @direct(i32 %0, ...) {
%2 = mul nsw i32 %0, %0
%3 = sitofp i32 %2 to double
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int pthread_attr_setschedpolicy(pthread_attr_t *__attr, int __policy) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @pthread_attr_setschedpolicy(i32* nocapture readnone %0, i32 %1) {
ret i32 0
}
long extract_mb6(unsigned long insn, int *invalid) {
  return ((insn >> 6) & 0x1f) | (insn & 0x20);
}


x86 assembly (clang, -O0):
<extract_mb6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x6,%rax
and    $0x1f,%rax
mov    -0x8(%rbp),%rcx
and    $0x20,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_mb6>:
mov    %edi,%eax
shr    $0x6,%eax
and    $0x1f,%eax
and    $0x20,%edi
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @extract_mb6(i64 %0, i32* %1) {
%3 = alloca i64
%4 = alloca i32*
store i64 %0, i64* %3
store i32* %1, i32** %4
%5 = load i64, i64* %3
%6 = lshr i64 %5, 6
%7 = and i64 %6, 31
%8 = load i64, i64* %3
%9 = and i64 %8, 32
%10 = or i64 %7, %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @extract_mb6(i64 %0, i32* nocapture readnone %1) {
%3 = lshr i64 %0, 6
%4 = and i64 %3, 31
%5 = and i64 %0, 32
%6 = or i64 %4, %5
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ initVarSL(char *);
void *malloc(scalar_t__);
int /*<<< orphan*/ stopErr(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
void initVar(char *Lib) {
  void *L;
  if ((L = malloc(strlen(Lib) + 1)) == NULL)
    stopErr("initVar", "malloc");
  strcpy((char *)L, Lib);
  initVarSL((char *)L);
}


x86 assembly (clang, -O0):
<initVar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1192 <initVar+0x42>
lea    0xe7a(%rip),%rdi
lea    0xe7b(%rip),%rsi
call   1040 <stopErr@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1060 <initVarSL@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initVar>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1070 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1180 <initVar+0x30>
lea    0xe8c(%rip),%rdi
lea    0xe8d(%rip),%rsi
call   1040 <stopErr@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <initVarSL@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"initVar\00"
@.str.1 = [7 x i8] c"malloc\00"
define void @initVar(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @stopErr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = call i32 @strcpy(i8* %12, i8* %13)
%15 = load i8*, i8** %3
%16 = call i32 @initVarSL(i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"initVar\00"
@.str.1 = [7 x i8] c"malloc\00"
define void @initVar(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @stopErr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = tail call i32 @strcpy(i8* %4, i8* %0)
%10 = tail call i32 @initVarSL(i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ unsigned_prune_ge2_Good(int /*<<< orphan*/, int);
void call_unsigned_prune_ge2_Good() { unsigned_prune_ge2_Good(0, 1); }


x86 assembly (clang, -O0):
<call_unsigned_prune_ge2_Good>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <unsigned_prune_ge2_Good@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_unsigned_prune_ge2_Good>:
xor    %edi,%edi
mov    $0x1,%esi
jmp    1030 <unsigned_prune_ge2_Good@plt>

LLVM IR (-O0):
define void @call_unsigned_prune_ge2_Good() {
%1 = call i32 @unsigned_prune_ge2_Good(i32 0, i32 1)
ret void
}

LLVM IR (-O2):
define void @call_unsigned_prune_ge2_Good() {
%1 = tail call i32 @unsigned_prune_ge2_Good(i32 0, i32 1)
ret void
}
/* Variables and functions */
double __dasind(double);
double intr_wrap_012(double p1) { return __dasind(p1); }


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

x86 assembly (clang, -O2):
<intr_wrap_012>:
jmp    1030 <__dasind@plt>

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

LLVM IR (-O2):
define double @intr_wrap_012(double %0) {
%2 = tail call double @__dasind(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ triexit(int);
void internalerror(void) {
  printf(" Please report this bug to jrs@cs.berkeley.edu\n");
  printf(" Include the message above, your input data set, and the exact\n");
  printf(" command line you used to run Triangle.\n");
  triexit(1);
}


x86 assembly (clang, -O0):
<internalerror>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xef9(%rip),%rdi
call   1040 <printf@plt>
lea    0xf2d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1030 <triexit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<internalerror>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2e(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <triexit@plt>

LLVM IR (-O0):
@.str = [48 x i8] c" Please report this bug to jrs@cs.berkeley.edu\0A\00"
@.str.1 = [64 x i8] c" Include the message above, your input data set, and the exact\0A\00"
@.str.2 = [41 x i8] c" command line you used to run Triangle.\0A\00"
define void @internalerror() {
%1 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @triexit(i32 1)
ret void
}

LLVM IR (-O2):
@str = [47 x i8] c" Please report this bug to jrs@cs.berkeley.edu\00"
@str.3 = [63 x i8] c" Include the message above, your input data set, and the exact\00"
@str.4 = [40 x i8] c" command line you used to run Triangle.\00"
define void @internalerror() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @triexit(i32 1)
ret void
}
/* Variables and functions */
int EXIT_FAILURE;
int /*<<< orphan*/ printf(char *, char *);
int usage(char *name) {
  printf("\nUsage: %s -i <Image of encrypted memory unit> -o <output files "
         "path>\n\n"
         "Options:\n\n"
         "  -h"
         "\t\tShow this help\n"
         "  -i"
         "\t\tImage path of encrypted memory unit encrypted with BitLocker\n"
         "  -o"
         "\t\tOutputs path (i.e. /some/path/for/outputs/). Default: current "
         "directory\n\n",
         name);
  return EXIT_FAILURE;
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eb9(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [249 x i8] c"\0AUsage: %s -i <Image of encrypted memory unit> -o <output files path>\0A\0AOptions:\0A\0A -h\09\09Show this help\0A -i\09\09Image path of encrypted memory unit encrypted with BitLocker\0A -o\09\09Outputs path (i.e. /some/path/for/outputs/). Default: current directory\0A\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([249 x i8], [249 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
ret i32 %5
}

LLVM IR (-O2):
@.str = [249 x i8] c"\0AUsage: %s -i <Image of encrypted memory unit> -o <output files path>\0A\0AOptions:\0A\0A -h\09\09Show this help\0A -i\09\09Image path of encrypted memory unit encrypted with BitLocker\0A -o\09\09Outputs path (i.e. /some/path/for/outputs/). Default: current directory\0A\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([249 x i8], [249 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
ret i32 %3
}
/* Variables and functions */
int SIGALRM;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void timer_handler(int signo) {
  if (signo == SIGALRM) {
    printf("the time is now\n");
    exit(0);
  } else
    printf("unexpected signal\n");
}


x86 assembly (clang, -O0):
<timer_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
jne    1150 <timer_handler+0x30>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_handler>:
push   %rax
mov    0x2ec0(%rip),%rax
cmp    %edi,(%rax)
je     1139 <timer_handler+0x19>
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@SIGALRM = global i32 0
@.str = [17 x i8] c"the time is now\0A\00"
@.str.1 = [19 x i8] c"unexpected signal\0A\00"
define void @timer_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGALRM
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 0)
unreachable
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9
ret void
}

LLVM IR (-O2):
@SIGALRM = global i32 0
@str = [18 x i8] c"unexpected signal\00"
@str.2 = [16 x i8] c"the time is now\00"
define void @timer_handler(i32 %0) {
%2 = load i32, i32* @SIGALRM
%3 = icmp eq i32 %2, %0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.2, i64 0, i64 0))
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %1
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret void
}
int blah(void) { return 2; }


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

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

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

LLVM IR (-O2):
define i32 @blah() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M146_f(char *s) {
  debug("M146_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M146_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M146_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M146_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M146_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M146_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M146_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
unsigned char swap_nibs(unsigned char n) {
  n = ((n & 0xF0) >> 4) | ((n & 0x0F) << 4);
  return n;
}


x86 assembly (clang, -O0):
<swap_nibs>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
movzbl -0x1(%rbp),%ecx
and    $0xf,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_nibs>:
mov    %edi,%eax
rol    $0x4,%al
ret

LLVM IR (-O0):
define zeroext i8 @swap_nibs(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 240
%6 = ashr i32 %5, 4
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = and i32 %8, 15
%10 = shl i32 %9, 4
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i8
store i8 %12, i8* %2
%13 = load i8, i8* %2
ret i8 %13
}

LLVM IR (-O2):
define zeroext i8 @swap_nibs(i8 zeroext %0) {
%2 = tail call i8 @llvm.fshl.i8(i8 %0, i8 %0, i8 4)
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ InlineWords(int, int, int, int);
void DoParseWord(void) { InlineWords(3, 17, 80, 81); }


x86 assembly (clang, -O0):
<DoParseWord>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
mov    $0x11,%esi
mov    $0x50,%edx
mov    $0x51,%ecx
call   1030 <InlineWords@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoParseWord>:
mov    $0x3,%edi
mov    $0x11,%esi
mov    $0x50,%edx
mov    $0x51,%ecx
jmp    1030 <InlineWords@plt>

LLVM IR (-O0):
define void @DoParseWord() {
%1 = call i32 @InlineWords(i32 3, i32 17, i32 80, i32 81)
ret void
}

LLVM IR (-O2):
define void @DoParseWord() {
%1 = tail call i32 @InlineWords(i32 3, i32 17, i32 80, i32 81)
ret void
}
/* Variables and functions */
double sqrt(double);
double SFMHypot2(double dx, double dy) {
  return (
      ((((dx * dx) + (dy * dy)) > 0.0f) ? sqrt((dx * dx) + (dy * dy)) : 0.0f));
}


x86 assembly (clang, -O0):
<SFMHypot2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1176 <SFMHypot2+0x66>
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
jmp    1183 <SFMHypot2+0x73>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1183 <SFMHypot2+0x73>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SFMHypot2>:
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1137 <SFMHypot2+0x27>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     113c <SFMHypot2+0x2c>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
movapd %xmm1,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @SFMHypot2(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = load double, double* %4
%8 = load double, double* %4
%9 = fmul double %7, %8
%10 = call double @llvm.fmuladd.f64(double %5, double %6, double %9)
%11 = fcmp ogt double %10, 0.000000e+00
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load double, double* %3
%14 = load double, double* %3
%15 = load double, double* %4
%16 = load double, double* %4
%17 = fmul double %15, %16
%18 = call double @llvm.fmuladd.f64(double %13, double %14, double %17)
%19 = call double @sqrt(double %18)
br label %21
20: ; preds = %2
br label %21
21: ; preds = %20, %12
%22 = phi double [ %19, %12 ], [ 0.000000e+00, %20 ]
ret double %22
}

LLVM IR (-O2):
define double @SFMHypot2(double %0, double %1) {
%3 = fmul double %1, %1
%4 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %3)
%5 = fcmp ogt double %4, 0.000000e+00
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call double @sqrt(double %4)
br label %8
8: ; preds = %2, %6
%9 = phi double [ %7, %6 ], [ 0.000000e+00, %2 ]
ret double %9
}
int numhash(n)
long n;
{ return n; }


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

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

LLVM IR (-O0):
define i32 @numhash(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @numhash(i64 %0) {
%2 = trunc i64 %0 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ eraUtcut1(double, double, double, double *, double *);
void jdutc2jdut1(double jd_utc[2], double dut1, double jd_ut1[2]) {
  eraUtcut1(jd_utc[0], jd_utc[1], dut1, &jd_ut1[0], &jd_ut1[1]);
}


x86 assembly (clang, -O0):
<jdutc2jdut1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  -0x10(%rbp),%xmm2
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x8,%rsi
call   1030 <eraUtcut1@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jdutc2jdut1>:
mov    %rsi,%rax
movaps %xmm0,%xmm2
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
add    $0x8,%rsi
mov    %rax,%rdi
jmp    1030 <eraUtcut1@plt>

LLVM IR (-O0):
define void @jdutc2jdut1(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** %4
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = load double*, double** %4
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double, double* %5
%14 = load double*, double** %6
%15 = getelementptr inbounds double, double* %14, i64 0
%16 = load double*, double** %6
%17 = getelementptr inbounds double, double* %16, i64 1
%18 = call i32 @eraUtcut1(double %9, double %12, double %13, double* %15, double* %17)
ret void
}

LLVM IR (-O2):
define void @jdutc2jdut1(double* nocapture %0, double %1, double* %2) {
%4 = load double, double* %0
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %2, i64 1
%8 = tail call i32 @eraUtcut1(double %4, double %6, double %1, double* %2, double* %7)
ret void
}
/* Variables and functions */
int receiveByte(int);
int /*<<< orphan*/ sendByte(int, int);
int /*<<< orphan*/ updateCarry(int, unsigned int *);
void tube_ReadC(unsigned int *reg) {
  sendByte(2, 0x00);
  updateCarry(receiveByte(2) & 0x80, reg);
  reg[0] = receiveByte(2);
}


x86 assembly (clang, -O0):
<tube_ReadC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <sendByte@plt>
mov    $0x2,%edi
call   1030 <receiveByte@plt>
mov    %eax,%edi
and    $0x80,%edi
mov    -0x8(%rbp),%rsi
call   1040 <updateCarry@plt>
mov    $0x2,%edi
call   1030 <receiveByte@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tube_ReadC>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2,%edi
xor    %esi,%esi
call   1050 <sendByte@plt>
mov    $0x2,%edi
call   1030 <receiveByte@plt>
and    $0x80,%eax
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <updateCarry@plt>
mov    $0x2,%edi
call   1030 <receiveByte@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @tube_ReadC(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @sendByte(i32 2, i32 0)
%4 = call i32 @receiveByte(i32 2)
%5 = and i32 %4, 128
%6 = load i32*, i32** %2
%7 = call i32 @updateCarry(i32 %5, i32* %6)
%8 = call i32 @receiveByte(i32 2)
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 0
store i32 %8, i32* %10
ret void
}

LLVM IR (-O2):
define void @tube_ReadC(i32* %0) {
%2 = tail call i32 @sendByte(i32 2, i32 0)
%3 = tail call i32 @receiveByte(i32 2)
%4 = and i32 %3, 128
%5 = tail call i32 @updateCarry(i32 %4, i32* %0)
%6 = tail call i32 @receiveByte(i32 2)
store i32 %6, i32* %0
ret void
}
void INT_Excep_SCI6_TEI6(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_SCI6_TEI6() {
ret void
}
void test___atomic_fetch_sub_2(int *mem) { __atomic_fetch_sub(mem, 1, 4); }


x86 assembly (clang, -O0):
<test___atomic_fetch_sub_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
neg    %eax
lock xadd %eax,(%rcx)
mov    %eax,-0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test___atomic_fetch_sub_2>:
lock subl $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @test___atomic_fetch_sub_2(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
store i32 1, i32* %3
%6 = load i32, i32* %3
%7 = atomicrmw sub i32* %5, i32 %6 acq_rel
store i32 %7, i32* %4
%8 = load i32, i32* %4
ret void
}

LLVM IR (-O2):
define void @test___atomic_fetch_sub_2(i32* nocapture %0) {
%2 = atomicrmw sub i32* %0, i32 1 acq_rel
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;
typedef int /*<<< orphan*/ cs;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_attr_init(int /*<<< orphan*/ *);
int pthread_attr_setaffinity_np(int /*<<< orphan*/ *, int,
                                int /*<<< orphan*/ *);
int main(void) {
  int ret = 0;
  pthread_attr_t thread_attr;
  cpu_set_t cs;
  pthread_attr_init(&thread_attr);
  ret = pthread_attr_setaffinity_np(&thread_attr, sizeof(cs), &cs);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1040 <pthread_attr_init@plt>
lea    -0xc(%rbp),%rdi
mov    $0x4,%esi
lea    -0x10(%rbp),%rdx
call   1030 <pthread_attr_setaffinity_np@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <pthread_attr_init@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <pthread_attr_setaffinity_np@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i32 @pthread_attr_init(i32* %3)
%6 = call i32 @pthread_attr_setaffinity_np(i32* %3, i32 4, i32* %4)
store i32 %6, i32* %2
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @pthread_attr_init(i32* %1)
%6 = call i32 @pthread_attr_setaffinity_np(i32* %1, i32 4, i32* %2)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void debug(const char *s) { fprintf(stderr, "%s", s); }


x86 assembly (clang, -O0):
<debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @debug(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @debug(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ skipText(int /*<<< orphan*/ *, char *, char *, int);
void skipBlank(FILE *f, char *buffer, int size) {
  skipText(f, " \t\r\n", buffer, size);
}


x86 assembly (clang, -O0):
<skipBlank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xecb(%rip),%rsi
call   1030 <skipText@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipBlank>:
mov    %edx,%ecx
mov    %rsi,%rdx
lea    0xee4(%rip),%rsi
jmp    1030 <skipText@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" \09\0D\0A\00"
define void @skipBlank(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @skipText(i32* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c" \09\0D\0A\00"
define void @skipBlank(i32* %0, i8* %1, i32 %2) {
%4 = tail call i32 @skipText(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close_files();
int /*<<< orphan*/ exit(int);
void clean_exit(int exit_code) {
  close_files();
  exit(exit_code);
}


x86 assembly (clang, -O0):
<clean_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <close_files@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<clean_exit>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <close_files@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
define void @clean_exit(i32 %0) {
%2 = tail call i32 (...) @close_files()
%3 = tail call i32 @exit(i32 %0)
unreachable
}
void TimerIRQ_Interrupt(void) {}


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

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

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

LLVM IR (-O2):
define void @TimerIRQ_Interrupt() {
ret void
}
/* Variables and functions */
char toupper(char);
char *strupcase(char *str) {
  int i;
  i = 0;
  while (str[i]) {
    str[i] = toupper(str[i]);
    ++i;
  }
  return (str);
}


x86 assembly (clang, -O0):
<strupcase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1161 <strupcase+0x51>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@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    1123 <strupcase+0x13>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strupcase>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1146 <strupcase+0x36>
lea    0x1(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strupcase+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strupcase(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %11, %4 ], [ %2, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = tail call signext i8 @toupper(i8 signext %6)
store i8 %8, i8* %7
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret i8* %0
}
void loop(long ns, double ns_iter) {
  long i, j;
  long n = (int)(ns / ns_iter);
  for (i = 0; i < n; i++) {
    ++j;
  }
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
cltq
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    1155 <loop+0x55>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112a <loop+0x2a>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @loop(i64 %0, double %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
void cvtTime2Str(char *string, int maxlen, time_t *timeptr) {
  struct tm *tmtime = localtime(timeptr);
  strftime(string, maxlen, "%Y-%m-%d %H:%M", tmtime);
}


x86 assembly (clang, -O0):
<cvtTime2Str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rcx
lea    0xeae(%rip),%rdx
call   1040 <strftime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cvtTime2Str>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rdx,%rdi
call   1030 <localtime@plt>
lea    0xec9(%rip),%rdx
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <strftime@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [15 x i8] c"%Y-%m-%d %H:%M\00"
define void @cvtTime2Str(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca %struct.tm*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i32*, i32** %6
%9 = call %struct.tm* @localtime(i32* %8)
store %struct.tm* %9, %struct.tm** %7
%10 = load i8*, i8** %4
%11 = load i32, i32* %5
%12 = load %struct.tm*, %struct.tm** %7
%13 = call i32 @strftime(i8* %10, i32 %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.tm* %12)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [15 x i8] c"%Y-%m-%d %H:%M\00"
define void @cvtTime2Str(i8* %0, i32 %1, i32* %2) {
%4 = tail call %struct.tm* @localtime(i32* %2)
%5 = tail call i32 @strftime(i8* %0, i32 %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.tm* %4)
ret void
}
int Operand_xt_wbr18_label_rtoa(unsigned int *valp, unsigned int pc) {
  *valp += pc;
  return 0;
}


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

x86 assembly (clang, -O2):
<Operand_xt_wbr18_label_rtoa>:
add    %esi,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @Operand_xt_wbr18_label_rtoa(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = add i32 %3, %1
store i32 %4, i32* %0
ret i32 0
}
/* Type definitions */
struct pkg_option {
  int dummy;
};

/* Variables and functions */
int getopt_internal(int, char *const *, char const *, struct pkg_option const *,
                    int *, int);
int pkg_getopt_long_only(int nargc, char *const *nargv, const char *options,
                         const struct pkg_option *long_options, int *idx) {
  return (
      getopt_internal(nargc, nargv, options, long_options, idx, 0x01 | 0x04));
}


x86 assembly (clang, -O0):
<pkg_getopt_long_only>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    $0x5,%r9d
call   1030 <getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pkg_getopt_long_only>:
mov    $0x5,%r9d
jmp    1030 <getopt_internal@plt>

LLVM IR (-O0):
%struct.pkg_option = type { i32 }
define i32 @pkg_getopt_long_only(i32 %0, i8** %1, i8* %2, %struct.pkg_option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.pkg_option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.pkg_option* %3, %struct.pkg_option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.pkg_option*, %struct.pkg_option** %9
%15 = load i32*, i32** %10
%16 = call i32 @getopt_internal(i32 %11, i8** %12, i8* %13, %struct.pkg_option* %14, i32* %15, i32 5)
ret i32 %16
}

LLVM IR (-O2):
%struct.pkg_option = type { i32 }
define i32 @pkg_getopt_long_only(i32 %0, i8** %1, i8* %2, %struct.pkg_option* %3, i32* %4) {
%6 = tail call i32 @getopt_internal(i32 %0, i8** %1, i8* %2, %struct.pkg_option* %3, i32* %4, i32 5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ glColor3sv(short *);
void Color3sv(short v[3]) { glColor3sv(v); }


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

x86 assembly (clang, -O2):
<Color3sv>:
jmp    1030 <glColor3sv@plt>

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

LLVM IR (-O2):
define void @Color3sv(i16* %0) {
%2 = tail call i32 @glColor3sv(i16* %0)
ret void
}
void set_flag(unsigned char *flag, unsigned char pos) {
  *flag |= (unsigned char)(1 << pos);
}


x86 assembly (clang, -O0):
<set_flag>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
movzbl %al,%edx
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
or     %edx,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_flag>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     %al,(%rdi)
ret

LLVM IR (-O0):
define void @set_flag(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 1, %6
%8 = trunc i32 %7 to i8
%9 = zext i8 %8 to i32
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = or i32 %12, %9
%14 = trunc i32 %13 to i8
store i8 %14, i8* %10
ret void
}

LLVM IR (-O2):
define void @set_flag(i8* nocapture %0, i8 zeroext %1) {
%3 = zext i8 %1 to i32
%4 = shl nuw i32 1, %3
%5 = load i8, i8* %0
%6 = trunc i32 %4 to i8
%7 = or i8 %5, %6
store i8 %7, i8* %0
ret void
}
/* Type definitions */
struct cec_msg {
  int *msg;
};
typedef int __u16;

/* Variables and functions */
void cec_ops_inactive_source(const struct cec_msg *msg, __u16 *phys_addr) {
  *phys_addr = (msg->msg[2] << 8) | msg->msg[3];
}


x86 assembly (clang, -O0):
<cec_ops_inactive_source>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x8(%rax),%ecx
shl    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
or     0xc(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cec_ops_inactive_source>:
mov    (%rdi),%rax
mov    0x8(%rax),%ecx
shl    $0x8,%ecx
or     0xc(%rax),%ecx
mov    %ecx,(%rsi)
ret

LLVM IR (-O0):
%struct.cec_msg = type { i32* }
define void @cec_ops_inactive_source(%struct.cec_msg* %0, i32* %1) {
%3 = alloca %struct.cec_msg*
%4 = alloca i32*
store %struct.cec_msg* %0, %struct.cec_msg** %3
store i32* %1, i32** %4
%5 = load %struct.cec_msg*, %struct.cec_msg** %3
%6 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %5, i32 0, i32 0
%7 = load i32*, i32** %6
%8 = getelementptr inbounds i32, i32* %7, i64 2
%9 = load i32, i32* %8
%10 = shl i32 %9, 8
%11 = load %struct.cec_msg*, %struct.cec_msg** %3
%12 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %11, i32 0, i32 0
%13 = load i32*, i32** %12
%14 = getelementptr inbounds i32, i32* %13, i64 3
%15 = load i32, i32* %14
%16 = or i32 %10, %15
%17 = load i32*, i32** %4
store i32 %16, i32* %17
ret void
}

LLVM IR (-O2):
%struct.cec_msg = type { i32* }
define void @cec_ops_inactive_source(%struct.cec_msg* nocapture %0, i32* nocapture writeonly %1) {
%3 = getelementptr inbounds %struct.cec_msg, %struct.cec_msg* %0, i64 0, i32 0
%4 = load i32*, i32** %3
%5 = getelementptr inbounds i32, i32* %4, i64 2
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = getelementptr inbounds i32, i32* %4, i64 3
%9 = load i32, i32* %8
%10 = or i32 %7, %9
store i32 %10, i32* %1
ret void
}
/* Type definitions */
struct pull_down_menu {
  int dummy;
};

/* Variables and functions */
int pull_down_menu_inside_internal(struct pull_down_menu *, int, int, int);
int pull_down_menu_inside(struct pull_down_menu *m, int physical_x,
                          int physical_y) {
  return pull_down_menu_inside_internal(m, physical_x, physical_y, 1);
}


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

x86 assembly (clang, -O2):
<pull_down_menu_inside>:
mov    $0x1,%ecx
jmp    1030 <pull_down_menu_inside_internal@plt>

LLVM IR (-O0):
%struct.pull_down_menu = type { i32 }
define i32 @pull_down_menu_inside(%struct.pull_down_menu* %0, i32 %1, i32 %2) {
%4 = alloca %struct.pull_down_menu*
%5 = alloca i32
%6 = alloca i32
store %struct.pull_down_menu* %0, %struct.pull_down_menu** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.pull_down_menu*, %struct.pull_down_menu** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @pull_down_menu_inside_internal(%struct.pull_down_menu* %7, i32 %8, i32 %9, i32 1)
ret i32 %10
}

LLVM IR (-O2):
%struct.pull_down_menu = type { i32 }
define i32 @pull_down_menu_inside(%struct.pull_down_menu* %0, i32 %1, i32 %2) {
%4 = tail call i32 @pull_down_menu_inside_internal(%struct.pull_down_menu* %0, i32 %1, i32 %2, i32 1)
ret i32 %4
}