xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ fac(int);
int benchmark(void) {
  int i;
  volatile int s = 0;
  volatile int n;
  n = 10;
  for (i = 0; i <= n; i++)
    s += fac(i);
  return s;
}


x86 assembly (clang, -O0):
<benchmark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
cmp    %ecx,%eax
jg     115f <benchmark+0x4f>
mov    -0x4(%rbp),%edi
call   1030 <fac@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%eax
cltq
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112d <benchmark+0x1d>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<benchmark>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
movl   $0xa,0x8(%rsp)
cmpl   $0x0,0x8(%rsp)
js     1154 <benchmark+0x44>
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %ebx,%edi
call   1030 <fac@plt>
add    %eax,0xc(%rsp)
cmp    0x8(%rsp),%ebx
jl     1140 <benchmark+0x30>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @benchmark() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store volatile i32 10, i32* %2
%5 = load volatile i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %13, %7 ], [ 0, %0 ]
%9 = tail call i64 @fac(i32 %8)
%10 = load volatile i32, i32* %1
%11 = trunc i64 %9 to i32
%12 = add i32 %10, %11
store volatile i32 %12, i32* %1
%13 = add nuw nsw i32 %8, 1
%14 = load volatile i32, i32* %2
%15 = icmp slt i32 %8, %14
br i1 %15, label %7, label %16
16: ; preds = %7, %0
%17 = load volatile i32, i32* %1
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ Drive_SaveConfig();
void Drive_Sleep(void) { Drive_SaveConfig(); }


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

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

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

LLVM IR (-O2):
define void @Drive_Sleep() {
%1 = tail call i32 (...) @Drive_SaveConfig()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ balance(char *);
int main(int argc, char *argv[]) {
  balance("CONSUBSTANTIATION");
  balance("WRONGHEADED");
  balance("UNINTELLIGIBILITY");
  balance("SUPERGLUE");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"CONSUBSTANTIATION\00"
@.str.1 = [12 x i8] c"WRONGHEADED\00"
@.str.2 = [18 x i8] c"UNINTELLIGIBILITY\00"
@.str.3 = [10 x i8] c"SUPERGLUE\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @balance(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @balance(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @balance(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @balance(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"CONSUBSTANTIATION\00"
@.str.1 = [12 x i8] c"WRONGHEADED\00"
@.str.2 = [18 x i8] c"UNINTELLIGIBILITY\00"
@.str.3 = [10 x i8] c"SUPERGLUE\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @balance(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @balance(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @balance(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @balance(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
int LongCompare(const void *c1, const void *c2) {
  return ((*((long *)c1)) - (*((long *)c2)));
}


x86 assembly (clang, -O0):
<LongCompare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LongCompare>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @LongCompare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i64*
%7 = load i64, i64* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i64*
%10 = load i64, i64* %9
%11 = sub nsw i64 %7, %10
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @LongCompare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = sub nsw i64 %4, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}
void RTPathAbsDup(void) {}


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

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

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

LLVM IR (-O2):
define void @RTPathAbsDup() {
ret void
}
void foo() {
  if (1) {
  } else if (1) {
  } else if (1) {
  } else if (1) {
  } else {
  }
  if (1) {
  } else if (1) {
  } else if (1) {
  } else if (1) {
  }
}


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

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
/* Variables and functions */
int posix_memalign(void **, int, int);
void main() {
  int a_variable = 5;
  int **pointer_addresses[30000];
  int i, err;
  for (i = 0; i < 30000; i++) {
    err = posix_memalign((void **)&pointer_addresses[i], 1048576, 1);
    *pointer_addresses[i] = &a_variable;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3a9a0,%rsp
movl   $0x5,-0x4(%rbp)
movl   $0x0,-0x3a994(%rbp)
cmpl   $0x7530,-0x3a994(%rbp)
jge    1190 <main+0x80>
movslq -0x3a994(%rbp),%rax
lea    -0x3a990(%rbp),%rdi
shl    $0x3,%rax
add    %rax,%rdi
mov    $0x100000,%esi
mov    $0x1,%edx
call   1030 <posix_memalign@plt>
mov    %eax,-0x3a998(%rbp)
movslq -0x3a994(%rbp),%rax
mov    -0x3a990(%rbp,%rax,8),%rax
ff
lea    -0x4(%rbp),%rcx
mov    %rcx,(%rax)
mov    -0x3a994(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3a994(%rbp)
jmp    112c <main+0x1c>
add    $0x3a9a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3a998,%rsp
movl   $0x5,0xc(%rsp)
xor    %ebx,%ebx
lea    0xc(%rsp),%r14
nopl   0x0(%rax)
lea    (%rsp,%rbx,1),%rdi
add    $0x10,%rdi
mov    $0x100000,%esi
mov    $0x1,%edx
call   1030 <posix_memalign@plt>
mov    0x10(%rsp,%rbx,1),%rax
mov    %r14,(%rax)
add    $0x8,%rbx
cmp    $0x3a980,%rbx
jne    1130 <main+0x20>
add    $0x3a998,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca [30000 x i32**]
%3 = alloca i32
%4 = alloca i32
store i32 5, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %18, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 30000
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [30000 x i32**], [30000 x i32**]* %2, i64 0, i64 %10
%12 = bitcast i32*** %11 to i8**
%13 = call i32 @posix_memalign(i8** %12, i32 1048576, i32 1)
store i32 %13, i32* %4
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [30000 x i32**], [30000 x i32**]* %2, i64 0, i64 %15
%17 = load i32**, i32*** %16
store i32* %1, i32** %17
br label %18
18: ; preds = %8
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %5
21: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = alloca i32
%2 = alloca [30000 x i32**]
%3 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%4 = bitcast [30000 x i32**]* %2 to i8*
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %11, %5 ]
%7 = getelementptr inbounds [30000 x i32**], [30000 x i32**]* %2, i64 0, i64 %6
%8 = bitcast i32*** %7 to i8**
%9 = call i32 @posix_memalign(i8** %8, i32 1048576, i32 1)
%10 = load i32**, i32*** %7
store i32* %1, i32** %10
%11 = add nuw nsw i64 %6, 1
%12 = icmp eq i64 %11, 30000
br i1 %12, label %13, label %5
13: ; preds = %5
ret void
}
/* Variables and functions */
unsigned short isspace(char c) {
  return (c == 0x20 || (c >= 0x09 && c <= 0x0D));
}


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     1141 <isspace+0x41>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x3(%rbp)
jl     113b <isspace+0x3b>
movsbl -0x1(%rbp),%eax
cmp    $0xd,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
cmp    $0x20,%dil
sete   %al
add    $0xf7,%dil
cmp    $0x5,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define zeroext i16 @isspace(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 32
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sge i32 %8, 9
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sle i32 %12, 13
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ false, %6 ], [ %13, %10 ]
br label %16
16: ; preds = %14, %1
%17 = phi i1 [ true, %1 ], [ %15, %14 ]
%18 = zext i1 %17 to i32
%19 = trunc i32 %18 to i16
ret i16 %19
}

LLVM IR (-O2):
define zeroext i16 @isspace(i8 signext %0) {
%2 = icmp eq i8 %0, 32
%3 = add i8 %0, -9
%4 = icmp ult i8 %3, 5
%5 = or i1 %2, %4
%6 = zext i1 %5 to i16
ret i16 %6
}
/* Type definitions */
struct athena_args {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ arg_parser_release(struct athena_args *);
void arg_parser_free(struct athena_args *args_info) {
  arg_parser_release(args_info);
}


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

x86 assembly (clang, -O2):
<arg_parser_free>:
jmp    1030 <arg_parser_release@plt>

LLVM IR (-O0):
%struct.athena_args = type { i32 }
define void @arg_parser_free(%struct.athena_args* %0) {
%2 = alloca %struct.athena_args*
store %struct.athena_args* %0, %struct.athena_args** %2
%3 = load %struct.athena_args*, %struct.athena_args** %2
%4 = call i32 @arg_parser_release(%struct.athena_args* %3)
ret void
}

LLVM IR (-O2):
%struct.athena_args = type { i32 }
define void @arg_parser_free(%struct.athena_args* %0) {
%2 = tail call i32 @arg_parser_release(%struct.athena_args* %0)
ret void
}
int strlen30(const char *z) {
  const char *z2 = z;
  while (*z2) {
    z2++;
  }
  return 0x3fffffff & (int)(z2 - z);
}


x86 assembly (clang, -O0):
<strlen30>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     112e <strlen30+0x2e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen30+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
and    $0x3fffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen30>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strlen30+0x10>
and    $0x3fffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @strlen30(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
%11 = trunc i64 %10 to i32
%12 = and i32 %11, 1073741823
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ do_report(char *, int, int);
int /*<<< orphan*/ erl_init(int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ erl_mk_port(char *, int, int);
int /*<<< orphan*/ send_term(int /*<<< orphan*/);
void t_erl_mk_port(void) {
  erl_init(NULL, 0);
  send_term(erl_mk_port("kalle@localhost", 4, 1));
  do_report("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/RaimoNiskanen/otp/refs/heads/basho/lib/"
            "erl_interface/test/erl_eterm_SUITE_data/eterm_test.c",
            536, 1);
}


x86 assembly (clang, -O0):
<t_erl_mk_port>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   1060 <erl_init@plt>
lea    0xeaa(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <erl_mk_port@plt>
mov    %eax,%edi
call   1050 <send_term@plt>
lea    0xe9d(%rip),%rdi
mov    $0x218,%esi
mov    $0x1,%edx
call   1040 <do_report@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_erl_mk_port>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1060 <erl_init@plt>
lea    0xeaf(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <erl_mk_port@plt>
mov    %eax,%edi
call   1050 <send_term@plt>
lea    0xea2(%rip),%rdi
mov    $0x218,%esi
mov    $0x1,%edx
pop    %rax
jmp    1040 <do_report@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"kalle@localhost\00"
@.str.1 = [182 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RaimoNiskanen/otp/refs/heads/basho/lib/erl_interface/test/erl_eterm_SUITE_data/eterm_test.c\00"
define void @t_erl_mk_port() {
%1 = call i32 @erl_init(i32* null, i32 0)
%2 = call i32 @erl_mk_port(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4, i32 1)
%3 = call i32 @send_term(i32 %2)
%4 = call i32 @do_report(i8* getelementptr inbounds ([182 x i8], [182 x i8]* @.str.1, i64 0, i64 0), i32 536, i32 1)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"kalle@localhost\00"
@.str.1 = [182 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/RaimoNiskanen/otp/refs/heads/basho/lib/erl_interface/test/erl_eterm_SUITE_data/eterm_test.c\00"
define void @t_erl_mk_port() {
%1 = tail call i32 @erl_init(i32* null, i32 0)
%2 = tail call i32 @erl_mk_port(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4, i32 1)
%3 = tail call i32 @send_term(i32 %2)
%4 = tail call i32 @do_report(i8* getelementptr inbounds ([182 x i8], [182 x i8]* @.str.1, i64 0, i64 0), i32 536, i32 1)
ret void
}
void test1_ptr_arith(int x) {
  int buf[100];
  int *p = buf;
  p = p + 100;
  p[0] = 1;
}


x86 assembly (clang, -O0):
<test1_ptr_arith>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x1a0(%rbp),%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%rax
add    $0x190,%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%rax
movl   $0x1,(%rax)
add    $0x130,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test1_ptr_arith(i32 %0) {
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = alloca i32*
store i32 %0, i32* %2
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
store i32* %5, i32** %4
%6 = load i32*, i32** %4
%7 = getelementptr inbounds i32, i32* %6, i64 100
store i32* %7, i32** %4
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 1, i32* %9
ret void
}

LLVM IR (-O2):
define void @test1_ptr_arith(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int _towide(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
int to_wide(wchar_t *wc, const char *mb) {
  return (_towide(wc, mb, strlen(mb)));
}


x86 assembly (clang, -O0):
<to_wide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <_towide@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_wide>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <_towide@plt>

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

LLVM IR (-O2):
define i32 @to_wide(i32* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @_towide(i32* %0, i8* %1, i32 %3)
ret i32 %4
}
int test_imm_5Aint64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x5A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_5Aint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0x5a,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_5Aint64_highword_mem>:
testb  $0x5a,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_5Aint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 32
%6 = and i64 %5, 90
%7 = icmp ne i64 %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_5Aint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 386547056640
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int foo(int a) {
  int var[a] __attribute__((__aligned__(32)));
  return 4;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
and    $0xffffffffffffffe0,%rsp
sub    $0x40,%rsp
mov    %rsp,%rbx
mov    %edi,0x24(%rbx)
mov    0x24(%rbx),%eax
mov    %rsp,%rcx
mov    %rcx,0x18(%rbx)
mov    %rax,0x10(%rbx)
mov    0x18(%rbx),%rax
mov    %rax,%rsp
mov    $0x4,%eax
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %3
%8 = alloca i32, i64 %6
store i64 %6, i64* %4
%9 = load i8*, i8** %3
ret i32 4
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
ret i32 4
}
float F_sqrt(float n) {
  float x = n + 0.001;
  float y = 1;
  float e = 0.000001;
  while (x - y > e) {
    x = (x + y) / 2;
    y = n / x;
  }
  return x;
}


x86 assembly (clang, -O0):
<F_sqrt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xef6(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xed5(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xec4(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1184 <F_sqrt+0x84>
movss  -0x8(%rbp),%xmm0
addss  -0xc(%rbp),%xmm0
movss  0xea1(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    1141 <F_sqrt+0x41>
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<F_sqrt>:
movaps %xmm0,%xmm1
cvtss2sd %xmm0,%xmm0
addsd  0xef1(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0xeed(%rip),%xmm2
addss  %xmm0,%xmm2
ucomiss 0xee6(%rip),%xmm2
jbe    115b <F_sqrt+0x5b>
movss  0xee0(%rip),%xmm4
movss  0xedc(%rip),%xmm2
movss  0xecc(%rip),%xmm3
addss  %xmm4,%xmm0
mulss  %xmm2,%xmm0
movaps %xmm1,%xmm4
divss  %xmm0,%xmm4
movaps %xmm0,%xmm5
subss  %xmm4,%xmm5
ucomiss %xmm3,%xmm5
ja     1140 <F_sqrt+0x40>
ret

LLVM IR (-O0):
define float @F_sqrt(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %2
%6 = load float, float* %2
%7 = fpext float %6 to double
%8 = fadd double %7, 1.000000e-03
%9 = fptrunc double %8 to float
store float %9, float* %3
store float 1.000000e+00, float* %4
store float 0x3EB0C6F7A0000000, float* %5
br label %10
10: ; preds = %16, %1
%11 = load float, float* %3
%12 = load float, float* %4
%13 = fsub float %11, %12
%14 = load float, float* %5
%15 = fcmp ogt float %13, %14
br i1 %15, label %16, label %24
16: ; preds = %10
%17 = load float, float* %3
%18 = load float, float* %4
%19 = fadd float %17, %18
%20 = fdiv float %19, 2.000000e+00
store float %20, float* %3
%21 = load float, float* %2
%22 = load float, float* %3
%23 = fdiv float %21, %22
store float %23, float* %4
br label %10
24: ; preds = %10
%25 = load float, float* %3
ret float %25
}

LLVM IR (-O2):
define float @F_sqrt(float %0) {
%2 = fpext float %0 to double
%3 = fadd double %2, 1.000000e-03
%4 = fptrunc double %3 to float
%5 = fadd float %4, -1.000000e+00
%6 = fcmp ogt float %5, 0x3EB0C6F7A0000000
br i1 %6, label %7, label %15
7: ; preds = %1, %7
%8 = phi float [ %11, %7 ], [ %4, %1 ]
%9 = phi float [ %12, %7 ], [ 1.000000e+00, %1 ]
%10 = fadd float %9, %8
%11 = fmul float %10, 5.000000e-01
%12 = fdiv float %0, %11
%13 = fsub float %11, %12
%14 = fcmp ogt float %13, 0x3EB0C6F7A0000000
br i1 %14, label %7, label %15
15: ; preds = %7, %1
%16 = phi float [ %4, %1 ], [ %11, %7 ]
ret float %16
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
double wtime() {
  struct timespec t1;
  clock_gettime(CLOCK_REALTIME, &t1);
  return (double)((t1.tv_sec + t1.tv_nsec * 1e-9));
}


x86 assembly (clang, -O0):
<wtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xec3(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wtime>:
sub    $0x18,%rsp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdl 0x8(%rsp),%xmm0
mulsd  0xec4(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
@CLOCK_REALTIME = global i32 0
define double @wtime() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_REALTIME
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%8 = load i32, i32* %7
%9 = sitofp i32 %8 to double
%10 = call double @llvm.fmuladd.f64(double %9, double 1.000000e-09, double %6)
ret double %10
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
@CLOCK_REALTIME = global i32 0
define double @wtime() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_REALTIME
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%9 = load i32, i32* %8
%10 = sitofp i32 %9 to double
%11 = call double @llvm.fmuladd.f64(double %10, double 1.000000e-09, double %7)
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void putIntIntoFile(unsigned int *integer, unsigned int len) {
  for (unsigned int i = 0; i < len; ++i) {
    printf("%d\n", integer[i]);
  }
}


x86 assembly (clang, -O0):
<putIntIntoFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1156 <putIntIntoFile+0x46>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    (%rax,%rcx,4),%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <putIntIntoFile+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putIntIntoFile>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     1145 <putIntIntoFile+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <putIntIntoFile+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @putIntIntoFile(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @putIntIntoFile(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  int val1, val2, sum;
  val1 = 50;
  val2 = 25;
  sum = val1 + val2;
  printf("The sum of %i and %i is %i\n", val1, val2, sum);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"The sum of %i and %i is %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 50, i32* %2
store i32 25, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = add nsw i32 %5, %6
store i32 %7, i32* %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"The sum of %i and %i is %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 50, i32 25, i32 75)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ HwQuantonHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void HwQuantonUpdated() { UAVObjUpdated(HwQuantonHandle()); }


x86 assembly (clang, -O0):
<HwQuantonUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <HwQuantonHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HwQuantonUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <HwQuantonHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @HwQuantonUpdated() {
%1 = call i32 (...) @HwQuantonHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @HwQuantonUpdated() {
%1 = tail call i32 (...) @HwQuantonHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
void radeon_register_atpx_handler(void) {}


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

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

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

LLVM IR (-O2):
define void @radeon_register_atpx_handler() {
ret void
}
int my_strlen(const char *str) {
  int len = 0;
  if (str) {
    while (str[len] != '\0') {
      len++;
    }
  }
  return len;
}


x86 assembly (clang, -O0):
<my_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1147 <my_strlen+0x47>
jmp    111f <my_strlen+0x1f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1142 <my_strlen+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <my_strlen+0x1f>
jmp    1147 <my_strlen+0x47>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strlen>:
test   %rdi,%rdi
je     111d <my_strlen+0x1d>
mov    $0xffffffff,%eax
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <my_strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @my_strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = trunc i64 %4 to i32
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 0, %1 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, long *, int);
void long2intarray(long *l, char *inta) { memcpy(inta, l, 8); }


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

x86 assembly (clang, -O2):
<long2intarray>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
mov    $0x8,%edx
jmp    1030 <memcpy@plt>

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

LLVM IR (-O2):
define void @long2intarray(i64* %0, i8* %1) {
%3 = tail call i32 @memcpy(i8* %1, i64* %0, i32 8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ explicit_bzero(void *const, size_t const);
__attribute__((visibility("default"))) void arc4random_buf(void *const buf,
                                                           const size_t size) {
  explicit_bzero(buf, size);
}


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

x86 assembly (clang, -O2):
<arc4random_buf>:
jmp    1030 <explicit_bzero@plt>

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

LLVM IR (-O2):
define void @arc4random_buf(i8* %0, i64 %1) {
%3 = tail call i32 @explicit_bzero(i8* %0, i64 %1)
ret void
}
int alldigits(s)
register char *s;
{
  register int c;
  c = *s++;
  do {
    if (!isdigit(c))
      return (0);
  } while (c = *s++);
  return (1);
}


x86 assembly (clang, -O0):
<alldigits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    114e <alldigits+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    1178 <alldigits+0x68>
jmp    1153 <alldigits+0x43>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jne    1131 <alldigits+0x21>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alldigits>:
mov    (%rdi),%al
add    $0x1,%rdi
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%eax
add    $0xffffffd0,%eax
cmp    $0x9,%eax
ja     112c <alldigits+0x2c>
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <alldigits+0x10>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @alldigits(i8* nocapture %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %10, %1
%4 = phi i8* [ %0, %1 ], [ %7, %10 ]
%5 = phi i8 [ %2, %1 ], [ %11, %10 ]
%6 = sext i8 %5 to i32
%7 = getelementptr inbounds i8, i8* %4, i64 1
%8 = add nsw i32 %6, -48
%9 = icmp ult i32 %8, 10
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i8, i8* %7
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %3
13: ; preds = %10, %3
%14 = phi i32 [ 0, %3 ], [ 1, %10 ]
ret i32 %14
}
int fputchar(c)
int c;
{ return putchar(c); }


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

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

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

LLVM IR (-O2):
define i32 @fputchar(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %0)
ret i32 %2
}
/* Variables and functions */
size_t ceil(int);
int log10(int);
size_t jsonp_digits(size_t size) { return ceil((8 * size) * log10(2)); }


x86 assembly (clang, -O0):
<jsonp_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x3,%rax
mov    %rax,-0x10(%rbp)
mov    $0x2,%edi
call   1040 <log10@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
imul   %rcx,%rax
mov    %eax,%edi
call   1030 <ceil@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jsonp_digits>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2,%edi
call   1040 <log10@plt>
imul   %eax,%ebx
shl    $0x3,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <ceil@plt>

LLVM IR (-O0):
define i64 @jsonp_digits(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 8, %3
%5 = call i32 @log10(i32 2)
%6 = sext i32 %5 to i64
%7 = mul i64 %4, %6
%8 = trunc i64 %7 to i32
%9 = call i64 @ceil(i32 %8)
ret i64 %9
}

LLVM IR (-O2):
define i64 @jsonp_digits(i64 %0) {
%2 = tail call i32 @log10(i32 2)
%3 = trunc i64 %0 to i32
%4 = shl i32 %3, 3
%5 = mul i32 %4, %2
%6 = tail call i64 @ceil(i32 %5)
ret i64 %6
}
int make_num(const char *s) {
  if (*s >= '0' && *s <= '9')
    return 10 * (*s - '0') + *(s + 1) - '0';
  else
    return *(s + 1) - '0';
}


x86 assembly (clang, -O0):
<make_num>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     114a <make_num+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     114a <make_num+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
imul   $0xa,%eax,%eax
mov    -0x10(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
add    %ecx,%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <make_num+0x58>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_num>:
movzbl (%rdi),%eax
lea    -0x30(%rax),%ecx
cmp    $0x9,%cl
ja     111e <make_num+0x1e>
lea    (%rax,%rax,4),%eax
movsbl 0x1(%rdi),%ecx
lea    (%rcx,%rax,2),%eax
add    $0xfffffe20,%eax
add    $0xffffffd0,%eax
ret
movsbl 0x1(%rdi),%eax
add    $0xffffffd0,%eax
ret

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

LLVM IR (-O2):
define i32 @make_num(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -48
%4 = icmp ult i8 %3, 10
br i1 %4, label %5, label %13
5: ; preds = %1
%6 = zext i8 %2 to i32
%7 = mul nuw nsw i32 %6, 10
%8 = add nsw i32 %7, -480
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = add nsw i32 %8, %11
br label %17
13: ; preds = %1
%14 = getelementptr inbounds i8, i8* %0, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
br label %17
17: ; preds = %13, %5
%18 = phi i32 [ %12, %5 ], [ %16, %13 ]
%19 = add nsw i32 %18, -48
ret i32 %19
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int pthread_create(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                   void *(*)(void *), void *);
int beginthread(void (*func)(void *), void *arg) {
  pthread_t thread;
  return pthread_create(&thread, NULL, (void *(*)(void *))func, arg);
}


x86 assembly (clang, -O0):
<beginthread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <pthread_create@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<beginthread>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0x4(%rsp),%rdi
xor    %esi,%esi
call   1030 <pthread_create@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @beginthread(void (i8*)* %0, i8* %1) {
%3 = alloca void (i8*)*
%4 = alloca i8*
%5 = alloca i32
store void (i8*)* %0, void (i8*)** %3
store i8* %1, i8** %4
%6 = load void (i8*)*, void (i8*)** %3
%7 = bitcast void (i8*)* %6 to i8* (i8*)*
%8 = load i8*, i8** %4
%9 = call i32 @pthread_create(i32* %5, i32* null, i8* (i8*)* %7, i8* %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @beginthread(void (i8*)* %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = bitcast void (i8*)* %0 to i8* (i8*)*
%6 = call i32 @pthread_create(i32* %3, i32* null, i8* (i8*)* %5, i8* %1)
ret i32 %6
}
/* Variables and functions */
float expf(float);
float tanhf(float x) {
  float x0 = expf(x);
  float x1 = 1.0 / x0;
  return ((x0 - x1) / (x0 + x1));
}


x86 assembly (clang, -O0):
<tanhf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <expf@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec3(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
addss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tanhf>:
push   %rax
call   1030 <expf@plt>
movss  0xee2(%rip),%xmm2
divss  %xmm0,%xmm2
movaps %xmm0,%xmm1
subss  %xmm2,%xmm1
addss  %xmm0,%xmm2
divss  %xmm2,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @tanhf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = load float, float* %2
%6 = call float @expf(float %5)
store float %6, float* %3
%7 = load float, float* %3
%8 = fpext float %7 to double
%9 = fdiv double 1.000000e+00, %8
%10 = fptrunc double %9 to float
store float %10, float* %4
%11 = load float, float* %3
%12 = load float, float* %4
%13 = fsub float %11, %12
%14 = load float, float* %3
%15 = load float, float* %4
%16 = fadd float %14, %15
%17 = fdiv float %13, %16
ret float %17
}

LLVM IR (-O2):
define float @tanhf(float %0) {
%2 = tail call float @expf(float %0)
%3 = fdiv float 1.000000e+00, %2
%4 = fsub float %2, %3
%5 = fadd float %2, %3
%6 = fdiv float %4, %5
ret float %6
}
void audiohw_mute(int mute) {}


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

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

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

LLVM IR (-O2):
define void @audiohw_mute(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foobar(int);
int /*<<< orphan*/ sleep(int);
int main() {
  foobar(1);
  sleep(300);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <foobar@plt>
mov    $0x12c,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foobar(i32 1)
%2 = tail call i32 @sleep(i32 300)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ UartTxPutChar(int /*<<< orphan*/);
void UartTxPuts(char *s) {
  while (*s) {
    UartTxPutChar(*s++);
  }
}


x86 assembly (clang, -O0):
<UartTxPuts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <UartTxPuts+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <UartTxPutChar@plt>
jmp    111c <UartTxPuts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UartTxPuts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <UartTxPuts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <UartTxPutChar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <UartTxPuts+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @UartTxPuts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = call i32 @UartTxPutChar(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @UartTxPuts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @UartTxPutChar(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("hello github!\n"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"hello github!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"hello github!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}