xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void outStr(char **x) {
  if (x && (*x))
    printf("%s ", *x);
}


x86 assembly (clang, -O0):
<outStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1148 <outStr+0x38>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1148 <outStr+0x38>
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outStr>:
test   %rdi,%rdi
je     1129 <outStr+0x19>
mov    (%rdi),%rsi
test   %rsi,%rsi
je     1129 <outStr+0x19>
lea    0xedc(%rip),%rdi
jmp    1030 <printf@plt>
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s \00"
define void @outStr(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 %5, label %13
5: ; preds = %1
%6 = load i8**, i8*** %2
%7 = load i8*, i8** %6
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %13
9: ; preds = %5
%10 = load i8**, i8*** %2
%11 = load i8*, i8** %10
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %9, %5, %1
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
define void @outStr(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %8
8: ; preds = %6, %3, %1
ret void
}
fstats() {
  {};
  {};
  {};
  {};
}


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

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

LLVM IR (-O0):
define i32 @fstats() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @fstats() {
ret i32 undef
}
long int fac(int x) {
  int c;
  if (x == 1)
    c = 1;
  else
    c = fac(x - 1) * x;
  return c;
}


x86 assembly (clang, -O0):
<fac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1131 <fac+0x21>
movl   $0x1,-0x8(%rbp)
jmp    1147 <fac+0x37>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <fac@plt>
movslq -0x4(%rbp),%rcx
imul   %rcx,%rax
mov    %eax,-0x8(%rbp)
movslq -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fac>:
mov    $0x1,%eax
cmp    $0x1,%edi
je     112b <fac+0x1b>
push   %rbx
mov    %edi,%ebx
lea    -0x1(%rbx),%edi
call   1030 <fac@plt>
imul   %ebx,%eax
cltq
pop    %rbx
ret

LLVM IR (-O0):
define i64 @fac(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %3
br label %15
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 1
%10 = call i64 @fac(i32 %9)
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = mul nsw i64 %10, %12
%14 = trunc i64 %13 to i32
store i32 %14, i32* %3
br label %15
15: ; preds = %7, %6
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
ret i64 %17
}

LLVM IR (-O2):
define i64 @fac(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi i64 [ %10, %5 ], [ 1, %1 ]
ret i64 %4
5: ; preds = %1
%6 = add nsw i32 %0, -1
%7 = tail call i64 @fac(i32 %6)
%8 = trunc i64 %7 to i32
%9 = mul i32 %8, %0
%10 = sext i32 %9 to i64
br label %3
}
/* Variables and functions */
char peek_token();
int /*<<< orphan*/ shift_token();
int /*<<< orphan*/ space(char);
void ignore_spaces() {
  char c;
  for (c = peek_token(); c != -1; c = peek_token()) {
    if (!space(c))
      break;
    shift_token();
  }
}


x86 assembly (clang, -O0):
<ignore_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <peek_token@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0xffffffff,%eax
je     117c <ignore_spaces+0x4c>
movsbl -0x1(%rbp),%edi
call   1030 <space@plt>
cmp    $0x0,%eax
jne    1166 <ignore_spaces+0x36>
jmp    117c <ignore_spaces+0x4c>
mov    $0x0,%al
call   1050 <shift_token@plt>
mov    $0x0,%al
call   1040 <peek_token@plt>
mov    %al,-0x1(%rbp)
jmp    1142 <ignore_spaces+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ignore_spaces>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <peek_token@plt>
cmp    $0xff,%al
je     1160 <ignore_spaces+0x30>
movsbl %al,%edi
call   1030 <space@plt>
test   %eax,%eax
je     1160 <ignore_spaces+0x30>
xor    %eax,%eax
call   1050 <shift_token@plt>
jmp    1140 <ignore_spaces+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @ignore_spaces() {
%1 = alloca i8
%2 = call signext i8 (...) @peek_token()
store i8 %2, i8* %1
br label %3
3: ; preds = %14, %0
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = icmp ne i32 %5, -1
br i1 %6, label %7, label %16
7: ; preds = %3
%8 = load i8, i8* %1
%9 = call i32 @space(i8 signext %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7
br label %16
12: ; preds = %7
%13 = call i32 (...) @shift_token()
br label %14
14: ; preds = %12
%15 = call signext i8 (...) @peek_token()
store i8 %15, i8* %1
br label %3
16: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @ignore_spaces() {
%1 = tail call signext i8 (...) @peek_token()
%2 = icmp eq i8 %1, -1
br i1 %2, label %11, label %3
3: ; preds = %0, %7
%4 = phi i8 [ %9, %7 ], [ %1, %0 ]
%5 = tail call i32 @space(i8 signext %4)
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %3
%8 = tail call i32 (...) @shift_token()
%9 = tail call signext i8 (...) @peek_token()
%10 = icmp eq i8 %9, -1
br i1 %10, label %11, label %3
11: ; preds = %7, %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pipe(int *);
int main() {
  int pipefd[2];
  pipefd[0] = 0;
  pipefd[1] = 0;
  pipe(pipefd);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rdi
call   1030 <pipe@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32 0, i32* %3
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
store i32 0, i32* %4
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%6 = call i32 @pipe(i32* %5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [2 x i32]
%2 = bitcast [2 x i32]* %1 to i8*
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
store i32 0, i32* %3
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
store i32 0, i32* %4
%5 = call i32 @pipe(i32* %3)
ret i32 0
}
/* Variables and functions */
long add2(int);
long add1(int n) { return add2(n + 1); }


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

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

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

LLVM IR (-O2):
define i64 @add1(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = tail call i64 @add2(i32 %2)
ret i64 %3
}
void NoFreeFunction(void *value) { (void)value; }


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

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

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

LLVM IR (-O2):
define void @NoFreeFunction(i8* nocapture %0) {
ret void
}
int is_lower(char c) {
  if (c >= 'a' && c <= 'z') {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_lower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1130 <is_lower+0x30>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1130 <is_lower+0x30>
movl   $0x1,-0x4(%rbp)
jmp    1137 <is_lower+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_lower>:
add    $0x9f,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @is_lower(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %13
12: ; preds = %7, %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @is_lower(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void nativeFree(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<nativeFree>:
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):
<nativeFree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @nativeFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
void cook_buf(void *fp) {
  int prev;
  for (; (prev = (fp ? 1 : 0));) {
    if (1)
      break;
  }
}


x86 assembly (clang, -O0):
<cook_buf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     112b <cook_buf+0x2b>
jmp    112b <cook_buf+0x2b>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @cook_buf(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
br label %4
4: ; preds = %1
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 1, i32 0
store i32 %8, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %4
br label %11
11: ; preds = %10, %4
ret void
}

LLVM IR (-O2):
define void @cook_buf(i8* nocapture %0) {
ret void
}
int op_xor(int a, int b) { return a ^ b; }


x86 assembly (clang, -O0):
<op_xor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_xor>:
mov    %edi,%eax
xor    %esi,%eax
ret

LLVM IR (-O0):
define i32 @op_xor(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 = xor i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @op_xor(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
ret i32 %3
}
/* Variables and functions */
float sqrt(float);
float distance(float x1, float x2, float y1, float y2) {
  x1 = x1 - x2;
  x1 = x1 * x1;
  y1 = y1 - y2;
  y1 = y1 * y1;
  float result = sqrt(x1 + y1);
  return result;
}


x86 assembly (clang, -O0):
<distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
call   1030 <sqrt@plt>
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance>:
movaps %xmm0,%xmm4
unpcklps %xmm2,%xmm4
unpcklps %xmm3,%xmm1
subps  %xmm1,%xmm4
mulps  %xmm4,%xmm4
movaps %xmm4,%xmm0
shufps $0x55,%xmm4,%xmm0
addss  %xmm4,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1137 <distance+0x27>
sqrtss %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define float @distance(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%10 = load float, float* %5
%11 = load float, float* %6
%12 = fsub float %10, %11
store float %12, float* %5
%13 = load float, float* %5
%14 = load float, float* %5
%15 = fmul float %13, %14
store float %15, float* %5
%16 = load float, float* %7
%17 = load float, float* %8
%18 = fsub float %16, %17
store float %18, float* %7
%19 = load float, float* %7
%20 = load float, float* %7
%21 = fmul float %19, %20
store float %21, float* %7
%22 = load float, float* %5
%23 = load float, float* %7
%24 = fadd float %22, %23
%25 = call float @sqrt(float %24)
store float %25, float* %9
%26 = load float, float* %9
ret float %26
}

LLVM IR (-O2):
define float @distance(float %0, float %1, float %2, float %3) {
%5 = insertelement <2 x float> poison, float %0, i64 0
%6 = insertelement <2 x float> %5, float %2, i64 1
%7 = insertelement <2 x float> poison, float %1, i64 0
%8 = insertelement <2 x float> %7, float %3, i64 1
%9 = fsub <2 x float> %6, %8
%10 = fmul <2 x float> %9, %9
%11 = shufflevector <2 x float> %10, <2 x float> poison, <2 x i32> <i32 1, i32 undef>
%12 = fadd <2 x float> %10, %11
%13 = extractelement <2 x float> %12, i64 0
%14 = tail call float @sqrt(float %13)
ret float %14
}
int ukvm_gdb_read_last_signal(struct ukvm_hv *hv, int *signal) { return -1; }


x86 assembly (clang, -O0):
<ukvm_gdb_read_last_signal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ukvm_hv = type opaque
define i32 @ukvm_gdb_read_last_signal(%struct.ukvm_hv* %0, i32* %1) {
%3 = alloca %struct.ukvm_hv*
%4 = alloca i32*
store %struct.ukvm_hv* %0, %struct.ukvm_hv** %3
store i32* %1, i32** %4
ret i32 -1
}

LLVM IR (-O2):
%struct.ukvm_hv = type opaque
define i32 @ukvm_gdb_read_last_signal(%struct.ukvm_hv* nocapture readnone %0, i32* nocapture readnone %1) {
ret i32 -1
}
/* Variables and functions */
int NArrayExists(const void **restrict Tbl, const void *restrict Ptr) {
  for (int i = 0; Tbl[i] != NULL; ++i) {
    if (Tbl[i] == Ptr)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<NArrayExists>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     115b <NArrayExists+0x5b>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x18(%rbp),%rax
jne    1148 <NArrayExists+0x48>
movl   $0x1,-0x4(%rbp)
jmp    1162 <NArrayExists+0x62>
jmp    114d <NArrayExists+0x4d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1113 <NArrayExists+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NArrayExists>:
mov    (%rdi),%rcx
test   %rcx,%rcx
je     1111 <NArrayExists+0x11>
add    $0x8,%rdi
cmp    %rsi,%rcx
jne    1100 <NArrayExists>
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
ret

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

LLVM IR (-O2):
define i32 @NArrayExists(i8** noalias nocapture %0, i8* noalias readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %10, %3 ], [ 0, %2 ]
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
%8 = icmp eq i8* %6, %1
%9 = or i1 %7, %8
%10 = add nuw i64 %4, 1
br i1 %9, label %11, label %3
11: ; preds = %3
%12 = xor i1 %7, true
%13 = zext i1 %12 to i32
ret i32 %13
}
float __fdiv_rn(float x, float y) { return x / y; }


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

x86 assembly (clang, -O2):
<__fdiv_rn>:
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @__fdiv_rn(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fdiv float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @__fdiv_rn(float %0, float %1) {
%3 = fdiv float %0, %1
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ excessiveprologue();
int main(void) {
  excessiveprologue();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @excessiveprologue()
ret i32 0
}
__attribute__((always_)) float distance_comp(float cx, float cy, float x,
                                             float y) {
  float d = (cx - x) * (cx - x) + (cy - y) * (cy - y);
  int d2 = 0x1fbd1df5 + ((*(int *)&d) >> 1);
  return *(float *)&d2;
}


x86 assembly (clang, -O0):
<distance_comp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
subss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
movss  -0x8(%rbp),%xmm3
subss  -0x10(%rbp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x1,%eax
add    $0x1fbd1df5,%eax
mov    %eax,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance_comp>:
subss  %xmm2,%xmm0
subss  %xmm3,%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movd   %xmm0,%eax
sar    %eax
add    $0x1fbd1df5,%eax
movd   %eax,%xmm0
ret

LLVM IR (-O0):
define float @distance_comp(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%11 = load float, float* %5
%12 = load float, float* %7
%13 = fsub float %11, %12
%14 = load float, float* %5
%15 = load float, float* %7
%16 = fsub float %14, %15
%17 = load float, float* %6
%18 = load float, float* %8
%19 = fsub float %17, %18
%20 = load float, float* %6
%21 = load float, float* %8
%22 = fsub float %20, %21
%23 = fmul float %19, %22
%24 = call float @llvm.fmuladd.f32(float %13, float %16, float %23)
store float %24, float* %9
%25 = bitcast float* %9 to i32*
%26 = load i32, i32* %25
%27 = ashr i32 %26, 1
%28 = add nsw i32 532487669, %27
store i32 %28, i32* %10
%29 = bitcast i32* %10 to float*
%30 = load float, float* %29
ret float %30
}

LLVM IR (-O2):
define float @distance_comp(float %0, float %1, float %2, float %3) {
%5 = fsub float %0, %2
%6 = fsub float %1, %3
%7 = fmul float %6, %6
%8 = tail call float @llvm.fmuladd.f32(float %5, float %5, float %7)
%9 = bitcast float %8 to i32
%10 = ashr i32 %9, 1
%11 = add nsw i32 %10, 532487669
%12 = bitcast i32 %11 to float
ret float %12
}
/* Variables and functions */
float UINT64_MAX;
scalar_t__ xorshift128plus();
float next(void) { return (float)xorshift128plus() / UINT64_MAX; }


x86 assembly (clang, -O0):
<next>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <xorshift128plus@plt>
cvtsi2ss %rax,%xmm0
mov    0x2eb1(%rip),%rax
divss  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<next>:
push   %rax
xor    %eax,%eax
call   1030 <xorshift128plus@plt>
cvtsi2ss %rax,%xmm0
mov    0x2eb4(%rip),%rax
divss  (%rax),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@UINT64_MAX = global float 0.000000e+00
define float @next() {
%1 = call i64 (...) @xorshift128plus()
%2 = sitofp i64 %1 to float
%3 = load float, float* @UINT64_MAX
%4 = fdiv float %2, %3
ret float %4
}

LLVM IR (-O2):
@UINT64_MAX = global float 0.000000e+00
define float @next() {
%1 = tail call i64 (...) @xorshift128plus()
%2 = sitofp i64 %1 to float
%3 = load float, float* @UINT64_MAX
%4 = fdiv float %2, %3
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ bar();
int baz(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ foo();
int main() { return baz(foo(), bar()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <foo@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <bar@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1030 <baz@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <foo@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <bar@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1030 <baz@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @bar()
%3 = tail call i32 @baz(i32 %1, i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ft_putendl(char *);
int /*<<< orphan*/ ft_putstr(char *);
int /*<<< orphan*/ ft_strdel(char **);
char *ft_uitoh(unsigned long long, unsigned int, unsigned int);
void ft_putnbr_base(unsigned long long int n, unsigned int base,
                    unsigned int pad) {
  char *str;
  if (!(str = ft_uitoh(n, base, pad))) {
    ft_putendl("malloc error");
    return;
  }
  ft_putstr(str);
  ft_strdel(&str);
  return;
}


x86 assembly (clang, -O0):
<ft_putnbr_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <ft_uitoh@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1180 <ft_putnbr_base+0x40>
lea    0xe8a(%rip),%rdi
call   1030 <ft_putendl@plt>
jmp    1192 <ft_putnbr_base+0x52>
mov    -0x18(%rbp),%rdi
call   1060 <ft_putstr@plt>
lea    -0x18(%rbp),%rdi
call   1050 <ft_strdel@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr_base>:
push   %rax
call   1040 <ft_uitoh@plt>
mov    %rax,(%rsp)
test   %rax,%rax
je     1161 <ft_putnbr_base+0x21>
mov    %rax,%rdi
call   1060 <ft_putstr@plt>
mov    %rsp,%rdi
call   1050 <ft_strdel@plt>
pop    %rax
ret
lea    0xe98(%rip),%rdi
pop    %rax
jmp    1030 <ft_putendl@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"malloc error\00"
define void @ft_putnbr_base(i64 %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i64, i64* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i8* @ft_uitoh(i64 %8, i32 %9, i32 %10)
store i8* %11, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %3
%14 = call i32 @ft_putendl(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %19
15: ; preds = %3
%16 = load i8*, i8** %7
%17 = call i32 @ft_putstr(i8* %16)
%18 = call i32 @ft_strdel(i8** %7)
br label %19
19: ; preds = %15, %13
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"malloc error\00"
define void @ft_putnbr_base(i64 %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = tail call i8* @ft_uitoh(i64 %0, i32 %1, i32 %2)
store i8* %6, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 @ft_putendl(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %13
10: ; preds = %3
%11 = tail call i32 @ft_putstr(i8* %6)
%12 = call i32 @ft_strdel(i8** %4)
br label %13
13: ; preds = %10, %8
ret void
}
long double sqrtl(long double x) {
  long double r;
  if (x < 0)
    return __domain_error();
  __asm__ __volatile__("fsqrt" : "=t"(r) : "0"(x));
  return r;
}


x86 assembly (clang, -O0):
<sqrtl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jbe    1147 <sqrtl+0x37>
jmp    1132 <sqrtl+0x22>
xor    %eax,%eax
call   1030 <__domain_error@plt>
mov    %eax,-0x34(%rbp)
fildl  -0x34(%rbp)
fstpt  -0x10(%rbp)
jmp    1155 <sqrtl+0x45>
fldt   -0x20(%rbp)
fsqrt
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sqrtl>:
push   %rax
fldt   0x10(%rsp)
fldz
fucomip %st(1),%st
jbe    112e <sqrtl+0x1e>
fstp   %st(0)
xor    %eax,%eax
call   1030 <__domain_error@plt>
mov    %eax,0x4(%rsp)
fildl  0x4(%rsp)
pop    %rax
ret
fsqrt
pop    %rax
ret

LLVM IR (-O0):
define x86_fp80 @sqrtl(x86_fp80 %0) {
%2 = alloca x86_fp80
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
%5 = load x86_fp80, x86_fp80* %3
%6 = fcmp olt x86_fp80 %5, 0xK00000000000000000000
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 (...) @__domain_error()
%9 = sitofp i32 %8 to x86_fp80
store x86_fp80 %9, x86_fp80* %2
br label %14
10: ; preds = %1
%11 = load x86_fp80, x86_fp80* %3
%12 = call x86_fp80 asm sideeffect "fsqrt", "={st},0,~{dirflag},~{fpsr},~{flags}"(x86_fp80 %11)
store x86_fp80 %12, x86_fp80* %4
%13 = load x86_fp80, x86_fp80* %4
store x86_fp80 %13, x86_fp80* %2
br label %14
14: ; preds = %10, %7
%15 = load x86_fp80, x86_fp80* %2
ret x86_fp80 %15
}

LLVM IR (-O2):
define x86_fp80 @sqrtl(x86_fp80 %0) {
%2 = fcmp olt x86_fp80 %0, 0xK00000000000000000000
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 (...) @__domain_error()
%5 = sitofp i32 %4 to x86_fp80
br label %8
6: ; preds = %1
%7 = tail call x86_fp80 asm sideeffect "fsqrt", "={st},0,~{dirflag},~{fpsr},~{flags}"(x86_fp80 %0)
br label %8
8: ; preds = %6, %3
%9 = phi x86_fp80 [ %5, %3 ], [ %7, %6 ]
ret x86_fp80 %9
}
/* Variables and functions */
int **malloc(int);
void myArrayAllocation() {
  int **A;
  A = malloc(2 * sizeof(int *));
  A[0] = 0;
}


x86 assembly (clang, -O0):
<myArrayAllocation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myArrayAllocation>:
mov    $0x10,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define void @myArrayAllocation() {
%1 = alloca i32**
%2 = call i32** @malloc(i32 16)
store i32** %2, i32*** %1
%3 = load i32**, i32*** %1
%4 = getelementptr inbounds i32*, i32** %3, i64 0
store i32* null, i32** %4
ret void
}

LLVM IR (-O2):
define void @myArrayAllocation() {
%1 = tail call i32** @malloc(i32 16)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIGABRT;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void gen_signal() {
  kill(getpid(), SIGABRT);
  printf("no signal\n");
}


x86 assembly (clang, -O0):
<gen_signal>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2e9c(%rip),%rax
mov    (%rax),%esi
call   1050 <kill@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_signal>:
push   %rax
xor    %eax,%eax
call   1040 <getpid@plt>
mov    0x2ea1(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1050 <kill@plt>
lea    0xeb1(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@SIGABRT = global i32 0
@.str = [11 x i8] c"no signal\0A\00"
define void @gen_signal() {
%1 = call i32 (...) @getpid()
%2 = load i32, i32* @SIGABRT
%3 = call i32 @kill(i32 %1, i32 %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SIGABRT = global i32 0
@str = [10 x i8] c"no signal\00"
define void @gen_signal() {
%1 = tail call i32 (...) @getpid()
%2 = load i32, i32* @SIGABRT
%3 = tail call i32 @kill(i32 %1, i32 %2)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ printf(char *, int);
scalar_t__ read(int /*<<< orphan*/, char *, int);
int toupper(char);
int main(int argc, const char *argv[]) {
  char ch;
  while (read(STDIN_FILENO, &ch, 1) > 0) {
    printf("%c", toupper(ch));
  }
}


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    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
call   1050 <read@plt>
cmp    $0x0,%rax
jle    1183 <main+0x53>
movsbl -0x11(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,%esi
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
jmp    1146 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2ea0(%rip),%r15
mov    (%r15),%edi
lea    0xf(%rsp),%rsi
mov    $0x1,%edx
call   1050 <read@plt>
test   %rax,%rax
jle    1199 <main+0x69>
lea    0xea2(%rip),%r14
lea    0xf(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl 0xf(%rsp),%edi
call   1030 <toupper@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    (%r15),%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <read@plt>
test   %rax,%rax
jg     1170 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@.str = [3 x i8] c"%c\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
br label %7
7: ; preds = %11, %2
%8 = load i32, i32* @STDIN_FILENO
%9 = call i64 @read(i32 %8, i8* %6, i32 1)
%10 = icmp sgt i64 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %6
%13 = call i32 @toupper(i8 signext %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %7
15: ; preds = %7
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@.str = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = load i32, i32* @STDIN_FILENO
%5 = call i64 @read(i32 %4, i8* %3, i32 1)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2, %7
%8 = load i8, i8* %3
%9 = tail call i32 @toupper(i8 signext %8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* @STDIN_FILENO
%12 = call i64 @read(i32 %11, i8* %3, i32 1)
%13 = icmp sgt i64 %12, 0
br i1 %13, label %7, label %14
14: ; preds = %7, %2
ret i32 0
}
/* Variables and functions */
int PunctCount(char *);
int /*<<< orphan*/ ToUpper(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
int main(void) {
  char line[80];
  puts("Please enter a line: ");
  gets(line);
  ToUpper(line);
  puts(line);
  printf("That line has %d punctuation characters.\n", PunctCount(line));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
lea    -0x60(%rbp),%rdi
call   1070 <gets@plt>
lea    -0x60(%rbp),%rdi
call   1060 <ToUpper@plt>
lea    -0x60(%rbp),%rdi
call   1040 <puts@plt>
lea    -0x60(%rbp),%rdi
call   1030 <PunctCount@plt>
mov    %eax,%esi
lea    0xe7e(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xea4(%rip),%rdi
call   1040 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <gets@plt>
mov    %rbx,%rdi
call   1060 <ToUpper@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <PunctCount@plt>
lea    0xe8b(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Please enter a line: \00"
@.str.1 = [42 x i8] c"That line has %d punctuation characters.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%7 = call i32 @ToUpper(i8* %6)
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%9 = call i32 @puts(i8* %8)
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%11 = call i32 @PunctCount(i8* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Please enter a line: \00"
@.str.1 = [42 x i8] c"That line has %d punctuation characters.\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @ToUpper(i8* %2)
%6 = call i32 @puts(i8* %2)
%7 = call i32 @PunctCount(i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int inotify_init();
int __inotify_open(void) { return inotify_init(); }


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

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

LLVM IR (-O0):
define i32 @__inotify_open() {
%1 = call i32 (...) @inotify_init()
ret i32 %1
}

LLVM IR (-O2):
define i32 @__inotify_open() {
%1 = tail call i32 (...) @inotify_init()
ret i32 %1
}
void g_generic_dummy(void *s, void *d, void *o) {}


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

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

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

LLVM IR (-O2):
define void @g_generic_dummy(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2) {
ret void
}
void init_sound(void) {}


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

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

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

LLVM IR (-O2):
define void @init_sound() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int);
int main(int argc, char *argv[]) {
  int limit;
  printf("List primes until: ");
  scanf("%d", limit);
  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)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xec8(%rip),%rdi
call   1040 <scanf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [20 x i8] c"List primes until: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 undef)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char const *, ...);
int /*<<< orphan*/ stdout;
void fmtst1chk(const char *fmt) {
  (void)fputs(fmt, stdout);
  (void)printf(":\t`");
  (void)printf(fmt, 4, 0x12);
  (void)printf("'\n");
}


x86 assembly (clang, -O0):
<fmtst1chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
mov    $0x12,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmtst1chk>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ea5(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
lea    0xeb7(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x12,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c":\09`\00"
@.str.1 = [3 x i8] c"'\0A\00"
define void @fmtst1chk(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stdout
%5 = call i32 @fputs(i8* %3, i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = load i8*, i8** %2
%8 = call i32 (i8*, ...) @printf(i8* %7, i32 4, i32 18)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c":\09`\00"
@str = [2 x i8] c"'\00"
define void @fmtst1chk(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fputs(i8* %0, i32 %2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %0, i32 4, i32 18)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *mystrdup(char *s) {
  char *x;
  if (s) {
    x = malloc(strlen(s) + 1);
    strcpy(x, s);
    return x;
  }
  return s;
}


x86 assembly (clang, -O0):
<mystrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117a <mystrdup+0x4a>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1182 <mystrdup+0x52>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrdup>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115a <mystrdup+0x2a>
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
jmp    115d <mystrdup+0x2d>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @mystrdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = add nsw i64 %4, 1
%6 = tail call i8* @malloc(i64 %5)
%7 = tail call i32 @strcpy(i8* %6, i8* %0)
br label %8
8: ; preds = %1, %3
%9 = phi i8* [ %6, %3 ], [ null, %1 ]
ret i8* %9
}
int test_imm_D6uint16_reg(unsigned short val) {
  return ((val) & (-0xD6 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_D6uint16_reg>:
test   $0xff2a,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_D6uint16_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, -214
%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_D6uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -214
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
char *strptime(char const *, char const *, struct tm *);
char *octave_strptime_wrapper(const char *p, const char *fmt, struct tm *t) {
  return strptime(p, fmt, t);
}


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

x86 assembly (clang, -O2):
<octave_strptime_wrapper>:
jmp    1030 <strptime@plt>

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

LLVM IR (-O2):
%struct.tm = type { i32 }
define i8* @octave_strptime_wrapper(i8* %0, i8* %1, %struct.tm* %2) {
%4 = tail call i8* @strptime(i8* %0, i8* %1, %struct.tm* %2)
ret i8* %4
}
/* Variables and functions */
long _test_and_set(int *, int);
extern long int testandset(int *spinlock) { return _test_and_set(spinlock, 1); }


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

x86 assembly (clang, -O2):
<testandset>:
mov    $0x1,%esi
jmp    1030 <_test_and_set@plt>

LLVM IR (-O0):
define i64 @testandset(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i64 @_test_and_set(i32* %3, i32 1)
ret i64 %4
}

LLVM IR (-O2):
define i64 @testandset(i32* %0) {
%2 = tail call i64 @_test_and_set(i32* %0, i32 1)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int stub1(int, int);
int stub2(int, int);
void print_expression(int (*function)(int, int), int x, int y) {
  printf("%d\n", (*function)(x, y));
}


x86 assembly (clang, -O0):
<print_expression>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   *%rax
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_expression>:
push   %rax
mov    %rdi,%rax
mov    %esi,%edi
mov    %edx,%esi
call   *%rax
lea    0xedf(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @print_expression(i32 (i32, i32)* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 %0(i32 %1, i32 %2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
int test_imm_F8int8_mem(signed char *val) {
  return ((*val) & (0xF8 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_F8int8_mem>:
cmpb   $0x8,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_F8int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp ult i8 %2, 8
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void RTPathExt(void) {}


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

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

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

LLVM IR (-O2):
define void @RTPathExt() {
ret void
}