xunge/DecIR huggingface dataset:
/* Variables and functions */
double *smalloc_ret(int);
double *mkvec_ret(int nl, int nh) {
  double *v;
  v = smalloc_ret((nh - nl + 1) * sizeof(double));
  if (v == NULL) {
    return (NULL);
  } else {
    return (v - nl);
  }
}


x86 assembly (clang, -O0):
<mkvec_ret>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <smalloc_ret@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1150 <mkvec_ret+0x40>
movq   $0x0,-0x8(%rbp)
jmp    1168 <mkvec_ret+0x58>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkvec_ret>:
push   %rbx
mov    %edi,%ebx
sub    %edi,%esi
lea    0x8(,%rsi,8),%edi
call   1030 <smalloc_ret@plt>
movslq %ebx,%rcx
shl    $0x3,%rcx
mov    %rax,%rdx
sub    %rcx,%rdx
test   %rax,%rax
cmovne %rdx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define double* @mkvec_ret(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = shl i32 %3, 3
%5 = add i32 %4, 8
%6 = tail call double* @smalloc_ret(i32 %5)
%7 = icmp eq double* %6, null
%8 = sext i32 %0 to i64
%9 = sub nsw i64 0, %8
%10 = getelementptr inbounds double, double* %6, i64 %9
%11 = select i1 %7, double* null, double* %10
ret double* %11
}
char *echo(char *msg) { return msg; }


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

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

LLVM IR (-O0):
define i8* @echo(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret i8* %3
}

LLVM IR (-O2):
define i8* @echo(i8* readnone returned %0) {
ret i8* %0
}
void foo418(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo418(i32 %0) {
ret void
}
int occampi_misc_post_setup(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @occampi_misc_post_setup() {
ret i32 0
}
void yy_2_ListPrefix(char *yytext, int yyleng) {
  ;
  ;
}


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

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

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

LLVM IR (-O2):
define void @yy_2_ListPrefix(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ atoll();
int main() {
  atoll();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <atoll@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @atoll()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @atoll()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ err(int, char *);
void *wm(void *result) {
  if (!result)
    err(1, "malloc() failed");
  return result;
}


x86 assembly (clang, -O0):
<wm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1138 <wm+0x28>
mov    $0x1,%edi
lea    0xecd(%rip),%rsi
call   1030 <err@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wm>:
push   %rbx
mov    %rdi,%rbx
test   %rdi,%rdi
jne    112a <wm+0x1a>
lea    0xee0(%rip),%rsi
mov    $0x1,%edi
call   1030 <err@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"malloc() failed\00"
define i8* @wm(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = call i32 @err(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
@.str = [16 x i8] c"malloc() failed\00"
define i8* @wm(i8* readnone returned %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
ret i8* %0
}
/* Variables and functions */
void *calloc(int, int);
void *speex_alloc(int count, int size) {
  if (count * size < 4096) {
    count = 4096 / size;
  }
  return calloc(count, size);
}


x86 assembly (clang, -O0):
<speex_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
cmp    $0x1000,%eax
jge    113c <speex_alloc+0x2c>
mov    $0x1000,%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <calloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<speex_alloc>:
mov    %esi,%eax
imul   %edi,%eax
cmp    $0xfff,%eax
jg     1127 <speex_alloc+0x17>
mov    $0x1000,%eax
xor    %edx,%edx
idiv   %esi
mov    %eax,%edi
jmp    1030 <calloc@plt>

LLVM IR (-O0):
define i8* @speex_alloc(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 = mul nsw i32 %5, %6
%8 = icmp slt i32 %7, 4096
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* %4
%11 = sdiv i32 4096, %10
store i32 %11, i32* %3
br label %12
12: ; preds = %9, %2
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i8* @calloc(i32 %13, i32 %14)
ret i8* %15
}

LLVM IR (-O2):
define noalias i8* @speex_alloc(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = icmp slt i32 %3, 4096
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = sdiv i32 4096, %1
br label %7
7: ; preds = %5, %2
%8 = phi i32 [ %6, %5 ], [ %0, %2 ]
%9 = tail call i8* @calloc(i32 %8, i32 %1)
ret i8* %9
}
void PreConjGradCleanup(r, z, p, ADATp, temp) char *r, *z, *p, *ADATp, *temp;
{
  Free((char *)r);
  Free((char *)z);
  Free((char *)p);
  Free((char *)ADATp);
  Free((char *)temp);
  return;
}


x86 assembly (clang, -O0):
<PreConjGradCleanup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <Free@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <Free@plt>
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1030 <Free@plt>
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1030 <Free@plt>
mov    -0x28(%rbp),%rdi
mov    $0x0,%al
call   1030 <Free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PreConjGradCleanup>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
xor    %eax,%eax
call   1030 <Free@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <Free@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <Free@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <Free@plt>
mov    %r14,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <Free@plt>

LLVM IR (-O0):
define void @PreConjGradCleanup(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %11)
%13 = load i8*, i8** %7
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %13)
%15 = load i8*, i8** %8
%16 = call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %15)
%17 = load i8*, i8** %9
%18 = call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %17)
%19 = load i8*, i8** %10
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %19)
ret void
}

LLVM IR (-O2):
define void @PreConjGradCleanup(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %0)
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %1)
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %2)
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %3)
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void clear_screen(void) { system("cls"); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
define void @clear_screen() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double dqawce(double (*)(double, void *), void *, double, double, double,
              double, double, double *, int *, int *);
double dqawc(double f(double, void *), void *cbData, double a, double b,
             double c, double epsabs, double epsrel, double *abserr, int *neval,
             int *ier) {
  double result;
  result = dqawce(f, cbData, a, b, c, epsabs, epsrel, abserr, neval, ier);
  return result;
}


x86 assembly (clang, -O0):
<dqawc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
movsd  %xmm3,-0x30(%rbp)
movsd  %xmm4,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
mov    %r8,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm3
movsd  -0x38(%rbp),%xmm4
mov    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%rcx
mov    -0x50(%rbp),%r8
call   1030 <dqawce@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dqawc>:
jmp    1030 <dqawce@plt>

LLVM IR (-O0):
define double @dqawc(double (double, i8*)* %0, i8* %1, double %2, double %3, double %4, double %5, double %6, double* %7, i32* %8, i32* %9) {
%11 = alloca double (double, i8*)*
%12 = alloca i8*
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double*
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca double
store double (double, i8*)* %0, double (double, i8*)** %11
store i8* %1, i8** %12
store double %2, double* %13
store double %3, double* %14
store double %4, double* %15
store double %5, double* %16
store double %6, double* %17
store double* %7, double** %18
store i32* %8, i32** %19
store i32* %9, i32** %20
%22 = load double (double, i8*)*, double (double, i8*)** %11
%23 = load i8*, i8** %12
%24 = load double, double* %13
%25 = load double, double* %14
%26 = load double, double* %15
%27 = load double, double* %16
%28 = load double, double* %17
%29 = load double*, double** %18
%30 = load i32*, i32** %19
%31 = load i32*, i32** %20
%32 = call double @dqawce(double (double, i8*)* %22, i8* %23, double %24, double %25, double %26, double %27, double %28, double* %29, i32* %30, i32* %31)
store double %32, double* %21
%33 = load double, double* %21
ret double %33
}

LLVM IR (-O2):
define double @dqawc(double (double, i8*)* %0, i8* %1, double %2, double %3, double %4, double %5, double %6, double* %7, i32* %8, i32* %9) {
%11 = tail call double @dqawce(double (double, i8*)* %0, i8* %1, double %2, double %3, double %4, double %5, double %6, double* %7, i32* %8, i32* %9)
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ execve(char *, char **, char **);
int main() {
  char filename[] = "/bin/sh\x00";
  char **argv, **envp;
  argv[0] = filename;
  argv[1] = 0;
  envp[0] = 0;
  execve(filename, argv, envp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x9(%rbp)
mov    0xedf(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x9(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
lea    -0x9(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <execve@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
@__const.main.filename = [9 x i8] c"/bin/sh\00\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = alloca i8**
%3 = alloca i8**
%4 = bitcast [9 x i8]* %1 to i8*
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%6 = load i8**, i8*** %2
%7 = getelementptr inbounds i8*, i8** %6, i64 0
store i8* %5, i8** %7
%8 = load i8**, i8*** %2
%9 = getelementptr inbounds i8*, i8** %8, i64 1
store i8* null, i8** %9
%10 = load i8**, i8*** %3
%11 = getelementptr inbounds i8*, i8** %10, i64 0
store i8* null, i8** %11
%12 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%13 = load i8**, i8*** %2
%14 = load i8**, i8*** %3
%15 = call i32 @execve(i8* %12, i8** %13, i8** %14)
ret i32 0
}

LLVM IR (-O2):
/* Variables and functions */
char *malloc(int);
int strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
char *subString(int offset, int len, const char *input) {
  char *sub = malloc(sizeof(char) * len);
  int input_len = strlen(input);
  strncpy(sub, input + offset, len);
  return sub;
}


x86 assembly (clang, -O0):
<subString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x4(%rbp),%rax
add    %rax,%rsi
mov    -0x8(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subString>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %edi,%r14d
mov    %esi,%edi
call   1050 <malloc@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
movslq %r14d,%rsi
add    %rbx,%rsi
mov    %rbp,%rdi
mov    %r15d,%edx
call   1030 <strncpy@plt>
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @subString(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = mul i64 1, %10
%12 = trunc i64 %11 to i32
%13 = call i8* @malloc(i32 %12)
store i8* %13, i8** %7
%14 = load i8*, i8** %6
%15 = call i32 @strlen(i8* %14)
store i32 %15, i32* %8
%16 = load i8*, i8** %7
%17 = load i8*, i8** %6
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i32, i32* %5
%22 = call i32 @strncpy(i8* %16, i8* %20, i32 %21)
%23 = load i8*, i8** %7
ret i8* %23
}

LLVM IR (-O2):
define i8* @subString(i32 %0, i32 %1, i8* %2) {
%4 = tail call i8* @malloc(i32 %1)
%5 = tail call i32 @strlen(i8* %2)
%6 = sext i32 %0 to i64
%7 = getelementptr inbounds i8, i8* %2, i64 %6
%8 = tail call i32 @strncpy(i8* %4, i8* %7, i32 %1)
ret i8* %4
}
void cmov2s_(x, y) short *x, *y;
{ cmov((float)*x, (float)*y, 0.0); }


x86 assembly (clang, -O0):
<cmov2s_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movswl (%rax),%eax
cvtsi2ss %eax,%xmm1
cvtss2sd %xmm1,%xmm1
xorps  %xmm2,%xmm2
mov    $0x3,%al
call   1030 <cmov@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmov2s_>:
movswl (%rdi),%eax
cvtsi2sd %eax,%xmm0
movswl (%rsi),%eax
cvtsi2sd %eax,%xmm1
xorps  %xmm2,%xmm2
mov    $0x3,%al
jmp    1030 <cmov@plt>

LLVM IR (-O0):
define void @cmov2s_(i16* %0, i16* %1) {
%3 = alloca i16*
%4 = alloca i16*
store i16* %0, i16** %3
store i16* %1, i16** %4
%5 = load i16*, i16** %3
%6 = load i16, i16* %5
%7 = sitofp i16 %6 to float
%8 = fpext float %7 to double
%9 = load i16*, i16** %4
%10 = load i16, i16* %9
%11 = sitofp i16 %10 to float
%12 = fpext float %11 to double
%13 = call i32 (double, double, double, ...) bitcast (i32 (...)* @cmov to i32 (double, double, double, ...)*)(double %8, double %12, double 0.000000e+00)
ret void
}

LLVM IR (-O2):
define void @cmov2s_(i16* nocapture %0, i16* nocapture %1) {
%3 = load i16, i16* %0
%4 = sitofp i16 %3 to double
%5 = load i16, i16* %1
%6 = sitofp i16 %5 to double
%7 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @cmov to i32 (double, double, double, ...)*)(double %4, double %6, double 0.000000e+00)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *const);
int /*<<< orphan*/ printf(char *, char *const, char *const *,
                          int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *const);
void test_string() {
  typedef char *sds;
  const sds s = "hellow world\n";
  printf("%s\n%p ,len = %zu\n", s, &s, strlen(s));
  free(s);
}


x86 assembly (clang, -O0):
<test_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeb6(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
lea    0xeb6(%rip),%rdi
lea    0xea1(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <printf@plt>
lea    0xe91(%rip),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_string>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
mov    %rbx,0x8(%rsp)
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xebe(%rip),%rdi
lea    0x8(%rsp),%rdx
mov    %rbx,%rsi
mov    %eax,%ecx
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"hellow world\0A\00"
@.str.1 = [18 x i8] c"%s\0A%p ,len = %zu\0A\00"
define void @test_string() {
%1 = alloca i8*
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0), i8** %1, i32 %2)
%4 = call i32 @free(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"hellow world\0A\00"
@.str.1 = [18 x i8] c"%s\0A%p ,len = %zu\0A\00"
define void @test_string() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %1, i32 %3)
%5 = call i32 @free(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char const *getenv(char *);
const char *IoTHubAccount_GetEventhubAccessKey(void) {
  return getenv("IOTHUB_EVENTHUB_ACCESS_KEY");
}


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

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

LLVM IR (-O0):
@.str = [27 x i8] c"IOTHUB_EVENTHUB_ACCESS_KEY\00"
define i8* @IoTHubAccount_GetEventhubAccessKey() {
%1 = call i8* @getenv(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [27 x i8] c"IOTHUB_EVENTHUB_ACCESS_KEY\00"
define i8* @IoTHubAccount_GetEventhubAccessKey() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
long get_screen_col();
long get_message_col(void) { return get_screen_col(); }


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

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

LLVM IR (-O0):
define i64 @get_message_col() {
%1 = call i64 (...) @get_screen_col()
ret i64 %1
}

LLVM IR (-O2):
define i64 @get_message_col() {
%1 = tail call i64 (...) @get_screen_col()
ret i64 %1
}
void usb_ep1_token() {}


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

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

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

LLVM IR (-O2):
define void @usb_ep1_token() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_dog_files(char *);
int /*<<< orphan*/ test_sample_xml_file(char *);
int main() {
  test_dog_files("../benchmark_files/");
  test_sample_xml_file("../benchmark_files/xml2/");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"../benchmark_files/\00"
@.str.1 = [25 x i8] c"../benchmark_files/xml2/\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test_dog_files(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @test_sample_xml_file(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"../benchmark_files/\00"
@.str.1 = [25 x i8] c"../benchmark_files/xml2/\00"
define i32 @main() {
%1 = tail call i32 @test_dog_files(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @test_sample_xml_file(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void spi_set_freq(uint32_t freq) {
  uint32_t scalar = (((150000000) / freq) - 1) & 0xFF;
  uint32_t reg = *(volatile uint32_t *)(0x01E12000 + 0x50);
  if (freq > (50000000))
    return;
  reg &= ~0xFF00;
  reg |= scalar << 8;
  *(volatile uint32_t *)(0x01E12000 + 0x50) = reg;
  return;
}


x86 assembly (clang, -O0):
<spi_set_freq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x8f0d180,%eax
cltd
idivl  -0x4(%rbp)
sub    $0x1,%eax
and    $0xff,%eax
mov    %eax,-0x8(%rbp)
mov    $0x1e12050,%eax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x2faf080,-0x4(%rbp)
jle    1137 <spi_set_freq+0x37>
jmp    1158 <spi_set_freq+0x58>
mov    -0xc(%rbp),%eax
and    $0xffff00ff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1e12050,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_set_freq>:
mov    0x1e12050,%ecx
cmp    $0x2faf080,%edi
jg     1132 <spi_set_freq+0x32>
mov    $0x8f0d180,%eax
xor    %edx,%edx
idiv   %edi
and    $0xffff00ff,%ecx
shl    $0x8,%eax
add    $0xff00,%eax
movzwl %ax,%eax
or     %ecx,%eax
mov    %eax,0x1e12050
ret

LLVM IR (-O0):
define void @spi_set_freq(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sdiv i32 150000000, %5
%7 = sub nsw i32 %6, 1
%8 = and i32 %7, 255
store i32 %8, i32* %3
%9 = load volatile i32, i32* inttoptr (i64 31531088 to i32*)
store i32 %9, i32* %4
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 50000000
br i1 %11, label %12, label %13
12: ; preds = %1
br label %21
13: ; preds = %1
%14 = load i32, i32* %4
%15 = and i32 %14, -65281
store i32 %15, i32* %4
%16 = load i32, i32* %3
%17 = shl i32 %16, 8
%18 = load i32, i32* %4
%19 = or i32 %18, %17
store i32 %19, i32* %4
%20 = load i32, i32* %4
store volatile i32 %20, i32* inttoptr (i64 31531088 to i32*)
br label %21
21: ; preds = %13, %12
ret void
}

LLVM IR (-O2):
define void @spi_set_freq(i32 %0) {
%2 = load volatile i32, i32* inttoptr (i64 31531088 to i32*)
%3 = icmp sgt i32 %0, 50000000
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = sdiv i32 150000000, %0
%6 = and i32 %2, -65281
%7 = shl i32 %5, 8
%8 = add i32 %7, 65280
%9 = and i32 %8, 65280
%10 = or i32 %9, %6
store volatile i32 %10, i32* inttoptr (i64 31531088 to i32*)
br label %11
11: ; preds = %1, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void print_header(void) {
  puts("# Automatically-generated file for cross-configuration of BLCR.\n"
       "# You will always need to perform at least some manual editing.\n"
       "# So, see the file \"cross_helper.c\" for instructions.\n"
       "\n"
       "# You always need to set this one manually.\n"
       "TARGET_TYPE=%MISSING%\n"
       "\n");
}


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

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

LLVM IR (-O0):
@.str = [251 x i8] c"# Automatically-generated file for cross-configuration of BLCR.\0A# You will always need to perform at least some manual editing.\0A# So, see the file \22cross_helper.c\22 for instructions.\0A\0A# You always need to set this one manually.\0ATARGET_TYPE=%MISSING%\0A\0A\00"
define void @print_header() {
%1 = call i32 @puts(i8* getelementptr inbounds ([251 x i8], [251 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [251 x i8] c"# Automatically-generated file for cross-configuration of BLCR.\0A# You will always need to perform at least some manual editing.\0A# So, see the file \22cross_helper.c\22 for instructions.\0A\0A# You always need to set this one manually.\0ATARGET_TYPE=%MISSING%\0A\0A\00"
define void @print_header() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([251 x i8], [251 x i8]* @.str, i64 0, i64 0))
ret void
}
void str_tolower(char *str) {
  for (; *str != '\0'; str++)
    if (*str >= 'A' && *str <= 'Z')
      *str = *str + 32;
}


x86 assembly (clang, -O0):
<str_tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1160 <str_tolower+0x60>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     114a <str_tolower+0x4a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     114a <str_tolower+0x4a>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    $0x20,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    114f <str_tolower+0x4f>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <str_tolower+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_tolower>:
mov    (%rdi),%al
test   %al,%al
je     112a <str_tolower+0x2a>
add    $0x1,%rdi
jmp    111b <str_tolower+0x1b>
nopl   0x0(%rax)
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     112a <str_tolower+0x2a>
lea    -0x41(%rax),%ecx
cmp    $0x19,%cl
ja     1110 <str_tolower+0x10>
add    $0x20,%al
mov    %al,-0x1(%rdi)
jmp    1110 <str_tolower+0x10>
ret

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

LLVM IR (-O2):
define void @str_tolower(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %13, %11 ], [ %2, %1 ]
%6 = phi i8* [ %12, %11 ], [ %0, %1 ]
%7 = add i8 %5, -65
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nuw nsw i8 %5, 32
store i8 %10, i8* %6
br label %11
11: ; preds = %4, %9
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %11, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
const char *hfp_subevent_calling_line_indetification_notification_get_number(
    const uint8_t *event) {
  return (const char *)&event[4];
}


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

x86 assembly (clang, -O2):
<hfp_subevent_calling_line_indetification_notification_get_number>:
lea    0x10(%rdi),%rax
ret

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

LLVM IR (-O2):
define i8* @hfp_subevent_calling_line_indetification_notification_get_number(i32* readnone %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = bitcast i32* %2 to i8*
ret i8* %3
}
unsigned long sn_readq_fast(void *addr) {
  return *(volatile unsigned long *)addr;
}


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

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

LLVM IR (-O0):
define i64 @sn_readq_fast(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i64*
%5 = load volatile i64, i64* %4
ret i64 %5
}

LLVM IR (-O2):
define i64 @sn_readq_fast(i8* %0) {
%2 = bitcast i8* %0 to i64*
%3 = load volatile i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int func1(int);
int func2(int);
int main(int argc, char **argv) { return func1(argc) + func2(argc) + 1; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <func1@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <func2@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <func1@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1040 <func2@plt>
add    %r14d,%eax
add    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = call i32 @func1(i32 %6)
%8 = load i32, i32* %4
%9 = call i32 @func2(i32 %8)
%10 = add nsw i32 %7, %9
%11 = add nsw i32 %10, 1
ret i32 %11
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @func1(i32 %0)
%4 = tail call i32 @func2(i32 %0)
%5 = add i32 %3, 1
%6 = add i32 %5, %4
ret i32 %6
}
char *_strcpy_chk(char *__dest, const char *__src) {
  return __builtin___strcpy_chk(__dest, __src,
                                __builtin_object_size(__dest, 2 > 1));
}


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

x86 assembly (clang, -O2):
<_strcpy_chk>:
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @_strcpy_chk(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %3
%8 = call i64 @llvm.objectsize.i64.p0i8(i8* %7, i1 false, i1 true, i1 false)
%9 = call i8* @__strcpy_chk(i8* %5, i8* %6, i64 %8)
ret i8* %9
}

LLVM IR (-O2):
define i8* @_strcpy_chk(i8* %0, i8* %1) {
%3 = tail call i8* @strcpy(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}
/* Variables and functions */
int linenoiseRaw(char *, int, char const *);
char *strdup(char *);
char *linenoise(const char *prompt) {
  char buf[4096];
  int count;
  count = linenoiseRaw(buf, 4096, prompt);
  if (count == -1)
    return NULL;
  return strdup(buf);
}


x86 assembly (clang, -O0):
<linenoise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x1010(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x1000,%esi
call   1030 <linenoiseRaw@plt>
mov    %eax,-0x1014(%rbp)
cmpl   $0xffffffff,-0x1014(%rbp)
jne    1164 <linenoise+0x44>
movq   $0x0,-0x8(%rbp)
jmp    1174 <linenoise+0x54>
lea    -0x1010(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linenoise>:
sub    $0x1008,%rsp
mov    %rdi,%rdx
mov    %rsp,%rdi
mov    $0x1000,%esi
call   1030 <linenoiseRaw@plt>
cmp    $0xffffffff,%eax
je     114c <linenoise+0x2c>
mov    %rsp,%rdi
call   1040 <strdup@plt>
add    $0x1008,%rsp
ret
xor    %eax,%eax
add    $0x1008,%rsp
ret

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

LLVM IR (-O2):
define noalias i8* @linenoise(i8* %0) {
%2 = alloca [4096 x i8]
%3 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%4 = call i32 @linenoiseRaw(i8* %3, i32 4096, i8* %0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i8* @strdup(i8* %3)
br label %8
8: ; preds = %1, %6
%9 = phi i8* [ %7, %6 ], [ null, %1 ]
ret i8* %9
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int vsnprintf(char *, size_t, char const *, int /*<<< orphan*/);
int zvsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
  int ret = vsnprintf((str), (size), (fmt), (ap));
  return ((ret < (int)size) ? ret : (size - 1));
}


x86 assembly (clang, -O0):
<zvsnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <vsnprintf@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    %ecx,%eax
jge    115a <zvsnprintf+0x4a>
movslq -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1166 <zvsnprintf+0x56>
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zvsnprintf>:
push   %rbx
mov    %rsi,%rbx
call   1030 <vsnprintf@plt>
lea    -0x1(%rbx),%ecx
cmp    %ebx,%eax
cmovge %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @zvsnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = load i8*, i8** %7
%13 = load i32, i32* %8
%14 = call i32 @vsnprintf(i8* %10, i64 %11, i8* %12, i32 %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = load i64, i64* %6
%17 = trunc i64 %16 to i32
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %22
19: ; preds = %4
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
br label %25
22: ; preds = %4
%23 = load i64, i64* %6
%24 = sub i64 %23, 1
br label %25
25: ; preds = %22, %19
%26 = phi i64 [ %21, %19 ], [ %24, %22 ]
%27 = trunc i64 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @zvsnprintf(i8* nocapture %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
%6 = trunc i64 %1 to i32
%7 = icmp slt i32 %5, %6
%8 = zext i32 %5 to i64
%9 = add i64 %1, 4294967295
%10 = select i1 %7, i64 %8, i64 %9
%11 = trunc i64 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ fadeScreen2(int, int, int /*<<< orphan*/, int, int);
void fadeScreen() { fadeScreen2(0xFFFFFFFF, 0x0, 0, 0x10, 0x0000); }


x86 assembly (clang, -O0):
<fadeScreen>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
xor    %r8d,%r8d
mov    $0x10,%ecx
mov    %r8d,%esi
mov    %r8d,%edx
call   1030 <fadeScreen2@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fadeScreen>:
mov    $0xffffffff,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x10,%ecx
xor    %r8d,%r8d
jmp    1030 <fadeScreen2@plt>

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

LLVM IR (-O2):
define void @fadeScreen() {
%1 = tail call i32 @fadeScreen2(i32 -1, i32 0, i32 0, i32 16, i32 0)
ret void
}
__attribute__((no, noclone)) float truncf(float x) { return x; }


x86 assembly (clang, -O0):
<truncf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @truncf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
ret float %3
}

LLVM IR (-O2):
define float @truncf(float returned %0) {
ret float %0
}
int test_imm_06uint16_reg(unsigned short val) {
  return ((val) & (0x06 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_06uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_06uint16_reg>:
test   $0x6,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_06uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 6
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Foo();
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char *buffer;
  buffer = (char *)malloc(64);
  strcpy(buffer, "abc");
  printf("%s\n", buffer);
  Foo();
  printf("returned from foo & bar.\n");
  free(buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x40,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <Foo@plt>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x40,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
lea    0xe9b(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1060 <Foo@plt>
lea    0xe81(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [26 x i8] c"returned from foo & bar.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 @malloc(i32 64)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = load i8*, i8** %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i32 (...) @Foo()
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%15 = load i8*, i8** %6
%16 = call i32 @free(i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"abc\00"
@str = [25 x i8] c"returned from foo & bar.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 64)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) %4)
%7 = tail call i32 (...) @Foo()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @free(i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ SYS_open;
int syscall(int /*<<< orphan*/, char *, int, int);
int xopen(char *path, int flags, int other) {
  return syscall((SYS_open), path, flags, other);
}


x86 assembly (clang, -O0):
<xopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xopen>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@SYS_open = global i32 0
define i32 @xopen(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* @SYS_open
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @syscall(i32 %7, i8* %8, i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
@SYS_open = global i32 0
define i32 @xopen(i8* %0, i32 %1, i32 %2) {
%4 = load i32, i32* @SYS_open
%5 = tail call i32 @syscall(i32 %4, i8* %0, i32 %1, i32 %2)
ret i32 %5
}
int foo_process(void) { return 42; }


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

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

LLVM IR (-O0):
define i32 @foo_process() {
ret i32 42
}

LLVM IR (-O2):
define i32 @foo_process() {
ret i32 42
}
/* Variables and functions */
int fn();
int main() { return 1 + fn(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <fn@plt>
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <fn@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @fn()
%3 = add nsw i32 1, %2
ret i32 %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @fn()
%2 = add nsw i32 %1, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(double *);
void deleteArray(double *array) { free(array); }


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

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

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

LLVM IR (-O2):
define void @deleteArray(double* nocapture %0) {
%2 = tail call i32 @free(double* %0)
ret void
}
/* Variables and functions */
double fabs(float);
int a(float x) { return fabs(x) >= 0.0; }


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <fabs@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
push   %rax
call   1030 <fabs@plt>
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setae  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @a(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call double @fabs(float %3)
%5 = fcmp oge double %4, 0.000000e+00
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @a(float %0) {
%2 = tail call double @fabs(float %0)
%3 = fcmp oge double %2, 0.000000e+00
%4 = zext i1 %3 to i32
ret i32 %4
}
int findRightChild(int index) { return index * 2 + 2; }


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

x86 assembly (clang, -O2):
<findRightChild>:
lea    (%rdi,%rdi,1),%eax
add    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @findRightChild(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = add nsw i32 %2, 2
ret i32 %3
}
int fun630() { return 630; }


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

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

LLVM IR (-O0):
define i32 @fun630() {
ret i32 630
}

LLVM IR (-O2):
define i32 @fun630() {
ret i32 630
}