xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ gluPerspective(int, float, double, double);
void Reshape(int w, int h) {
  glViewport(0, 0, w, h);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(45, (float)w / h, 1.0, 10.0);
}


x86 assembly (clang, -O0):
<Reshape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
xor    %esi,%esi
mov    %esi,%edi
call   1060 <glViewport@plt>
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
mov    $0x0,%al
call   1050 <glLoadIdentity@plt>
cvtsi2ssl -0x4(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
mov    $0x2d,%edi
movsd  0xe73(%rip),%xmm1
movsd  0xe73(%rip),%xmm2
call   1040 <gluPerspective@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Reshape>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
xor    %esi,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1060 <glViewport@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1030 <glMatrixMode@plt>
xor    %eax,%eax
call   1050 <glLoadIdentity@plt>
cvtsi2ss %ebp,%xmm0
cvtsi2ss %ebx,%xmm1
divss  %xmm1,%xmm0
movsd  0xe83(%rip),%xmm1
movsd  0xe83(%rip),%xmm2
mov    $0x2d,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <gluPerspective@plt>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
define void @Reshape(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @glViewport(i32 0, i32 0, i32 %5, i32 %6)
%8 = load i32, i32* @GL_PROJECTION
%9 = call i32 @glMatrixMode(i32 %8)
%10 = call i32 (...) @glLoadIdentity()
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to float
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to float
%15 = fdiv float %12, %14
%16 = call i32 @gluPerspective(i32 45, float %15, double 1.000000e+00, double 1.000000e+01)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
define void @Reshape(i32 %0, i32 %1) {
%3 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
%4 = load i32, i32* @GL_PROJECTION
%5 = tail call i32 @glMatrixMode(i32 %4)
%6 = tail call i32 (...) @glLoadIdentity()
%7 = sitofp i32 %0 to float
%8 = sitofp i32 %1 to float
%9 = fdiv float %7, %8
%10 = tail call i32 @gluPerspective(i32 45, float %9, double 1.000000e+00, double 1.000000e+01)
ret void
}
/* Variables and functions */
char **free_arrayN(void *, int);
char **free_char(char **array, int first) {
  return free_arrayN((void *)array, 2);
}


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

x86 assembly (clang, -O2):
<free_char>:
mov    $0x2,%esi
jmp    1030 <free_arrayN@plt>

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

LLVM IR (-O2):
define i8** @free_char(i8** %0, i32 %1) {
%3 = bitcast i8** %0 to i8*
%4 = tail call i8** @free_arrayN(i8* %3, i32 2)
ret i8** %4
}
int test_imm_49uint32_mem(unsigned int *val) {
  return ((*val) & (0x49 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_49uint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 73
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int n, triangularNumber;
  triangularNumber = 0;
  n = 1;
  while (n <= 200) {
    triangularNumber += n;
    n += 1;
  }
  printf("The 200th triangular number is %i\n", triangularNumber);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xc8,-0x8(%rbp)
jg     1151 <main+0x41>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xea5(%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    $0x4e84,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"The 200th triangular number is %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 1, i32* %2
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 200
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %9, %8
store i32 %10, i32* %3
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %4
13: ; preds = %4
%14 = load i32, i32* %3
%15 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"The 200th triangular number is %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 20100)
ret i32 0
}
void execLs(char *options, int argc) {}


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

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

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

LLVM IR (-O2):
define void @execLs(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int japi_getypos(int);
int j_getypos(int arg0) { return (japi_getypos(arg0)); }


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

x86 assembly (clang, -O2):
<j_getypos>:
jmp    1030 <japi_getypos@plt>

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

LLVM IR (-O2):
define i32 @j_getypos(i32 %0) {
%2 = tail call i32 @japi_getypos(i32 %0)
ret i32 %2
}
int enclave_fstat() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @enclave_fstat() {
ret i32 0
}
void ip6_mroute_getsockopt(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<ip6_mroute_getsockopt>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip6_mroute_getsockopt>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.ip6_mroute_getsockopt = [22 x i8] c"ip6_mroute_getsockopt\00"
define void @ip6_mroute_getsockopt() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__func__.ip6_mroute_getsockopt, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.ip6_mroute_getsockopt = [22 x i8] c"ip6_mroute_getsockopt\00"
define void @ip6_mroute_getsockopt() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @__func__.ip6_mroute_getsockopt, i64 0, i64 0))
ret void
}
PHP_MINFO_FUNCTION(nsntrace) {
  php_info_print_table_start();
  php_info_print_table_header(2, "nsntrace support", "enabled");
  php_info_print_table_end();
}


x86 assembly (clang, -O0):
<PHP_MINFO_FUNCTION>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <php_info_print_table_start@plt>
mov    $0x2,%edi
lea    0xeb2(%rip),%rsi
lea    0xebc(%rip),%rdx
mov    $0x0,%al
call   1040 <php_info_print_table_header@plt>
mov    $0x0,%al
call   1030 <php_info_print_table_end@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PHP_MINFO_FUNCTION>:
push   %rax
xor    %eax,%eax
call   1050 <php_info_print_table_start@plt>
lea    0xec1(%rip),%rsi
lea    0xecb(%rip),%rdx
mov    $0x2,%edi
xor    %eax,%eax
call   1040 <php_info_print_table_header@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <php_info_print_table_end@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"nsntrace support\00"
@.str.1 = [8 x i8] c"enabled\00"
define i32 @PHP_MINFO_FUNCTION(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (...) @php_info_print_table_start()
%5 = call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @php_info_print_table_header to i32 (i32, i8*, i8*, ...)*)(i32 2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (...) @php_info_print_table_end()
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
@.str = [17 x i8] c"nsntrace support\00"
@.str.1 = [8 x i8] c"enabled\00"
define i32 @PHP_MINFO_FUNCTION(i32 %0) {
%2 = tail call i32 (...) @php_info_print_table_start()
%3 = tail call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @php_info_print_table_header to i32 (i32, i8*, i8*, ...)*)(i32 2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @php_info_print_table_end()
ret i32 undef
}
int execute_getrlimit() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_getrlimit() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
nl() { printf("\n"); }


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

x86 assembly (clang, -O2):
<nl>:
mov    $0xa,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define i32 @nl() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @nl() {
%1 = tail call i32 @putchar(i32 10)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ cov_spec_log(double, int /*<<< orphan*/, char *);
int main(int argc, char *argv[]) {
  float a = 2;
  double b = 3;
  double c = a + b;
  cov_spec_log(c, 0, argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xeda(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movsd  0xec5(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
xor    %edi,%edi
call   1030 <cov_spec_log@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rsi
movsd  0xee3(%rip),%xmm0
xor    %edi,%edi
call   1030 <cov_spec_log@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
%7 = alloca double
%8 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 2.000000e+00, float* %6
store double 3.000000e+00, double* %7
%9 = load float, float* %6
%10 = fpext float %9 to double
%11 = load double, double* %7
%12 = fadd double %10, %11
store double %12, double* %8
%13 = load double, double* %8
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @cov_spec_log(double %13, i32 0, i8* %16)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @cov_spec_log(double 5.000000e+00, i32 0, i8* %4)
ret i32 0
}
int test_imm_F5int16_mem(short *val) {
  return ((*val) & (-0xF5 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_F5int16_mem>:
movzwl (%rdi),%eax
test   $0xff0b,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_F5int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -245
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_A0uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xA0 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_A0uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 160
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
double READ_SHORT();
float READ_HIRESANGLE(void) { return (float)(READ_SHORT() * (360.0 / 65536)); }


x86 assembly (clang, -O0):
<READ_HIRESANGLE>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <READ_SHORT@plt>
movsd  0xedd(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<READ_HIRESANGLE>:
push   %rax
xor    %eax,%eax
call   1030 <READ_SHORT@plt>
mulsd  0xee0(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @READ_HIRESANGLE() {
%1 = call double (...) @READ_SHORT()
%2 = fmul double %1, 0x3F76800000000000
%3 = fptrunc double %2 to float
ret float %3
}

LLVM IR (-O2):
define float @READ_HIRESANGLE() {
%1 = tail call double (...) @READ_SHORT()
%2 = fmul double %1, 0x3F76800000000000
%3 = fptrunc double %2 to float
ret float %3
}
int main() {
  int x = 0;
  __builtin_expect(x == 0, 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  printf("%g\n", 310.0);
  printf("%g\n", 310.1);
  printf("%g\n", 310.12);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xefd(%rip),%rdi
movsd  0xeed(%rip),%xmm0
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
movsd  0xed1(%rip),%xmm0
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
movsd  0xeb5(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xf00(%rip),%rbx
movsd  0xee0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xed8(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xed0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 3.100000e+02)
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 3.101000e+02)
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 3.101200e+02)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 3.100000e+02)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 3.101000e+02)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 3.101200e+02)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *inc_x(void *x_void_ptr) {
  int *x_ptr = (int *)x_void_ptr;
  while (++(*x_ptr) < 10)
    ;
  printf("x increment finished\n");
  return NULL;
}


x86 assembly (clang, -O0):
<inc_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    (%rcx),%eax
add    $0x1,%eax
mov    %eax,(%rcx)
cmp    $0xa,%eax
jge    113d <inc_x+0x2d>
jmp    1124 <inc_x+0x14>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc_x>:
push   %rax
mov    (%rdi),%eax
cmp    $0xa,%eax
mov    $0x9,%ecx
cmovge %eax,%ecx
add    $0x1,%ecx
mov    %ecx,(%rdi)
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"x increment finished\0A\00"
define i8* @inc_x(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
br label %6
6: ; preds = %11, %1
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1
store i32 %9, i32* %7
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %12
11: ; preds = %6
br label %6
12: ; preds = %6
%13 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@str = [21 x i8] c"x increment finished\00"
define noalias i8* @inc_x(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = call i32 @llvm.smax.i32(i32 %3, i32 9)
%5 = add nuw i32 %4, 1
store i32 %5, i32* %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i8* null
}
float absolute(float a) {
  if (a < 0.0)
    return -a;
  else
    return a;
}


x86 assembly (clang, -O0):
<absolute>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    113b <absolute+0x3b>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1145 <absolute+0x45>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<absolute>:
movaps 0xef9(%rip),%xmm2
xorps  %xmm0,%xmm2
xorps  %xmm3,%xmm3
movaps %xmm0,%xmm1
cmpltss %xmm3,%xmm1
andps  %xmm1,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @absolute(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load float, float* %3
%9 = fneg float %8
store float %9, float* %2
br label %12
10: ; preds = %1
%11 = load float, float* %3
store float %11, float* %2
br label %12
12: ; preds = %10, %7
%13 = load float, float* %2
ret float %13
}

LLVM IR (-O2):
define float @absolute(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %3, float %0
ret float %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ EMLINK;
int /*<<< orphan*/ errno;
int _link(const uint8_t *old, const uint8_t *new) {
  errno = EMLINK;
  return -1;
}


x86 assembly (clang, -O0):
<_link>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2edd(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@EMLINK = global i32 0
@errno = global i32 0
define i32 @_link(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32, i32* @EMLINK
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EMLINK = global i32 0
@errno = global i32 0
define i32 @_link(i32* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = load i32, i32* @EMLINK
store i32 %3, i32* @errno
ret i32 -1
}
void bch_btree_verify(struct btree *b) {}


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

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

LLVM IR (-O0):
%struct.btree = type opaque
define void @bch_btree_verify(%struct.btree* %0) {
%2 = alloca %struct.btree*
store %struct.btree* %0, %struct.btree** %2
ret void
}

LLVM IR (-O2):
%struct.btree = type opaque
define void @bch_btree_verify(%struct.btree* nocapture %0) {
ret void
}
/* Variables and functions */
size_t cblas_idamax(int const, double *, int);
double fabs(double);
double calc_norm_1(const int N, double *b) {
  return fabs(b[cblas_idamax(N, b, 1)]);
}


x86 assembly (clang, -O0):
<calc_norm_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <cblas_idamax@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
movsd  (%rax,%rcx,8),%xmm0
movaps 0xeb5(%rip),%xmm1
pand   %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_norm_1>:
push   %rbx
mov    %rsi,%rbx
mov    $0x1,%edx
call   1030 <cblas_idamax@plt>
movsd  (%rbx,%rax,8),%xmm0
andps  0xed6(%rip),%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @calc_norm_1(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
store i32 %0, i32* %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = load i32, i32* %3
%7 = load double*, double** %4
%8 = call i64 @cblas_idamax(i32 %6, double* %7, i32 1)
%9 = getelementptr inbounds double, double* %5, i64 %8
%10 = load double, double* %9
%11 = call double @llvm.fabs.f64(double %10)
ret double %11
}

LLVM IR (-O2):
define double @calc_norm_1(i32 %0, double* %1) {
%3 = tail call i64 @cblas_idamax(i32 %0, double* %1, i32 1)
%4 = getelementptr inbounds double, double* %1, i64 %3
%5 = load double, double* %4
%6 = tail call double @llvm.fabs.f64(double %5)
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_int(int i) { printf("print_int(%d)\n", i); }


x86 assembly (clang, -O0):
<print_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"print_int(%d)\0A\00"
define void @print_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"print_int(%d)\0A\00"
define void @print_int(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
unsigned long sub(int a) { return ((0 > a - 2) ? 0 : a - 2) * sizeof(long); }


x86 assembly (clang, -O0):
<sub>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
sub    $0x2,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jle    1121 <sub+0x21>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    112a <sub+0x2a>
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cltq
shl    $0x3,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub>:
cmp    $0x3,%edi
mov    $0x2,%eax
cmovge %edi,%eax
add    $0xfffffffe,%eax
shl    $0x3,%rax
ret

LLVM IR (-O0):
define i64 @sub(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 2
%5 = icmp sgt i32 0, %4
br i1 %5, label %6, label %7
6: ; preds = %1
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 %8, 2
br label %10
10: ; preds = %7, %6
%11 = phi i32 [ 0, %6 ], [ %9, %7 ]
%12 = sext i32 %11 to i64
%13 = mul i64 %12, 8
ret i64 %13
}

LLVM IR (-O2):
define i64 @sub(i32 %0) {
%2 = icmp sgt i32 %0, 2
%3 = select i1 %2, i32 %0, i32 2
%4 = add nsw i32 %3, -2
%5 = zext i32 %4 to i64
%6 = shl nuw nsw i64 %5, 3
ret i64 %6
}
/* Variables and functions */
double td2(double a) { return a; }


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

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

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

LLVM IR (-O2):
define double @td2(double returned %0) {
ret double %0
}
/* Variables and functions */
int STC31xx_ReadByte8(int);
int STC31xx_WriteByte8(int, int);
int STC31xx_SetPowerSavingMode(void) {
  int res;
  res = STC31xx_ReadByte8(0x00);
  res = STC31xx_WriteByte8(0x00, (res | 0x01));
  if (res != 0)
    return (res);
  return (0);
}


x86 assembly (clang, -O0):
<STC31xx_SetPowerSavingMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <STC31xx_ReadByte8@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
or     $0x1,%esi
xor    %edi,%edi
call   1040 <STC31xx_WriteByte8@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1157 <STC31xx_SetPowerSavingMode+0x37>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115e <STC31xx_SetPowerSavingMode+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STC31xx_SetPowerSavingMode>:
push   %rax
xor    %edi,%edi
call   1030 <STC31xx_ReadByte8@plt>
or     $0x1,%eax
xor    %edi,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <STC31xx_WriteByte8@plt>

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

LLVM IR (-O2):
define i32 @STC31xx_SetPowerSavingMode() {
%1 = tail call i32 @STC31xx_ReadByte8(i32 0)
%2 = or i32 %1, 1
%3 = tail call i32 @STC31xx_WriteByte8(i32 0, i32 %2)
ret i32 %3
}
/* Variables and functions */
char *gettext(char *);
int /*<<< orphan*/ printf(char *);
void showHelp() { printf(gettext("CatShell usage: [-v version][-h help]\n")); }


x86 assembly (clang, -O0):
<showHelp>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<showHelp>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <gettext@plt>
mov    %rax,%rdi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"CatShell usage: [-v version][-h help]\0A\00"
define void @showHelp() {
%1 = call i8* @gettext(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* %1)
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"CatShell usage: [-v version][-h help]\0A\00"
define void @showHelp() {
%1 = tail call i8* @gettext(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) %1)
ret void
}
/* Variables and functions */
char tolower(char);
void strtolower(char *s) {
  int i = 0;
  while (s[i] != '\0') {
    s[i] = tolower(s[i]);
    i++;
  }
}


x86 assembly (clang, -O0):
<strtolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1164 <strtolower+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <strtolower+0x13>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @strtolower(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %11, %4 ], [ %2, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = tail call signext i8 @tolower(i8 signext %6)
store i8 %8, i8* %7
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Variables and functions */
size_t strlen(char *);
int /*<<< orphan*/ strncat(char *, char const *, size_t);
void psf_strlcat(char *dest, size_t n, const char *src) {
  strncat(dest, src, n - strlen(dest) - 1);
  dest[n - 1] = 0;
}


x86 assembly (clang, -O0):
<psf_strlcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
sub    %rax,%rdx
sub    $0x1,%rdx
call   1040 <strncat@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psf_strlcat>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1030 <strlen@plt>
not    %rax
lea    (%rax,%r15,1),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strncat@plt>
movb   $0x0,-0x1(%r15,%rbx,1)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @psf_strlcat(i8* %0, i64 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %6
%9 = load i64, i64* %5
%10 = load i8*, i8** %4
%11 = call i64 @strlen(i8* %10)
%12 = sub i64 %9, %11
%13 = sub i64 %12, 1
%14 = call i32 @strncat(i8* %7, i8* %8, i64 %13)
%15 = load i8*, i8** %4
%16 = load i64, i64* %5
%17 = sub i64 %16, 1
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 0, i8* %18
ret void
}

LLVM IR (-O2):
define void @psf_strlcat(i8* %0, i64 %1, i8* %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = xor i64 %4, -1
%6 = add i64 %5, %1
%7 = tail call i32 @strncat(i8* %0, i8* %2, i64 %6)
%8 = add i64 %1, -1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
store i8 0, i8* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ logComment(char *);
int /*<<< orphan*/ logVarOutOfScope(char *, char ***);
int /*<<< orphan*/ test1();
int /*<<< orphan*/ test2();
int /*<<< orphan*/ test3();
int main(int argc, char **argv) {
  {
    logComment("Function Entered");
    test1();
    test2();
    test3();
    {
      logVarOutOfScope("argv", &argv);
      {
        logComment("Function Exited");
        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    0xe93(%rip),%rdi
call   1030 <logComment@plt>
mov    $0x0,%al
call   1050 <test1@plt>
mov    $0x0,%al
call   1060 <test2@plt>
mov    $0x0,%al
call   1040 <test3@plt>
lea    0xe83(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1070 <logVarOutOfScope@plt>
lea    0xe78(%rip),%rdi
call   1030 <logComment@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsi,(%rsp)
lea    0xea4(%rip),%rdi
call   1030 <logComment@plt>
xor    %eax,%eax
call   1050 <test1@plt>
xor    %eax,%eax
call   1060 <test2@plt>
xor    %eax,%eax
call   1040 <test3@plt>
lea    0xe94(%rip),%rdi
mov    %rsp,%rsi
call   1070 <logVarOutOfScope@plt>
lea    0xe8a(%rip),%rdi
call   1030 <logComment@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Function Entered\00"
@.str.1 = [5 x i8] c"argv\00"
@.str.2 = [16 x i8] c"Function Exited\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 @logComment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @test1()
%8 = call i32 (...) @test2()
%9 = call i32 (...) @test3()
%10 = call i32 @logVarOutOfScope(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8*** %5)
%11 = call i32 @logComment(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Function Entered\00"
@.str.1 = [5 x i8] c"argv\00"
@.str.2 = [16 x i8] c"Function Exited\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8**
store i8** %1, i8*** %3
%4 = tail call i32 @logComment(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @test1()
%6 = tail call i32 (...) @test2()
%7 = tail call i32 (...) @test3()
%8 = call i32 @logVarOutOfScope(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8*** %3)
%9 = call i32 @logComment(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
scalar_t__ __VERIFIER_undefined_int();
int /*<<< orphan*/ assert(int);
int main() {
  float x = 0;
  while (__VERIFIER_undefined_int()) {
    x = x / 2 + 1;
  }
  assert(x <= 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_undefined_int@plt>
cmp    $0x0,%rax
je     116f <main+0x4f>
movss  -0x8(%rbp),%xmm0
movss  0xeab(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xea3(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1137 <main+0x17>
movss  0xe89(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_undefined_int@plt>
test   %rax,%rax
je     116b <main+0x4b>
xorps  %xmm1,%xmm1
mulss  0xec8(%rip),%xmm1
addss  0xec4(%rip),%xmm1
movss  %xmm1,0x4(%rsp)
xor    %eax,%eax
call   1030 <__VERIFIER_undefined_int@plt>
movss  0x4(%rsp),%xmm1
test   %rax,%rax
jne    1130 <main+0x10>
movss  0xea8(%rip),%xmm0
xor    %edi,%edi
ucomiss %xmm1,%xmm0
setae  %dil
jmp    1170 <main+0x50>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %2
br label %3
3: ; preds = %6, %0
%4 = call i64 (...) @__VERIFIER_undefined_int()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = load float, float* %2
%8 = fdiv float %7, 2.000000e+00
%9 = fadd float %8, 1.000000e+00
store float %9, float* %2
br label %3
10: ; preds = %3
%11 = load float, float* %2
%12 = fcmp ole float %11, 2.000000e+00
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @__VERIFIER_undefined_int()
%2 = icmp eq i64 %1, 0
br i1 %2, label %12, label %3
3: ; preds = %0, %3
%4 = phi float [ %6, %3 ], [ 0.000000e+00, %0 ]
%5 = fmul float %4, 5.000000e-01
%6 = fadd float %5, 1.000000e+00
%7 = tail call i64 (...) @__VERIFIER_undefined_int()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = fcmp ole float %6, 2.000000e+00
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %9, %0
%13 = phi i32 [ 1, %0 ], [ %11, %9 ]
%14 = tail call i32 @assert(i32 %13)
ret i32 0
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ display_menu();
int main(void) {
  display_menu();
  return EXIT_SUCCESS;
}


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

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

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @display_menu()
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
/* Variables and functions */
int MQTTIsConnected();
int tpMQTTIsConnected() {
  int rc = MQTTIsConnected();
  return rc;
}


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

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

LLVM IR (-O0):
define i32 @tpMQTTIsConnected() {
%1 = alloca i32
%2 = call i32 (...) @MQTTIsConnected()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @tpMQTTIsConnected() {
%1 = tail call i32 (...) @MQTTIsConnected()
ret i32 %1
}
void INT_Excep_PERIB_INTB171(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB171() {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t smpte_hbrmt_get_fec(const uint8_t *p_hbrmt) {
  return (p_hbrmt[2] >> 1) & 0x7;
}


x86 assembly (clang, -O0):
<smpte_hbrmt_get_fec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
sar    $0x1,%eax
and    $0x7,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<smpte_hbrmt_get_fec>:
mov    0x8(%rdi),%eax
shr    %eax
and    $0x7,%eax
ret

LLVM IR (-O0):
define i32 @smpte_hbrmt_get_fec(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 2
%5 = load i32, i32* %4
%6 = ashr i32 %5, 1
%7 = and i32 %6, 7
ret i32 %7
}

LLVM IR (-O2):
define i32 @smpte_hbrmt_get_fec(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
%5 = and i32 %4, 7
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ jenkins_hash_uint64(int /*<<< orphan*/);
uint32_t jenkins_hash_int64(int64_t x) { return jenkins_hash_uint64(x); }


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

x86 assembly (clang, -O2):
<jenkins_hash_int64>:
jmp    1030 <jenkins_hash_uint64@plt>

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

LLVM IR (-O2):
define i32 @jenkins_hash_int64(i32 %0) {
%2 = tail call i32 @jenkins_hash_uint64(i32 %0)
ret i32 %2
}
int QinJunQiangFa_cost(struct Ability *self) { return 135; }


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

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

LLVM IR (-O0):
%struct.Ability = type opaque
define i32 @QinJunQiangFa_cost(%struct.Ability* %0) {
%2 = alloca %struct.Ability*
store %struct.Ability* %0, %struct.Ability** %2
ret i32 135
}

LLVM IR (-O2):
%struct.Ability = type opaque
define i32 @QinJunQiangFa_cost(%struct.Ability* nocapture readnone %0) {
ret i32 135
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int sum = 0;
  do {
    sum += n % 10;
    n /= 10;
  } while (n > 0);
  printf("%d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0xc(%rbp),%edx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1146 <main+0x26>
mov    -0xc(%rbp),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
xor    %esi,%esi
mov    0x4(%rsp),%eax
nopl   0x0(%rax,%rax,1)
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
lea    (%rax,%rax,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%edi
sub    %edx,%edi
add    %edi,%esi
cmp    $0x9,%ecx
jg     1140 <main+0x20>
mov    %eax,0x4(%rsp)
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
br label %5
5: ; preds = %5, %0
%6 = phi i32 [ %10, %5 ], [ %4, %0 ]
%7 = phi i32 [ %9, %5 ], [ 0, %0 ]
%8 = srem i32 %6, 10
%9 = add nsw i32 %7, %8
%10 = sdiv i32 %6, 10
%11 = icmp sgt i32 %6, 9
br i1 %11, label %5, label %12
12: ; preds = %5
store i32 %10, i32* %1
%13 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Variables and functions */
size_t omp_get_thread_num();
size_t pumaGetCPUNum(void) { return omp_get_thread_num(); }


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

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

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

LLVM IR (-O2):
define i64 @pumaGetCPUNum() {
%1 = tail call i64 (...) @omp_get_thread_num()
ret i64 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int wstandend(int /*<<< orphan*/ *);
int ncurses_wstandend(WINDOW *win) { return wstandend(win); }


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

x86 assembly (clang, -O2):
<ncurses_wstandend>:
jmp    1030 <wstandend@plt>

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

LLVM IR (-O2):
define i32 @ncurses_wstandend(i32* %0) {
%2 = tail call i32 @wstandend(i32* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_atomic_fun();
void *t_fun(void *arg) {
  __VERIFIER_atomic_fun();
  return NULL;
}


x86 assembly (clang, -O0):
<t_fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_atomic_fun@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @t_fun(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @__VERIFIER_atomic_fun()
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @t_fun(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @__VERIFIER_atomic_fun()
ret i8* null
}