xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void menu() {
  printf("\n************ WELCOME to Piggy Bank ************\n");
  printf("\t1. Deposit Money\n");
  printf("\t2. Withdraw Money\n");
  printf("\t3. Show Balance\n");
  printf("\t4. Exit\n");
}


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

x86 assembly (clang, -O2):
<menu>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
lea    0xf13(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf1f(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"\0A************ WELCOME to Piggy Bank ************\0A\00"
@.str.1 = [19 x i8] c"\091. Deposit Money\0A\00"
@.str.2 = [20 x i8] c"\092. Withdraw Money\0A\00"
@.str.3 = [18 x i8] c"\093. Show Balance\0A\00"
@.str.4 = [10 x i8] c"\094. Exit\0A\00"
define void @menu() {
%1 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [49 x i8] c"\0A************ WELCOME to Piggy Bank ************\00"
@str.5 = [18 x i8] c"\091. Deposit Money\00"
@str.6 = [19 x i8] c"\092. Withdraw Money\00"
@str.7 = [17 x i8] c"\093. Show Balance\00"
@str.8 = [9 x i8] c"\094. Exit\00"
define void @menu() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.8, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int strlen(char *);
char *gen_goto(char *label) {
  char *result = (char *)malloc((strlen(label) + 8) * (sizeof(char)));
  sprintf(result, "\tGOTO %s\n", label);
  return result;
}


x86 assembly (clang, -O0):
<gen_goto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x8,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_goto>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x8(%rax),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeb2(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"\09GOTO %s\0A\00"
define i8* @gen_goto(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 8
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = load i8*, i8** %2
%14 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [10 x i8] c"\09GOTO %s\0A\00"
define i8* @gen_goto(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 8
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %5, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* %5
}
double read_U8Fixed8Number(char *p) {
  unsigned long o32;
  o32 = 256 * (unsigned long)((unsigned char *)p)[0] +
        (unsigned long)((unsigned char *)p)[1];
  return (double)o32 / 256.0;
}


x86 assembly (clang, -O0):
<read_U8Fixed8Number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
shl    $0x30,%rax
bswap  %rax
mov    %rax,-0x10(%rbp)
movaps 0xeef(%rip),%xmm1
movq   -0x10(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xeee(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xeb7(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_U8Fixed8Number>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
cvtsi2sd %eax,%xmm0
mulsd  0xeec(%rip),%xmm0
ret

LLVM IR (-O0):
define double @read_U8Fixed8Number(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = mul i64 256, %7
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = add i64 %8, %12
store i64 %13, i64* %3
%14 = load i64, i64* %3
%15 = uitofp i64 %14 to double
%16 = fdiv double %15, 2.560000e+02
ret double %16
}

LLVM IR (-O2):
define double @read_U8Fixed8Number(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i64
%4 = shl nuw nsw i64 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = or i64 %4, %7
%9 = uitofp i64 %8 to double
%10 = fmul double %9, 3.906250e-03
ret double %10
}
int av_set_led(int on) { return !on; }


x86 assembly (clang, -O0):
<av_set_led>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_set_led>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @av_set_led(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @av_set_led(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(void *);
void *PrintHello(void *arg) {
  long x = 0;
  long tid = (long)arg;
  printf("Alo da thread %ld\n", tid);
  x = tid * tid;
  pthread_exit((void *)x);
}


x86 assembly (clang, -O0):
<PrintHello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
imul   -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintHello>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
imul   %rbx,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Alo da thread %ld\0A\00"
define i8* @PrintHello(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 0, i64* %4
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i64
store i64 %7, i64* %5
%8 = load i64, i64* %5
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i64 %8)
%10 = load i64, i64* %5
%11 = load i64, i64* %5
%12 = mul nsw i64 %10, %11
store i64 %12, i64* %4
%13 = load i64, i64* %4
%14 = inttoptr i64 %13 to i8*
%15 = call i32 @pthread_exit(i8* %14)
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
@.str = [19 x i8] c"Alo da thread %ld\0A\00"
define noalias i8* @PrintHello(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = mul nsw i64 %2, %2
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @pthread_exit(i8* %5)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ Safefree(void *);
__attribute__((always_)) void webgear_xs_free(void *block) { Safefree(block); }


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

x86 assembly (clang, -O2):
<webgear_xs_free>:
jmp    1030 <Safefree@plt>

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

LLVM IR (-O2):
define void @webgear_xs_free(i8* %0) {
%2 = tail call i32 @Safefree(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rtp_close_extra();
void rtp_deinitialization(void) { rtp_close_extra(); }


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

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

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

LLVM IR (-O2):
define void @rtp_deinitialization() {
%1 = tail call i32 (...) @rtp_close_extra()
ret void
}
call2f(f2, l, d2, c, f1, s, d1, i) float f2;
long l;
double d2;
char c;
float f1;
short s;
double d1;
int i;
{
  c = 'a';
  f1 = 0.0;
  s = 5;
  d1 = 0.0;
  i = 6;
  f2 = 0.1;
  l = 7;
  d2 = 0.2;
}


x86 assembly (clang, -O0):
<call2f>:
push   %rbp
mov    %rsp,%rbp
mov    %edx,%eax
movsd  %xmm2,-0x40(%rbp)
movaps %xmm0,%xmm2
movsd  -0x40(%rbp),%xmm0
cvtsd2ss %xmm2,%xmm2
mov    %sil,%dl
cvtsd2ss %xmm0,%xmm0
movss  %xmm2,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %dl,-0x19(%rbp)
movss  %xmm0,-0x20(%rbp)
mov    %ax,-0x22(%rbp)
movsd  %xmm3,-0x30(%rbp)
mov    %ecx,-0x34(%rbp)
movb   $0x61,-0x19(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movw   $0x5,-0x22(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x6,-0x34(%rbp)
movss  0xe9f(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movq   $0x7,-0x10(%rbp)
movsd  0xe82(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @call2f(double %0, i64 %1, double %2, i32 %3, double %4, i32 %5, double %6, i32 %7) {
%9 = alloca i32
%10 = alloca float
%11 = alloca i64
%12 = alloca double
%13 = alloca i8
%14 = alloca float
%15 = alloca i16
%16 = alloca double
%17 = alloca i32
%18 = fptrunc double %0 to float
%19 = trunc i32 %3 to i8
%20 = fptrunc double %4 to float
%21 = trunc i32 %5 to i16
store float %18, float* %10
store i64 %1, i64* %11
store double %2, double* %12
store i8 %19, i8* %13
store float %20, float* %14
store i16 %21, i16* %15
store double %6, double* %16
store i32 %7, i32* %17
store i8 97, i8* %13
store float 0.000000e+00, float* %14
store i16 5, i16* %15
store double 0.000000e+00, double* %16
store i32 6, i32* %17
store float 0x3FB99999A0000000, float* %10
store i64 7, i64* %11
store double 2.000000e-01, double* %12
%22 = load i32, i32* %9
ret i32 %22
}

LLVM IR (-O2):
define i32 @call2f(double %0, i64 %1, double %2, i32 %3, double %4, i32 %5, double %6, i32 %7) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int mknod(const char *filename __attribute__((unused)),
          int mode __attribute__((unused)), int dev __attribute__((unused))) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<mknod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
mov    0x2eba(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mknod>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @mknod(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @mknod(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
unsigned int even_newer_style_hook(void *priv, struct sk_buff *skb,
                                   const struct nf_hook_state *state) {
  (void)priv;
  (void)skb;
  (void)state;
  return 0;
}


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

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

LLVM IR (-O0):
%struct.sk_buff = type opaque
%struct.nf_hook_state = type opaque
define i32 @even_newer_style_hook(i8* %0, %struct.sk_buff* %1, %struct.nf_hook_state* %2) {
%4 = alloca i8*
%5 = alloca %struct.sk_buff*
%6 = alloca %struct.nf_hook_state*
store i8* %0, i8** %4
store %struct.sk_buff* %1, %struct.sk_buff** %5
store %struct.nf_hook_state* %2, %struct.nf_hook_state** %6
%7 = load i8*, i8** %4
%8 = load %struct.sk_buff*, %struct.sk_buff** %5
%9 = load %struct.nf_hook_state*, %struct.nf_hook_state** %6
ret i32 0
}

LLVM IR (-O2):
%struct.sk_buff = type opaque
%struct.nf_hook_state = type opaque
define i32 @even_newer_style_hook(i8* nocapture readnone %0, %struct.sk_buff* nocapture readnone %1, %struct.nf_hook_state* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *, int);
void Move_Ret_To_Foreign_L(int index) {
  Inst_Printf("movl",
              "%%eax,"
              "pl_foreign_long+%d",
              index * 4);
}


x86 assembly (clang, -O0):
<Move_Ret_To_Foreign_L>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
shl    $0x2,%edx
lea    0xed8(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <Inst_Printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Move_Ret_To_Foreign_L>:
lea    0x0(,%rdi,4),%edx
lea    0xee2(%rip),%rdi
lea    0xee0(%rip),%rsi
jmp    1030 <Inst_Printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"movl\00"
@.str.1 = [25 x i8] c"%%eax,pl_foreign_long+%d\00"
define void @Move_Ret_To_Foreign_L(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 4
%5 = call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"movl\00"
@.str.1 = [25 x i8] c"%%eax,pl_foreign_long+%d\00"
define void @Move_Ret_To_Foreign_L(i32 %0) {
%2 = shl nsw i32 %0, 2
%3 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %2)
ret void
}
void reverseString(char str[], int start, int end) {
  char temp;
  while (start < end) {
    temp = str[start];
    str[start] = str[end];
    str[end] = temp;
    start++;
    end--;
  }
}


x86 assembly (clang, -O0):
<reverseString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1163 <reverseString+0x63>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    110e <reverseString+0xe>
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverseString>:
cmp    %edx,%esi
jge    1131 <reverseString+0x31>
movslq %esi,%rax
movslq %edx,%rcx
add    $0x1,%rax
xchg   %ax,%ax
movzbl -0x1(%rdi,%rax,1),%esi
movzbl (%rdi,%rcx,1),%edx
mov    %dl,-0x1(%rdi,%rax,1)
mov    %sil,(%rdi,%rcx,1)
add    $0xffffffffffffffff,%rcx
lea    0x1(%rax),%rdx
cmp    %rcx,%rax
mov    %rdx,%rax
jl     1110 <reverseString+0x10>
ret

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

LLVM IR (-O2):
define void @reverseString(i8* nocapture %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = sext i32 %2 to i64
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ %7, %5 ], [ %16, %8 ]
%10 = phi i64 [ %6, %5 ], [ %15, %8 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 %9
%14 = load i8, i8* %13
store i8 %14, i8* %11
store i8 %12, i8* %13
%15 = add nsw i64 %10, 1
%16 = add nsw i64 %9, -1
%17 = icmp slt i64 %15, %16
br i1 %17, label %8, label %18
18: ; preds = %8, %3
ret void
}
int main() {
  register unsigned long i, j, maxn = 400000, primes = 0;
  for (i = 0; i <= maxn; i++) {
    for (j = 2; j <= i - 1; j++) {
      if (i % j == 0)
        break;
    }
    if (i == j) {
      primes = primes + 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0x61a80,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
ja     11af <main+0xaf>
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
ja     117f <main+0x7f>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
cmp    $0x0,%rdx
jne    1169 <main+0x69>
jmp    117f <main+0x7f>
jmp    116e <main+0x6e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1139 <main+0x39>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1199 <main+0x99>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    119e <main+0x9e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1123 <main+0x23>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("Usage: ./particle_box [box width] [grid steps] [time step] "
         "[number of steps] [sigma] [kappa]\n");
}


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

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

LLVM IR (-O0):
@.str = [94 x i8] c"Usage: ./particle_box [box width] [grid steps] [time step] [number of steps] [sigma] [kappa]\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [93 x i8] c"Usage: ./particle_box [box width] [grid steps] [time step] [number of steps] [sigma] [kappa]\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("cl_gl.h standalone test PASSED.\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"cl_gl.h standalone test PASSED.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [32 x i8] c"cl_gl.h standalone test PASSED.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int int_swap(unsigned int i) {
  return (((i & 0xFF000000) >> 24) | ((i & 0x00FF0000) >> 8) |
          ((i & 0x0000FF00) << 8) | (((i & 0x000000FF) << 24)));
}


x86 assembly (clang, -O0):
<int_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
shr    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @int_swap(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -16777216
%5 = lshr i32 %4, 24
%6 = load i32, i32* %2
%7 = and i32 %6, 16711680
%8 = lshr i32 %7, 8
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = and i32 %10, 65280
%12 = shl i32 %11, 8
%13 = or i32 %9, %12
%14 = load i32, i32* %2
%15 = and i32 %14, 255
%16 = shl i32 %15, 24
%17 = or i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @int_swap(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
void *calloc(int, int);
void *wrap_calloc(int size, int count) { return calloc(size, count); }


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

x86 assembly (clang, -O2):
<wrap_calloc>:
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define noalias i8* @wrap_calloc(i32 %0, i32 %1) {
%3 = tail call i8* @calloc(i32 %0, i32 %1)
ret i8* %3
}
int Calc_power_of_two(int number) {
  int power;
  power = 0;
  while (number != 1) {
    power++;
    number = number >> 1;
  }
  return power;
}


x86 assembly (clang, -O0):
<Calc_power_of_two>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
je     112f <Calc_power_of_two+0x2f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <Calc_power_of_two+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Calc_power_of_two>:
xor    %eax,%eax
cmp    $0x1,%edi
je     111a <Calc_power_of_two+0x1a>
xor    %eax,%eax
nopl   0x0(%rax)
add    $0x1,%eax
sar    %edi
cmp    $0x1,%edi
jne    1110 <Calc_power_of_two+0x10>
ret

LLVM IR (-O0):
define i32 @Calc_power_of_two(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = ashr i32 %10, 1
store i32 %11, i32* %2
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @Calc_power_of_two(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = ashr i32 %5, 1
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a;
  int b;
  int sum;
  sum = a + b;
  printf("Sum = %d", sum);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"Sum = %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = add nsw i32 %5, %6
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Sum = %d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 undef)
ret i32 0
}
const char *protobuf_c_version(void) { return "1.4.0"; }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"1.4.0\00"
define i8* @protobuf_c_version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"1.4.0\00"
define i8* @protobuf_c_version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
unsigned int autofs_type_indirect(unsigned int type) { return (type == 1U); }


x86 assembly (clang, -O0):
<autofs_type_indirect>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @autofs_type_indirect(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ant_log_err_close();
int /*<<< orphan*/ ant_log_url_all_close();
int /*<<< orphan*/ ant_log_url_close();
void ant_log_clean() {
  ant_log_err_close();
  ant_log_url_all_close();
  ant_log_url_close();
}


x86 assembly (clang, -O0):
<ant_log_clean>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <ant_log_err_close@plt>
mov    $0x0,%al
call   1030 <ant_log_url_all_close@plt>
mov    $0x0,%al
call   1050 <ant_log_url_close@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ant_log_clean>:
push   %rax
xor    %eax,%eax
call   1040 <ant_log_err_close@plt>
xor    %eax,%eax
call   1030 <ant_log_url_all_close@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <ant_log_url_close@plt>

LLVM IR (-O0):
define void @ant_log_clean() {
%1 = call i32 (...) @ant_log_err_close()
%2 = call i32 (...) @ant_log_url_all_close()
%3 = call i32 (...) @ant_log_url_close()
ret void
}

LLVM IR (-O2):
define void @ant_log_clean() {
%1 = tail call i32 (...) @ant_log_err_close()
%2 = tail call i32 (...) @ant_log_url_all_close()
%3 = tail call i32 (...) @ant_log_url_close()
ret void
}
/* Variables and functions */
double tan(double);
double f1(double x) { return 1.0 / tan(x); }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <tan@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rax
call   1030 <tan@plt>
movsd  0xee2(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @f1(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @tan(double %3)
%5 = fdiv double 1.000000e+00, %4
ret double %5
}

LLVM IR (-O2):
define double @f1(double %0) {
%2 = tail call double @tan(double %0)
%3 = fdiv double 1.000000e+00, %2
ret double %3
}
float inch2mm(float inch) { return inch / 0.039370; }


x86 assembly (clang, -O0):
<inch2mm>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<inch2mm>:
cvtss2sd %xmm0,%xmm0
divsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @inch2mm(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fdiv double %4, 3.937000e-02
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @inch2mm(float %0) {
%2 = fpext float %0 to double
%3 = fdiv double %2, 3.937000e-02
%4 = fptrunc double %3 to float
ret float %4
}
int swap(int *const x, int *const y) {
  if (*x == *y)
    return 1;
  int temp = *x;
  *x = *y;
  *y = temp;
  return 0;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jne    112a <swap+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    114f <swap+0x4f>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%ecx
mov    (%rsi),%edx
mov    $0x1,%eax
cmp    %edx,%ecx
je     1113 <swap+0x13>
mov    %edx,(%rdi)
mov    %ecx,(%rsi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = icmp eq i32 %3, %4
br i1 %5, label %7, label %6
6: ; preds = %2
store i32 %4, i32* %0
store i32 %3, i32* %1
br label %7
7: ; preds = %2, %6
%8 = phi i32 [ 0, %6 ], [ 1, %2 ]
ret i32 %8
}
int fsp_detect(void) { return -38; }


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

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

LLVM IR (-O0):
define i32 @fsp_detect() {
ret i32 -38
}

LLVM IR (-O2):
define i32 @fsp_detect() {
ret i32 -38
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int num = 1;
  printf("I am a simple ");
  printf("computer.\n");
  printf("My favorite number is %d because it is first.\n", num);
  getchar();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"I am a simple \00"
@.str.1 = [11 x i8] c"computer.\0A\00"
@.str.2 = [47 x i8] c"My favorite number is %d because it is first.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"I am a simple \00"
@.str.2 = [47 x i8] c"My favorite number is %d because it is first.\0A\00"
@str = [10 x i8] c"computer.\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0), i32 1)
%4 = tail call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ merge_parts(int *, int);
void merge_sort(int arr[], int length) {
  if (length > 1) {
    merge_sort(&arr[0], (length / 2));
    merge_sort(&arr[length / 2], (length - length / 2));
    merge_parts(arr, length);
  }
}


x86 assembly (clang, -O0):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    1188 <merge_sort+0x68>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
call   1030 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
sub    %eax,%esi
call   1030 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <merge_parts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort>:
cmp    $0x1,%esi
jle    1154 <merge_sort+0x34>
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %esi,%ebx
shr    %ebx
mov    %ebx,%esi
call   1030 <merge_sort@plt>
lea    (%r14,%rbx,4),%rdi
mov    %ebp,%esi
sub    %ebx,%esi
call   1030 <merge_sort@plt>
mov    %r14,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <merge_parts@plt>
ret

LLVM IR (-O0):
define void @merge_sort(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 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %24
7: ; preds = %2
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %4
%11 = sdiv i32 %10, 2
%12 = load i32*, i32** %3
%13 = load i32, i32* %4
%14 = sdiv i32 %13, 2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %12, i64 %15
%17 = load i32, i32* %4
%18 = load i32, i32* %4
%19 = sdiv i32 %18, 2
%20 = sub nsw i32 %17, %19
%21 = load i32*, i32** %3
%22 = load i32, i32* %4
%23 = call i32 @merge_parts(i32* %21, i32 %22)
br label %24
24: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @merge_sort(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %5, label %4
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = lshr i32 %1, 1
tail call void @merge_sort(i32* %0, i32 %6)
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = sub nsw i32 %1, %6
tail call void @merge_sort(i32* %8, i32 %9)
%10 = tail call i32 @merge_parts(i32* %0, i32 %1)
br label %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ _kill(int /*<<< orphan*/, int);
void _exit(int32_t status) {
  _kill(status, -1);
  while (1) {
  }
}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xffffffff,%esi
call   1030 <_kill@plt>
jmp    1128 <_exit+0x18>

x86 assembly (clang, -O2):
<_exit>:
push   %rax
mov    $0xffffffff,%esi
call   1030 <_kill@plt>
nopl   0x0(%rax,%rax,1)
jmp    1120 <_exit+0x10>

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_kill(i32 %3, i32 -1)
br label %5
5: ; preds = %1, %5
br label %5
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
%2 = tail call i32 @_kill(i32 %0, i32 -1)
br label %3
3: ; preds = %1, %3
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fseek(int /*<<< orphan*/, long, int);
int /*<<< orphan*/ message(char *, int, char *);
int /*<<< orphan*/ stdout;
int system(char *);
int runs(char *cmd) {
  int status;
  fflush(stdout);
  status = system(cmd);
  if (status)
    message("Error 0x%x executing %s", status, cmd);
  fseek(stdout, 0L, 2);
  return (status);
}


x86 assembly (clang, -O0):
<runs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
mov    -0x8(%rbp),%rdi
call   1040 <system@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1183 <runs+0x43>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xe82(%rip),%rdi
call   1030 <message@plt>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x2,%edx
call   1060 <fseek@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runs>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    0x2e91(%rip),%r15
mov    (%r15),%edi
call   1050 <fflush@plt>
mov    %r14,%rdi
call   1040 <system@plt>
mov    %eax,%ebx
test   %eax,%eax
je     1176 <runs+0x36>
lea    0xe94(%rip),%rdi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <message@plt>
mov    (%r15),%edi
xor    %esi,%esi
mov    $0x2,%edx
call   1060 <fseek@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [24 x i8] c"Error 0x%x executing %s\00"
define i32 @runs(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i32, i32* @stdout
%5 = call i32 @fflush(i32 %4)
%6 = load i8*, i8** %2
%7 = call i32 @system(i8* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i32, i32* %3
%12 = load i8*, i8** %2
%13 = call i32 @message(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %12)
br label %14
14: ; preds = %10, %1
%15 = load i32, i32* @stdout
%16 = call i32 @fseek(i32 %15, i64 0, i32 2)
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [24 x i8] c"Error 0x%x executing %s\00"
define i32 @runs(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = tail call i32 @system(i8* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @message(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %4, i8* %0)
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* @stdout
%10 = tail call i32 @fseek(i32 %9, i64 0, i32 2)
ret i32 %4
}
long str_hash(void *p) {
  char *s = p;
  long x = *s << 7;
  while (*s)
    x = (1000003 * x) ^ *s++;
  return x;
}


x86 assembly (clang, -O0):
<str_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
shl    $0x7,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1154 <str_hash+0x54>
imul   $0xf4243,-0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbq (%rcx),%rcx
xor    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    1120 <str_hash+0x20>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_hash>:
movsbq (%rdi),%rcx
mov    %rcx,%rax
shl    $0x7,%rax
test   %rcx,%rcx
je     1139 <str_hash+0x39>
add    $0x1,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
imul   $0xf4243,%rax,%rdx
movsbq %cl,%rax
xor    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1120 <str_hash+0x20>
ret

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

LLVM IR (-O2):
define i64 @str_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = shl nsw i32 %3, 7
%5 = sext i32 %4 to i64
%6 = icmp eq i8 %2, 0
br i1 %6, label %17, label %7
7: ; preds = %1, %7
%8 = phi i64 [ %14, %7 ], [ %5, %1 ]
%9 = phi i8* [ %12, %7 ], [ %0, %1 ]
%10 = phi i8 [ %15, %7 ], [ %2, %1 ]
%11 = mul nsw i64 %8, 1000003
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = sext i8 %10 to i64
%14 = xor i64 %11, %13
%15 = load i8, i8* %12
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %7
17: ; preds = %7, %1
%18 = phi i64 [ %5, %1 ], [ %14, %7 ]
ret i64 %18
}
void broker_acknowledgement_data(int type, int flags, int attr,
                                 int acknowledgement_type, void *data,
                                 char *ack_author, char *ack_data, int subtype,
                                 int notify_contacts, int persistent_comment,
                                 struct timeval *timestamp) {}


x86 assembly (clang, -O0):
<broker_acknowledgement_data>:
push   %rbp
mov    %rsp,%rbp
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.timeval = type opaque
define void @broker_acknowledgement_data(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i8* %5, i8* %6, i32 %7, i32 %8, i32 %9, %struct.timeval* %10) {
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca %struct.timeval*
store i32 %0, i32* %12
store i32 %1, i32* %13
store i32 %2, i32* %14
store i32 %3, i32* %15
store i8* %4, i8** %16
store i8* %5, i8** %17
store i8* %6, i8** %18
store i32 %7, i32* %19
store i32 %8, i32* %20
store i32 %9, i32* %21
store %struct.timeval* %10, %struct.timeval** %22
ret void
}

LLVM IR (-O2):
%struct.timeval = type opaque
define void @broker_acknowledgement_data(i32 %0, i32 %1, i32 %2, i32 %3, i8* nocapture %4, i8* nocapture %5, i8* nocapture %6, i32 %7, i32 %8, i32 %9, %struct.timeval* nocapture %10) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_lexval();
int /*<<< orphan*/ var_dcl_cnt();
int yyselect();
var_dcl_cnts() {
  switch (yyselect()) {
  case 31: {
    var_dcl_cnt();
  } break;
  case 32: {
    var_dcl_cnt();
    get_lexval();
    var_dcl_cnts();
  } break;
  }
}


x86 assembly (clang, -O0):
<var_dcl_cnts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <yyselect@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
sub    $0x1f,%eax
je     1173 <var_dcl_cnts+0x33>
jmp    1162 <var_dcl_cnts+0x22>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
je     117f <var_dcl_cnts+0x3f>
jmp    1192 <var_dcl_cnts+0x52>
mov    $0x0,%al
call   1030 <var_dcl_cnt@plt>
jmp    1192 <var_dcl_cnts+0x52>
mov    $0x0,%al
call   1030 <var_dcl_cnt@plt>
mov    $0x0,%al
call   1050 <get_lexval@plt>
call   1060 <var_dcl_cnts@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<var_dcl_cnts>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <yyselect@plt>
cmp    $0x20,%eax
jne    115c <var_dcl_cnts+0x2c>
xor    %eax,%eax
call   1030 <var_dcl_cnt@plt>
xor    %eax,%eax
call   1050 <get_lexval@plt>
jmp    1140 <var_dcl_cnts+0x10>
cmp    $0x1f,%eax
jne    1168 <var_dcl_cnts+0x38>
xor    %eax,%eax
call   1030 <var_dcl_cnt@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @var_dcl_cnts() {
%1 = alloca i32
%2 = call i32 (...) @yyselect()
switch i32 %2, label %9 [
i32 31, label %3
i32 32, label %5
]
3: ; preds = %0
%4 = call i32 (...) @var_dcl_cnt()
br label %9
5: ; preds = %0
%6 = call i32 (...) @var_dcl_cnt()
%7 = call i32 (...) @get_lexval()
%8 = call i32 @var_dcl_cnts()
br label %9
9: ; preds = %0, %5, %3
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @var_dcl_cnts() {
br label %1
1: ; preds = %5, %0
%2 = tail call i32 (...) @yyselect()
switch i32 %2, label %8 [
i32 31, label %3
i32 32, label %5
]
3: ; preds = %1
%4 = tail call i32 (...) @var_dcl_cnt()
br label %8
5: ; preds = %1
%6 = tail call i32 (...) @var_dcl_cnt()
%7 = tail call i32 (...) @get_lexval()
br label %1
8: ; preds = %1, %3
ret i32 undef
}