xunge/DecIR huggingface dataset:
/* Variables and functions */
int *get_random_arr(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ shell_sort(int *, int);
int /*<<< orphan*/ show(int *, int);
int main() {
  int len = 25;
  int *arr = get_random_arr(len);
  printf("ori\n");
  show(arr, len);
  shell_sort(arr, len);
  printf("sorted\n");
  show(arr, len);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x19,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <get_random_arr@plt>
mov    %rax,-0x10(%rbp)
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <show@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1060 <shell_sort@plt>
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <show@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x19,%edi
call   1040 <get_random_arr@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
call   1050 <show@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
call   1060 <shell_sort@plt>
lea    0xe89(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    $0x19,%esi
call   1050 <show@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@str = [4 x i8] c"ori\00"
@str.2 = [7 x i8] c"sorted\00"
define i32 @main() {
%1 = tail call i32* @get_random_arr(i32 25)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @show(i32* %1, i32 25)
%4 = tail call i32 @shell_sort(i32* %1, i32 25)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.2, i64 0, i64 0))
%6 = tail call i32 @show(i32* %1, i32 25)
ret i32 0
}
A0RX1(r0, r1, x0, x1, p0, p1) double r0, r1;
double *p0, *p1;
{
  if ((*((double *)10000000)) <= (p1[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<A0RX1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
mov    %esi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    $0x989680,%eax
movsd  (%rax),%xmm1
mov    -0x30(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jb     1148 <A0RX1+0x48>
movl   $0x1,-0x4(%rbp)
jmp    114f <A0RX1+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<A0RX1>:
movslq %esi,%rax
movsd  (%rcx,%rax,8),%xmm0
xor    %eax,%eax
ucomisd 0x989680,%xmm0
setae  %al
ret

LLVM IR (-O0):
define i32 @A0RX1(double %0, double %1, i32 %2, i32 %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double*
%13 = alloca double*
store double %0, double* %8
store double %1, double* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store double* %4, double** %12
store double* %5, double** %13
%14 = load double, double* inttoptr (i64 10000000 to double*)
%15 = load double*, double** %13
%16 = load i32, i32* %11
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
%19 = load double, double* %18
%20 = fcmp ole double %14, %19
br i1 %20, label %21, label %22
21: ; preds = %6
store i32 1, i32* %7
br label %23
22: ; preds = %6
store i32 0, i32* %7
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %7
ret i32 %24
}

LLVM IR (-O2):
define i32 @A0RX1(double %0, double %1, i32 %2, i32 %3, double* nocapture readnone %4, double* nocapture %5) {
%7 = load double, double* inttoptr (i64 10000000 to double*)
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds double, double* %5, i64 %8
%10 = load double, double* %9
%11 = fcmp ole double %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ kdAssert(int, char const *);
void kdAssertIntEquals(const int expected, const int actual,
                       const char *message) {
  kdAssert(expected == actual, message);
}


x86 assembly (clang, -O0):
<kdAssertIntEquals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    -0x10(%rbp),%rsi
call   1030 <kdAssert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kdAssertIntEquals>:
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
mov    %eax,%edi
mov    %rdx,%rsi
jmp    1030 <kdAssert@plt>

LLVM IR (-O0):
define void @kdAssertIntEquals(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp eq i32 %7, %8
%10 = zext i1 %9 to i32
%11 = load i8*, i8** %6
%12 = call i32 @kdAssert(i32 %10, i8* %11)
ret void
}

LLVM IR (-O2):
define void @kdAssertIntEquals(i32 %0, i32 %1, i8* %2) {
%4 = icmp eq i32 %0, %1
%5 = zext i1 %4 to i32
%6 = tail call i32 @kdAssert(i32 %5, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __NR_pkey_alloc;
int syscall(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  int ret;
  ret = syscall(__NR_pkey_alloc, 0, 0);
  (void)ret;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <syscall@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <syscall@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@__NR_pkey_alloc = global i32 0
define i32 @main() {
%1 = load i32, i32* @__NR_pkey_alloc
%2 = tail call i32 @syscall(i32 %1, i32 0, i32 0)
ret i32 0
}
void pollen_event_Dispatcher_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @pollen_event_Dispatcher_targetInit__I() {
ret void
}
const char *strcpy(char *dest, const char *src) {
  const char *saved = dest;
  while (*src) {
    *dest = *src;
    src++;
    dest++;
  }
  *dest = '\0';
  return saved;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114a <strcpy+0x4a>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <strcpy+0x14>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %rdi,%rdx
test   %cl,%cl
je     1131 <strcpy+0x31>
add    $0x1,%rsi
mov    %rax,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %cl,(%rdx)
add    $0x1,%rdx
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1120 <strcpy+0x20>
movb   $0x0,(%rdx)
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %1, %2 ]
store i8 %6, i8* %7
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ test_cs_aspx_comments();
void all_cs_aspx_tests() { test_cs_aspx_comments(); }


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

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

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

LLVM IR (-O2):
define void @all_cs_aspx_tests() {
%1 = tail call i32 (...) @test_cs_aspx_comments()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ldcmp(int, int);
int /*<<< orphan*/ ldfcast(double);
int /*<<< orphan*/ printf(char *, char *);
void ldtest(void) {
  printf("testing '%s'\n", "long double");
  ldcmp(1, 2.5);
  ldcmp(2, 1.5);
  ldcmp(1, 1);
  ldfcast(234.6);
  ldfcast(-2334.6);
}


x86 assembly (clang, -O0):
<ldtest>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xedc(%rip),%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <ldcmp@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1030 <ldcmp@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <ldcmp@plt>
movsd  0xe8f(%rip),%xmm0
call   1050 <ldfcast@plt>
movsd  0xe7a(%rip),%xmm0
call   1050 <ldfcast@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldtest>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <ldcmp@plt>
mov    $0x2,%edi
mov    $0x1,%esi
call   1030 <ldcmp@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <ldcmp@plt>
movsd  0xe87(%rip),%xmm0
call   1050 <ldfcast@plt>
movsd  0xe82(%rip),%xmm0
pop    %rax
jmp    1050 <ldfcast@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"testing '%s'\0A\00"
@.str.1 = [12 x i8] c"long double\00"
define void @ldtest() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @ldcmp(i32 1, i32 2)
%3 = call i32 @ldcmp(i32 2, i32 1)
%4 = call i32 @ldcmp(i32 1, i32 1)
%5 = call i32 @ldfcast(double 2.346000e+02)
%6 = call i32 @ldfcast(double -2.334600e+03)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"testing '%s'\0A\00"
@.str.1 = [12 x i8] c"long double\00"
define void @ldtest() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @ldcmp(i32 1, i32 2)
%3 = tail call i32 @ldcmp(i32 2, i32 1)
%4 = tail call i32 @ldcmp(i32 1, i32 1)
%5 = tail call i32 @ldfcast(double 2.346000e+02)
%6 = tail call i32 @ldfcast(double -2.334600e+03)
ret void
}
int two_log(nr)
register int nr;
{
  register int log;
  for (log = 0; nr >= 2; nr >>= 1)
    log++;
  return (log);
}


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

x86 assembly (clang, -O2):
<two_log>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     111c <two_log+0x1c>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
shr    %ecx
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <two_log+0x10>
ret

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

LLVM IR (-O2):
define i32 @two_log(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = lshr i32 %5, 1
%8 = icmp ugt i32 %5, 3
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ iscntrl(int);
void t_iscntrl_0x76() {
  Assert_real((iscntrl(118) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_iscntrl.c",
              595, ("iscntrl should be 0 for v"));
}


x86 assembly (clang, -O0):
<t_iscntrl_0x76>:
push   %rbp
mov    %rsp,%rbp
mov    $0x76,%edi
call   1030 <iscntrl@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x253,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_iscntrl_0x76>:
push   %rax
mov    $0x76,%edi
call   1030 <iscntrl@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x253,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [26 x i8] c"iscntrl should be 0 for v\00"
define void @t_iscntrl_0x76() {
%1 = call i64 @iscntrl(i32 118)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 595, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [26 x i8] c"iscntrl should be 0 for v\00"
define void @t_iscntrl_0x76() {
%1 = tail call i64 @iscntrl(i32 118)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 595, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, char *);
void test3(void) {
  float f = -0.1;
  unsigned int *ui = (unsigned int *)&f;
  printf("%f is lower than 0? -> %s\n", f,
         (*ui & 0x80000000) ? "true" : "false");
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xee0(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
and    $0x80000000,%ecx
lea    0xedf(%rip),%rsi
lea    0xed3(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
lea    0xeed(%rip),%rdi
lea    0xf01(%rip),%rsi
movss  0xeda(%rip),%xmm0
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"%f is lower than 0? -> %s\0A\00"
@.str.1 = [5 x i8] c"true\00"
@.str.2 = [6 x i8] c"false\00"
define void @test3() {
%1 = alloca float
%2 = alloca i32*
store float 0xBFB99999A0000000, float* %1
%3 = bitcast float* %1 to i32*
store i32* %3, i32** %2
%4 = load float, float* %1
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = and i32 %6, -2147483648
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), float %4, i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"%f is lower than 0? -> %s\0A\00"
@.str.1 = [5 x i8] c"true\00"
define void @test3() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), float 0xBFB99999A0000000, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SHUT_RDWR;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ shutdown(int, int /*<<< orphan*/);
int closeSock(int sockFd) {
  shutdown(sockFd, SHUT_RDWR);
  close(sockFd);
  return 1;
}


x86 assembly (clang, -O0):
<closeSock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeSock>:
push   %rbx
mov    %edi,%ebx
mov    0x2ec6(%rip),%rax
mov    (%rax),%esi
call   1030 <shutdown@plt>
mov    %ebx,%edi
call   1040 <close@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@SHUT_RDWR = global i32 0
define i32 @closeSock(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SHUT_RDWR
%5 = call i32 @shutdown(i32 %3, i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @close(i32 %6)
ret i32 1
}

LLVM IR (-O2):
@SHUT_RDWR = global i32 0
define i32 @closeSock(i32 %0) {
%2 = load i32, i32* @SHUT_RDWR
%3 = tail call i32 @shutdown(i32 %0, i32 %2)
%4 = tail call i32 @close(i32 %0)
ret i32 1
}
/* Type definitions */
struct Num {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printElt(struct Num *, int /*<<< orphan*/);
void printNumber(void *E) { printElt((struct Num *)E, 0); }


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

x86 assembly (clang, -O2):
<printNumber>:
xor    %esi,%esi
jmp    1030 <printElt@plt>

LLVM IR (-O0):
%struct.Num = type { i32 }
define void @printNumber(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.Num*
%5 = call i32 @printElt(%struct.Num* %4, i32 0)
ret void
}

LLVM IR (-O2):
%struct.Num = type { i32 }
define void @printNumber(i8* %0) {
%2 = bitcast i8* %0 to %struct.Num*
%3 = tail call i32 @printElt(%struct.Num* %2, i32 0)
ret void
}
c_closer__(fd) int *fd;
{ return (close(*fd)); }


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

x86 assembly (clang, -O2):
<c_closer__>:
mov    (%rdi),%edi
xor    %eax,%eax
jmp    1030 <close@plt>

LLVM IR (-O0):
define i32 @c_closer__(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @c_closer__(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @close to i32 (i32, ...)*)(i32 %2)
ret i32 %3
}
unsigned long long v_unsigned_long_long_func() { return (0); }


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

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

LLVM IR (-O0):
define i64 @v_unsigned_long_long_func() {
ret i64 0
}

LLVM IR (-O2):
define i64 @v_unsigned_long_long_func() {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ LcdHardware_Init();
int /*<<< orphan*/ LcdModel_Init();
void LcdConductor_Init() {
  LcdModel_Init();
  LcdHardware_Init();
}


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

x86 assembly (clang, -O2):
<LcdConductor_Init>:
push   %rax
xor    %eax,%eax
call   1030 <LcdModel_Init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <LcdHardware_Init@plt>

LLVM IR (-O0):
define void @LcdConductor_Init() {
%1 = call i32 (...) @LcdModel_Init()
%2 = call i32 (...) @LcdHardware_Init()
ret void
}

LLVM IR (-O2):
define void @LcdConductor_Init() {
%1 = tail call i32 (...) @LcdModel_Init()
%2 = tail call i32 (...) @LcdHardware_Init()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *PrintHello(void *threadid) {
  long tid;
  tid = (long)threadid;
  printf("Hello World! It's me, thread #%ld!\n", tid);
  pthread_exit(NULL);
}


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"Hello World! It's me, thread #%ld!\0A\00"
define i8* @PrintHello(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = call i32 @pthread_exit(i32* null)
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [36 x i8] c"Hello World! It's me, thread #%ld!\0A\00"
define noalias i8* @PrintHello(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void Copyright(void) {
  fprintf(
      stderr,
      "===================================================================\n"
      " TS 26.104                                                         \n"
      " R99   V3.4.0 2002-02                                              \n"
      " REL-4 V4.3.0 2002-02                                              \n"
      " 3GPP AMR Floating-point Speech Decoder                            \n"
      "===================================================================\n");
}


x86 assembly (clang, -O0):
<Copyright>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Copyright>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [409 x i8] c"===================================================================\0A TS 26.104 \0A R99 V3.4.0 2002-02 \0A REL-4 V4.3.0 2002-02 \0A 3GPP AMR Floating-point Speech Decoder \0A===================================================================\0A\00"
define void @Copyright() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([409 x i8], [409 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [409 x i8] c"===================================================================\0A TS 26.104 \0A R99 V3.4.0 2002-02 \0A REL-4 V4.3.0 2002-02 \0A 3GPP AMR Floating-point Speech Decoder \0A===================================================================\0A\00"
define void @Copyright() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([409 x i8], [409 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void safealign_memcpy(void *dest, const void *src, size_t n, size_t *counter) {
  memcpy(dest, src, n);
  if (counter) {
    *counter += n;
  }
}


x86 assembly (clang, -O0):
<safealign_memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
cmpq   $0x0,-0x20(%rbp)
je     1152 <safealign_memcpy+0x42>
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safealign_memcpy>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
call   1030 <memcpy@plt>
test   %r14,%r14
je     1127 <safealign_memcpy+0x17>
add    %rbx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @safealign_memcpy(i8* %0, i8* %1, i64 %2, i64* %3) {
%5 = tail call i32 @memcpy(i8* %0, i8* %1, i64 %2)
%6 = icmp eq i64* %3, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = load i64, i64* %3
%9 = add i64 %8, %2
store i64 %9, i64* %3
br label %10
10: ; preds = %7, %4
ret void
}
OP(dd, ed) { op_ed(); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <op_ed@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_ed()
ret i32 undef
}
int ft_sqrt(int nb) {
  int a;
  a = 0;
  if (nb < 0)
    return (0);
  else {
    while (a * a < nb) {
      a++;
    }
    if (a * a == nb)
      return (a);
    else
      return (0);
  }
}


x86 assembly (clang, -O0):
<ft_sqrt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1124 <ft_sqrt+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1169 <ft_sqrt+0x69>
jmp    1129 <ft_sqrt+0x29>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1147 <ft_sqrt+0x47>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <ft_sqrt+0x29>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1162 <ft_sqrt+0x62>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <ft_sqrt+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_sqrt>:
test   %edi,%edi
js     1124 <ft_sqrt+0x24>
mov    $0xffffffff,%ecx
nopl   0x0(%rax)
add    $0x1,%ecx
mov    %ecx,%edx
imul   %ecx,%edx
cmp    %edi,%edx
jl     1110 <ft_sqrt+0x10>
xor    %eax,%eax
cmp    %edi,%edx
cmove  %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_sqrt(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = mul nsw i32 %4, %4
%6 = icmp slt i32 %5, %0
%7 = add nuw nsw i32 %4, 1
br i1 %6, label %3, label %8
8: ; preds = %3
%9 = icmp eq i32 %5, %0
%10 = select i1 %9, i32 %4, i32 0
br label %11
11: ; preds = %8, %1
%12 = phi i32 [ 0, %1 ], [ %10, %8 ]
ret i32 %12
}
float flt_neg_mul_sub(float a, float b, float c) { return (-(a * b)) - c; }


x86 assembly (clang, -O0):
<flt_neg_mul_sub>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
subss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<flt_neg_mul_sub>:
xorps  0xef9(%rip),%xmm0
mulss  %xmm1,%xmm0
subss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @flt_neg_mul_sub(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fmul float %7, %8
%10 = fneg float %9
%11 = load float, float* %6
%12 = fsub float %10, %11
ret float %12
}

LLVM IR (-O2):
define float @flt_neg_mul_sub(float %0, float %1, float %2) {
%4 = fneg float %0
%5 = fmul float %4, %1
%6 = fsub float %5, %2
ret float %6
}
double funct(double a, float x, double b, int i) { return a * x - b / i; }


x86 assembly (clang, -O0):
<funct>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %edi,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm2
movsd  -0x18(%rbp),%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm3
divsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<funct>:
cvtsi2sd %edi,%xmm3
cvtss2sd %xmm1,%xmm1
divsd  %xmm3,%xmm2
mulsd  %xmm1,%xmm0
subsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @funct(double %0, float %1, double %2, i32 %3) {
%5 = alloca double
%6 = alloca float
%7 = alloca double
%8 = alloca i32
store double %0, double* %5
store float %1, float* %6
store double %2, double* %7
store i32 %3, i32* %8
%9 = load double, double* %5
%10 = load float, float* %6
%11 = fpext float %10 to double
%12 = load double, double* %7
%13 = load i32, i32* %8
%14 = sitofp i32 %13 to double
%15 = fdiv double %12, %14
%16 = fneg double %15
%17 = call double @llvm.fmuladd.f64(double %9, double %11, double %16)
ret double %17
}

LLVM IR (-O2):
define double @funct(double %0, float %1, double %2, i32 %3) {
%5 = fpext float %1 to double
%6 = sitofp i32 %3 to double
%7 = fneg double %2
%8 = fdiv double %7, %6
%9 = tail call double @llvm.fmuladd.f64(double %0, double %5, double %8)
ret double %9
}
int main(int argc, char *argv[]) {
  int a = 0;
  int b = 10;
  int c = b / a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0xa,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x1c(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int isEmpty(const char *str) { return !str || !*str; }


x86 assembly (clang, -O0):
<isEmpty>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1127 <isEmpty+0x27>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isEmpty>:
test   %rdi,%rdi
je     110e <isEmpty+0xe>
xor    %eax,%eax
cmpb   $0x0,(%rdi)
sete   %al
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @isEmpty(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 %10
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
%9 = xor i1 %8, true
br label %10
10: ; preds = %5, %1
%11 = phi i1 [ true, %1 ], [ %9, %5 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isEmpty(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 1, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void nr_free_ivector(int *v, long nl) { free((char *)(v + nl - 1)); }


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

x86 assembly (clang, -O2):
<nr_free_ivector>:
lea    (%rdi,%rsi,4),%rdi
add    $0xfffffffffffffffc,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @nr_free_ivector(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i32*, i32** %3
%6 = load i64, i64* %4
%7 = getelementptr inbounds i32, i32* %5, i64 %6
%8 = getelementptr inbounds i32, i32* %7, i64 -1
%9 = bitcast i32* %8 to i8*
%10 = call i32 @free(i8* %9)
ret void
}

LLVM IR (-O2):
define void @nr_free_ivector(i32* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 %1
%4 = getelementptr inbounds i32, i32* %3, i64 -1
%5 = bitcast i32* %4 to i8*
%6 = tail call i32 @free(i8* %5)
ret void
}
int Num(int i, int p, int no, int dir) {
  return i - (p && i > p) - (no && i > no) - (dir && i > dir);
}


x86 assembly (clang, -O0):
<Num>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     1131 <Num+0x31>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setg   %al
mov    %al,-0x11(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x11(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x19(%rbp)
je     115d <Num+0x5d>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x19(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
mov    %eax,-0x28(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x21(%rbp)
je     1189 <Num+0x89>
mov    -0x4(%rbp),%eax
cmp    -0x10(%rbp),%eax
setg   %al
mov    %al,-0x21(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x21(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Num>:
test   %esi,%esi
setne  %r8b
cmp    %esi,%edi
setg   %al
and    %r8b,%al
movzbl %al,%esi
mov    %edi,%eax
sub    %esi,%eax
test   %edx,%edx
setne  %sil
cmp    %edx,%edi
setg   %dl
and    %sil,%dl
movzbl %dl,%edx
sub    %edx,%eax
test   %ecx,%ecx
setne  %dl
cmp    %ecx,%edi
setg   %cl
and    %dl,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @Num(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = icmp sgt i32 %13, %14
br label %16
16: ; preds = %12, %4
%17 = phi i1 [ false, %4 ], [ %15, %12 ]
%18 = zext i1 %17 to i32
%19 = sub nsw i32 %9, %18
%20 = load i32, i32* %7
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %16
%23 = load i32, i32* %5
%24 = load i32, i32* %7
%25 = icmp sgt i32 %23, %24
br label %26
26: ; preds = %22, %16
%27 = phi i1 [ false, %16 ], [ %25, %22 ]
%28 = zext i1 %27 to i32
%29 = sub nsw i32 %19, %28
%30 = load i32, i32* %8
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %26
%33 = load i32, i32* %5
%34 = load i32, i32* %8
%35 = icmp sgt i32 %33, %34
br label %36
36: ; preds = %32, %26
%37 = phi i1 [ false, %26 ], [ %35, %32 ]
%38 = zext i1 %37 to i32
%39 = sub nsw i32 %29, %38
ret i32 %39
}

LLVM IR (-O2):
define i32 @Num(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp ne i32 %1, 0
%6 = icmp sgt i32 %0, %1
%7 = and i1 %5, %6
%8 = sext i1 %7 to i32
%9 = add i32 %8, %0
%10 = icmp ne i32 %2, 0
%11 = icmp sgt i32 %0, %2
%12 = and i1 %10, %11
%13 = sext i1 %12 to i32
%14 = add i32 %9, %13
%15 = icmp ne i32 %3, 0
%16 = icmp sgt i32 %0, %3
%17 = and i1 %15, %16
%18 = sext i1 %17 to i32
%19 = add i32 %14, %18
ret i32 %19
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i, startNum, endNum;
  int sum;
  sum = 0;
  startNum = 1;
  endNum = 100;
  for (i = startNum; i <= endNum; i++) {
    if (i % 7 == 0 && i % 2 != 0) {
      sum = sum + i;
    }
  }
  printf("f(x)|sum(1,100),conditon()=%d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x64,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     118a <main+0x7a>
mov    -0x8(%rbp),%eax
mov    $0x7,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1177 <main+0x67>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1177 <main+0x67>
mov    -0x14(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    117c <main+0x6c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113a <main+0x2a>
mov    -0x14(%rbp),%esi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [31 x i8] c"f(x)|sum(1,100),conditon()=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 1, i32* %3
store i32 100, i32* %4
%6 = load i32, i32* %3
store i32 %6, i32* %2
br label %7
7: ; preds = %24, %0
%8 = load i32, i32* %2
%9 = load i32, i32* %4
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %27
11: ; preds = %7
%12 = load i32, i32* %2
%13 = srem i32 %12, 7
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %11
%16 = load i32, i32* %2
%17 = srem i32 %16, 2
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = load i32, i32* %5
%21 = load i32, i32* %2
%22 = add nsw i32 %20, %21
store i32 %22, i32* %5
br label %23
23: ; preds = %19, %15, %11
br label %24
24: ; preds = %23
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
store i32 %26, i32* %2
br label %7
27: ; preds = %7
%28 = load i32, i32* %5
%29 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"f(x)|sum(1,100),conditon()=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 343)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exec_cmd(char *);
scalar_t__ regquick(char *, char *);
char *strchr(char *, char);
void client_start(char *pattern) {
  if (regquick("^(class|name|title):", pattern))
    pattern = strchr(pattern, ':') + 1;
  exec_cmd(pattern);
}


x86 assembly (clang, -O0):
<client_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1040 <regquick@plt>
cmp    $0x0,%rax
je     116c <client_start+0x3c>
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <exec_cmd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client_start>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
call   1040 <regquick@plt>
test   %rax,%rax
je     115c <client_start+0x2c>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
mov    %rax,%rbx
add    $0x1,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <exec_cmd@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"^(class|name|title):\00"
define void @client_start(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @regquick(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i8* @strchr(i8* %7, i8 signext 58)
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %9, i8** %2
br label %10
10: ; preds = %6, %1
%11 = load i8*, i8** %2
%12 = call i32 @exec_cmd(i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"^(class|name|title):\00"
define void @client_start(i8* %0) {
%2 = tail call i64 @regquick(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 58)
%6 = getelementptr inbounds i8, i8* %5, i64 1
br label %7
7: ; preds = %4, %1
%8 = phi i8* [ %6, %4 ], [ %0, %1 ]
%9 = tail call i32 @exec_cmd(i8* %8)
ret void
}
int bf_check(unsigned char *data, int index) {
  int byte_index = (int)(index / 8);
  unsigned char bit_mask = 0x01 << (index % 8);
  return data[byte_index] & bit_mask;
}


x86 assembly (clang, -O0):
<bf_check>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
movzbl -0x11(%rbp),%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bf_check>:
mov    %esi,%ecx
lea    0x7(%rcx),%eax
test   %esi,%esi
cmovns %esi,%eax
and    $0x7,%cl
mov    $0x1,%edx
shl    %cl,%edx
sar    $0x3,%eax
cltq
movzbl (%rdi,%rax,1),%eax
and    %edx,%eax
ret

LLVM IR (-O0):
define i32 @bf_check(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = sdiv i32 %7, 8
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = srem i32 %9, 8
%11 = shl i32 1, %10
%12 = trunc i32 %11 to i8
store i8 %12, i8* %6
%13 = load i8*, i8** %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = load i8, i8* %6
%20 = zext i8 %19 to i32
%21 = and i32 %18, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @bf_check(i8* nocapture %0, i32 %1) {
%3 = sdiv i32 %1, 8
%4 = and i32 %1, 7
%5 = shl nuw nsw i32 1, %4
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = and i32 %5, %9
ret i32 %10
}
__attribute__((always_)) void native_restore_fl(unsigned long flags) {
  asm volatile("push %0 ; popf" : : "g"(flags) : "memory", "cc");
}


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

x86 assembly (clang, -O2):
<native_restore_fl>:
mov    %rdi,-0x8(%rsp)
push   -0x8(%rsp)
popf
ret

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

LLVM IR (-O2):
define void @native_restore_fl(i64 %0) {
tail call void asm sideeffect "push $0 ; popf", "imr,~{memory},~{cc},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret void
}