xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ perror(char *);
void makeDirectory(char *dir_name) {
  if (mkdir(dir_name, 0755)) {
    perror("error occurred while mkdir()");
    return;
  }
}


x86 assembly (clang, -O0):
<makeDirectory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
je     1150 <makeDirectory+0x30>
lea    0xeb5(%rip),%rdi
call   1040 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeDirectory>:
push   %rax
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
jne    1132 <makeDirectory+0x12>
pop    %rax
ret
lea    0xec7(%rip),%rdi
pop    %rax
jmp    1040 <perror@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"error occurred while mkdir()\00"
define void @makeDirectory(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mkdir(i8* %3, i32 493)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"error occurred while mkdir()\00"
define void @makeDirectory(i8* nocapture %0) {
%2 = tail call i64 @mkdir(i8* %0, i32 493)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
void _sincos(double, double *, double *);
void sincos(double angle, double *sinx, double *cosx) {
  return _sincos(angle, sinx, cosx);
}


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

x86 assembly (clang, -O2):
<sincos>:
jmp    1030 <_sincos@plt>

LLVM IR (-O0):
define void @sincos(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double, double* %4
%8 = load double*, double** %5
%9 = load double*, double** %6
ret void
}

LLVM IR (-O2):
define void @sincos(double %0, double* %1, double* %2) {
tail call void @_sincos(double %0, double* %1, double* %2)
ret void
}
int field_count(const char *input) {
  int counter = 0;
  while (*input != '\0') {
    input++;
    counter++;
  }
  return counter;
}


x86 assembly (clang, -O0):
<field_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1139 <field_count+0x39>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <field_count+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<field_count>:
cmpb   $0x0,(%rdi)
je     111c <field_count+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <field_count+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @field_count(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ rush(int, int);
int main() {
  rush(5, 3);
  return (0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
mov    $0x3,%esi
call   1030 <rush@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @rush(i32 5, i32 3)
ret i32 0
}
/* Variables and functions */
double pow(int, double);
double ALT_to_SP(double in, double meters) {
  double sp = in * pow((288 - 0.0065 * meters) / 288, 5.2561);
  return sp;
}


x86 assembly (clang, -O0):
<ALT_to_SP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xec3(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xeb7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe9f(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ALT_to_SP>:
push   %rax
movsd  %xmm0,(%rsp)
mulsd  0xee2(%rip),%xmm1
movsd  0xee2(%rip),%xmm0
addsd  %xmm0,%xmm1
divsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
movsd  0xed6(%rip),%xmm0
call   1030 <pow@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ALT_to_SP(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = call double @llvm.fmuladd.f64(double 0xBF7A9FBE76C8B439, double %7, double 2.880000e+02)
%9 = fdiv double %8, 2.880000e+02
%10 = fptosi double %9 to i32
%11 = call double @pow(i32 %10, double 5.256100e+00)
%12 = fmul double %6, %11
store double %12, double* %5
%13 = load double, double* %5
ret double %13
}

LLVM IR (-O2):
define double @ALT_to_SP(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %1, double 0xBF7A9FBE76C8B439, double 2.880000e+02)
%4 = fdiv double %3, 2.880000e+02
%5 = fptosi double %4 to i32
%6 = tail call double @pow(i32 %5, double 5.256100e+00)
%7 = fmul double %6, %0
ret double %7
}
int __attribute__((optimize("O0"), no, noclone)) foo(int a) { return a * a; }


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

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
imul   %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ ogs_dbi_final();
int /*<<< orphan*/ ogs_sctp_final();
int /*<<< orphan*/ test_context_final();
void test_app_final(void) {
  ogs_dbi_final();
  ogs_sctp_final();
  test_context_final();
}


x86 assembly (clang, -O0):
<test_app_final>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <ogs_dbi_final@plt>
mov    $0x0,%al
call   1040 <ogs_sctp_final@plt>
mov    $0x0,%al
call   1050 <test_context_final@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_app_final>:
push   %rax
xor    %eax,%eax
call   1030 <ogs_dbi_final@plt>
xor    %eax,%eax
call   1040 <ogs_sctp_final@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <test_context_final@plt>

LLVM IR (-O0):
define void @test_app_final() {
%1 = call i32 (...) @ogs_dbi_final()
%2 = call i32 (...) @ogs_sctp_final()
%3 = call i32 (...) @test_context_final()
ret void
}

LLVM IR (-O2):
define void @test_app_final() {
%1 = tail call i32 (...) @ogs_dbi_final()
%2 = tail call i32 (...) @ogs_sctp_final()
%3 = tail call i32 (...) @test_context_final()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void mailimf_local_part_free(char *local_part) { free(local_part); }


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

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

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

LLVM IR (-O2):
define void @mailimf_local_part_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef scalar_t__ __v16qi;
typedef scalar_t__ __m128i;

/* Variables and functions */
__m128i __attribute__((__always___, __nodebug__))
_mm_sub_epi8(__m128i a, __m128i b) {
  return (__m128i)((__v16qi)a - (__v16qi)b);
}


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

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

LLVM IR (-O0):
define i64 @_mm_sub_epi8(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = sub nsw i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @_mm_sub_epi8(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ init_extensions();
int /*<<< orphan*/ print_license();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  print_license();
  init_extensions();
  printf("Extensions loaded.\n");
  while (1) {
    printf("system sleeping...\n");
    sleep(5);
  }
  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)
mov    $0x0,%al
call   1050 <print_license@plt>
mov    $0x0,%al
call   1040 <init_extensions@plt>
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1060 <sleep@plt>
jmp    1170 <main+0x30>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <print_license@plt>
xor    %eax,%eax
call   1040 <init_extensions@plt>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb1(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
call   1060 <sleep@plt>
jmp    1170 <main+0x30>

LLVM IR (-O0):
@.str = [20 x i8] c"Extensions loaded.\0A\00"
@.str.1 = [20 x i8] c"system sleeping...\0A\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 (...) @print_license()
%7 = call i32 (...) @init_extensions()
%8 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %2, %9
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @sleep(i32 5)
br label %9
}

LLVM IR (-O2):
@str = [19 x i8] c"Extensions loaded.\00"
@str.2 = [19 x i8] c"system sleeping...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @print_license()
%4 = tail call i32 (...) @init_extensions()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %2, %6
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.2, i64 0, i64 0))
%8 = tail call i32 @sleep(i32 5)
br label %6
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int _usage(void) {
  fputs("Usage: "
        "nice"
        " [-n increment] utility [argument...]\n  -n	Priority to set\n",
        stderr);
  return 1;
}


x86 assembly (clang, -O0):
<_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_usage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [71 x i8] c"Usage: nice [-n increment] utility [argument...]\0A -n\09Priority to set\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [71 x i8] c"Usage: nice [-n increment] utility [argument...]\0A -n\09Priority to set\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int file_exists(char *filename) {
  FILE *f;
  f = fopen(filename, "rb");
  if (f)
    fclose(f);
  return (f != 0);
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1154 <file_exists+0x34>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rbx
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113d <file_exists+0x1d>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
test   %rbx,%rbx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define i32 @file_exists(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = call i32 @fclose(i32* %9)
br label %11
11: ; preds = %8, %1
%12 = load i32*, i32** %3
%13 = icmp ne i32* %12, null
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define i32 @file_exists(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %4, %1
%7 = zext i1 %3 to i32
ret i32 %7
}
main() {
  int i, f = 1;
  for (i = 6; i; i -= 1) {
    f *= i;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x6,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113b <main+0x3b>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
mov    -0x4(%rbp),%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
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
store i32 6, i32* %2
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = mul nsw i32 %9, %8
store i32 %10, i32* %3
br label %11
11: ; preds = %7
%12 = load i32, i32* %2
%13 = sub nsw i32 %12, 1
store i32 %13, i32* %2
br label %4
14: ; preds = %4
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(size_t);
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char const *);
char *allocstring(const char *buffer) {
  size_t length = strlen(buffer);
  char *str = (char *)malloc(length);
  strcpy(str, buffer);
  return str;
}


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

x86 assembly (clang, -O2):
<allocstring>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %rax,%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @allocstring(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = call i64 @malloc(i64 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = load i8*, i8** %4
ret i8* %13
}

LLVM IR (-O2):
define i8* @allocstring(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = tail call i64 @malloc(i64 %2)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void USB_EndPoint9(uint32_t event) {}


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

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

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

LLVM IR (-O2):
define void @USB_EndPoint9(i32 %0) {
ret void
}
_Noreturn int main(void) { exit(0); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
unreachable
}

LLVM IR (-O2):
define i32 @main() {
tail call void @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ pi(int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  srand(time(0));
  for (int i = 0; i < 30; ++i)
    printf("%.40Lf\n", pi(1 << i));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x1e,-0x8(%rbp)
jge    1199 <main+0x59>
mov    -0x8(%rbp),%ecx
mov    $0x1,%edi
shl    %cl,%edi
call   1060 <pi@plt>
mov    %eax,%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1164 <main+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
lea    0xea5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
mov    %ebx,%ecx
shl    %cl,%edi
call   1060 <pi@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x1e,%ebx
jne    1160 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%.40Lf\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32 0)
%2 = tail call i32 @srand(i32 %1)
br label %4
3: ; preds = %4
ret i32 0
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %9, %4 ]
%6 = shl nuw nsw i32 1, %5
%7 = tail call i32 @pi(i32 %6)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = add nuw nsw i32 %5, 1
%10 = icmp eq i32 %9, 30
br i1 %10, label %3, label %4
}
/* Variables and functions */
unsigned int getpid();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
void aleainit() { srand((unsigned)time(NULL) + getpid()); }


x86 assembly (clang, -O0):
<aleainit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x4(%rbp),%edi
add    %eax,%edi
call   1040 <srand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aleainit>:
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <getpid@plt>
add    %eax,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1040 <srand@plt>

LLVM IR (-O0):
define void @aleainit() {
%1 = call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = call i32 (...) @getpid()
%4 = add i32 %2, %3
%5 = call i32 @srand(i32 %4)
ret void
}

LLVM IR (-O2):
define void @aleainit() {
%1 = tail call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = tail call i32 (...) @getpid()
%4 = add i32 %3, %2
%5 = tail call i32 @srand(i32 %4)
ret void
}
/* Variables and functions */
int bar();
int baz();
int foo();
int main() {
  if (1)
    return foo() + bar() + baz();
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <foo@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <bar@plt>
mov    %eax,%ebp
add    %ebx,%ebp
xor    %eax,%eax
call   1030 <baz@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @bar()
%3 = add nsw i32 %2, %1
%4 = tail call i32 (...) @baz()
%5 = add nsw i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ _SC_PAGESIZE;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ logger(int, int /*<<< orphan*/, char *);
long sysconf(int /*<<< orphan*/);
int get_pagesize() {
  long pagesize;
  if ((pagesize = sysconf(_SC_PAGESIZE)) == -1) {
    logger(-1, errno, "Unable to get page size");
    return -1;
  }
  return pagesize;
}


x86 assembly (clang, -O0):
<get_pagesize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
mov    %rax,-0x10(%rbp)
cmp    $0xffffffffffffffff,%rax
jne    116a <get_pagesize+0x4a>
mov    0x2e8d(%rip),%rax
mov    (%rax),%esi
mov    $0xffffffff,%edi
lea    0xea7(%rip),%rdx
call   1030 <logger@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <get_pagesize+0x51>
mov    -0x10(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_pagesize>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
cmp    $0xffffffffffffffff,%rax
je     113a <get_pagesize+0x1a>
mov    %rax,%rbx
jmp    1159 <get_pagesize+0x39>
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
lea    0xeb6(%rip),%rdx
mov    $0xffffffff,%ebx
mov    $0xffffffff,%edi
call   1030 <logger@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@_SC_PAGESIZE = global i32 0
@errno = global i32 0
@.str = [24 x i8] c"Unable to get page size\00"
define i32 @get_pagesize() {
%1 = alloca i32
%2 = alloca i64
%3 = load i32, i32* @_SC_PAGESIZE
%4 = call i64 @sysconf(i32 %3)
store i64 %4, i64* %2
%5 = icmp eq i64 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i32, i32* @errno
%8 = call i32 @logger(i32 -1, i32 %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %12
9: ; preds = %0
%10 = load i64, i64* %2
%11 = trunc i64 %10 to i32
store i32 %11, i32* %1
br label %12
12: ; preds = %9, %6
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@_SC_PAGESIZE = global i32 0
@errno = global i32 0
@.str = [24 x i8] c"Unable to get page size\00"
define i32 @get_pagesize() {
%1 = load i32, i32* @_SC_PAGESIZE
%2 = tail call i64 @sysconf(i32 %1)
%3 = icmp eq i64 %2, -1
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* @errno
%6 = tail call i32 @logger(i32 -1, i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %0
%8 = trunc i64 %2 to i32
br label %9
9: ; preds = %7, %4
%10 = phi i32 [ -1, %4 ], [ %8, %7 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int sum = 0, index = 1, next_number = 1;
  while (next_number <= 310) {
    sum += next_number;
    next_number += index;
    index++;
  }
  printf("計算結果: %d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x136,-0x10(%rbp)
jg     1161 <main+0x51>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1134 <main+0x24>
mov    -0x8(%rbp),%esi
lea    0xe95(%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    $0xa41,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\E8\A8\88\E7\AE\97\E7\B5\90\E6\9E\9C: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %8, %0
%6 = load i32, i32* %4
%7 = icmp sle i32 %6, 310
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %4
%10 = load i32, i32* %2
%11 = add nsw i32 %10, %9
store i32 %11, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = add nsw i32 %13, %12
store i32 %14, i32* %4
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %5
17: ; preds = %5
%18 = load i32, i32* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"\E8\A8\88\E7\AE\97\E7\B5\90\E6\9E\9C: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 2625)
ret i32 0
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t count_bits8(uint64_t x) {
  x -= (x >> 1) & 0x5555555555555555;
  x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333);
  x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f;
  return x;
}


x86 assembly (clang, -O0):
<count_bits8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
movslq %eax,%rcx
movabs $0x5555555555555555,%rax
55 55 55
and    %rax,%rcx
movslq -0x4(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0x3333333333333333,%rcx
33 33 33
and    %rcx,%rax
mov    -0x4(%rbp),%ecx
sar    $0x2,%ecx
movslq %ecx,%rcx
movabs $0x3333333333333333,%rdx
33 33 33
and    %rdx,%rcx
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x4,%ecx
add    %ecx,%eax
cltq
movabs $0xf0f0f0f0f0f0f0f,%rcx
0f 0f 0f
and    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_bits8>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%ecx
and    $0x33333333,%ecx
shr    $0x2,%edi
and    $0x33333333,%edi
add    %edi,%ecx
mov    %ecx,%eax
shr    $0x4,%eax
add    %ecx,%eax
and    $0xf0f0f0f,%eax
ret

LLVM IR (-O0):
define i32 @count_bits8(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
%5 = sext i32 %4 to i64
%6 = and i64 %5, 6148914691236517205
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = sub nsw i64 %8, %6
%10 = trunc i64 %9 to i32
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = and i64 %12, 3689348814741910323
%14 = load i32, i32* %2
%15 = ashr i32 %14, 2
%16 = sext i32 %15 to i64
%17 = and i64 %16, 3689348814741910323
%18 = add nsw i64 %13, %17
%19 = trunc i64 %18 to i32
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = load i32, i32* %2
%22 = ashr i32 %21, 4
%23 = add nsw i32 %20, %22
%24 = sext i32 %23 to i64
%25 = and i64 %24, 1085102592571150095
%26 = trunc i64 %25 to i32
store i32 %26, i32* %2
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @count_bits8(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = sub i32 %0, %3
%5 = and i32 %4, 858993459
%6 = lshr i32 %4, 2
%7 = and i32 %6, 858993459
%8 = add nuw nsw i32 %7, %5
%9 = lshr i32 %8, 4
%10 = add nuw nsw i32 %9, %8
%11 = and i32 %10, 252645135
ret i32 %11
}
/* Type definitions */
struct matrix {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mat_invert_copy(struct matrix *, struct matrix *);
void mat_invert(struct matrix *m) { mat_invert_copy(m, m); }


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

x86 assembly (clang, -O2):
<mat_invert>:
mov    %rdi,%rsi
jmp    1030 <mat_invert_copy@plt>

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

LLVM IR (-O2):
%struct.matrix = type { i32 }
define void @mat_invert(%struct.matrix* %0) {
%2 = tail call i32 @mat_invert_copy(%struct.matrix* %0, %struct.matrix* %0)
ret void
}
/* Variables and functions */
char _jstime_isleapyear(int);
char jstime_isleapyear(int year) { return _jstime_isleapyear(year); }


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

x86 assembly (clang, -O2):
<jstime_isleapyear>:
jmp    1030 <_jstime_isleapyear@plt>

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

LLVM IR (-O2):
define signext i8 @jstime_isleapyear(i32 %0) {
%2 = tail call signext i8 @_jstime_isleapyear(i32 %0)
ret i8 %2
}
/* Variables and functions */
int *malloc(int);
int main(void) {
  int y __attribute__((unused));
  int *x = malloc(sizeof(int) * 100);
  y = x[95];
  y = x[100];
  y = x[-1];
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32* @malloc(i32 400)
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 95
%7 = load i32, i32* %6
store i32 %7, i32* %2
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 100
%10 = load i32, i32* %9
store i32 %10, i32* %2
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 -1
%13 = load i32, i32* %12
store i32 %13, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 400)
ret i32 0
}
int main() {
  int b;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%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
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strcmp(char *, char *);
int main() {
  char *s1 = "apple";
  char *s2 = "belly";
  int r = strcmp(s1, s2);
  printf("s1 compared with s2 r = %d\n", r);
  r = strcmp(s2, s1);
  printf("s2 compared with s1 r = %d\n", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xec5(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"apple\00"
@.str.1 = [6 x i8] c"belly\00"
@.str.2 = [28 x i8] c"s1 compared with s2 r = %d\0A\00"
@.str.3 = [28 x i8] c"s2 compared with s1 r = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
%5 = load i8*, i8** %2
%6 = load i8*, i8** %3
%7 = call i32 @strcmp(i8* %5, i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i8*, i8** %3
%11 = load i8*, i8** %2
%12 = call i32 @strcmp(i8* %10, i8* %11)
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [28 x i8] c"s1 compared with s2 r = %d\0A\00"
@.str.3 = [28 x i8] c"s2 compared with s1 r = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 1)
ret i32 0
}
unsigned XXH_versionNumber(void) { return (0 * 100 * 100 + 6 * 100 + 5); }


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

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

LLVM IR (-O0):
define i32 @XXH_versionNumber() {
ret i32 605
}

LLVM IR (-O2):
define i32 @XXH_versionNumber() {
ret i32 605
}
int getremain(unsigned long sz, int dv) {
  int r;
  r = sz / dv;
  r++;
  r = r * dv;
  r = r - sz;
  return (r);
}


x86 assembly (clang, -O0):
<getremain>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movslq -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getremain>:
movslq %esi,%rcx
mov    %rdi,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1119 <getremain+0x19>
mov    %rdi,%rax
xor    %edx,%edx
div    %rcx
jmp    111f <getremain+0x1f>
mov    %edi,%eax
xor    %edx,%edx
div    %esi
add    $0x1,%eax
imul   %esi,%eax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @getremain(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%6 = load i64, i64* %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = udiv i64 %6, %8
%10 = trunc i64 %9 to i32
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = mul nsw i32 %13, %14
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = load i64, i64* %3
%19 = sub i64 %17, %18
%20 = trunc i64 %19 to i32
store i32 %20, i32* %5
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
define i32 @getremain(i64 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = udiv i64 %0, %3
%5 = trunc i64 %4 to i32
%6 = add nsw i32 %5, 1
%7 = mul nsw i32 %6, %1
%8 = trunc i64 %0 to i32
%9 = sub i32 %7, %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ acos(int /*<<< orphan*/);
float glmDegf(int /*<<< orphan*/);
int /*<<< orphan*/ glmDotProduct4f(float const *, float const *);
float glmComputeNormalizedVectorAngle4fDeg(const float v1[4],
                                           const float v2[4]) {
  return glmDegf(acos(glmDotProduct4f(v1, v2)));
}


x86 assembly (clang, -O0):
<glmComputeNormalizedVectorAngle4fDeg>:
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 <glmDotProduct4f@plt>
mov    %eax,%edi
call   1040 <acos@plt>
mov    %eax,%edi
call   1050 <glmDegf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmComputeNormalizedVectorAngle4fDeg>:
push   %rax
call   1030 <glmDotProduct4f@plt>
mov    %eax,%edi
call   1040 <acos@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <glmDegf@plt>

LLVM IR (-O0):
define float @glmComputeNormalizedVectorAngle4fDeg(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
store float* %0, float** %3
store float* %1, float** %4
%5 = load float*, float** %3
%6 = load float*, float** %4
%7 = call i32 @glmDotProduct4f(float* %5, float* %6)
%8 = call i32 @acos(i32 %7)
%9 = call float @glmDegf(i32 %8)
ret float %9
}

LLVM IR (-O2):
define float @glmComputeNormalizedVectorAngle4fDeg(float* %0, float* %1) {
%3 = tail call i32 @glmDotProduct4f(float* %0, float* %1)
%4 = tail call i32 @acos(i32 %3)
%5 = tail call float @glmDegf(i32 %4)
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
int inc(int pos, int n) {
  if (pos + n < 100)
    return pos + n;
  else {
    putchar('\n');
    return n;
  }
}


x86 assembly (clang, -O0):
<inc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x64,%eax
jge    113b <inc+0x2b>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114b <inc+0x3b>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc>:
mov    %edi,%eax
add    %esi,%eax
cmp    $0x64,%eax
jl     1129 <inc+0x19>
push   %rbx
mov    %esi,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @inc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = add nsw i32 %6, %7
%9 = icmp slt i32 %8, 100
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = add nsw i32 %11, %12
store i32 %13, i32* %3
br label %17
14: ; preds = %2
%15 = call i32 @putchar(i8 signext 10)
%16 = load i32, i32* %5
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @inc(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = icmp slt i32 %3, 100
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @putchar(i8 signext 10)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %1, %5 ], [ %3, %2 ]
ret i32 %8
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rmd_f5(uint32_t x, uint32_t y, uint32_t z) { return x ^ (y | ~z); }


x86 assembly (clang, -O0):
<rmd_f5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
or     %edx,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rmd_f5>:
mov    %edx,%eax
not    %eax
or     %esi,%eax
xor    %edi,%eax
ret

LLVM IR (-O0):
define i32 @rmd_f5(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = xor i32 %9, -1
%11 = or i32 %8, %10
%12 = xor i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rmd_f5(i32 %0, i32 %1, i32 %2) {
%4 = xor i32 %2, -1
%5 = or i32 %4, %1
%6 = xor i32 %5, %0
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_p224_sub(uintptr_t, uintptr_t, uintptr_t);
void fiat_p224_sub(uint64_t out1[4], const uint64_t arg1[4],
                   const uint64_t arg2[4]) {
  internal_fiat_p224_sub((uintptr_t)out1, (uintptr_t)arg1, (uintptr_t)arg2);
}


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

x86 assembly (clang, -O2):
<fiat_p224_sub>:
jmp    1030 <internal_fiat_p224_sub@plt>

LLVM IR (-O0):
define void @fiat_p224_sub(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = load i32*, i32** %5
%10 = ptrtoint i32* %9 to i64
%11 = load i32*, i32** %6
%12 = ptrtoint i32* %11 to i64
%13 = call i32 @internal_fiat_p224_sub(i64 %8, i64 %10, i64 %12)
ret void
}

LLVM IR (-O2):
define void @fiat_p224_sub(i32* %0, i32* %1, i32* %2) {
%4 = ptrtoint i32* %0 to i64
%5 = ptrtoint i32* %1 to i64
%6 = ptrtoint i32* %2 to i64
%7 = tail call i32 @internal_fiat_p224_sub(i64 %4, i64 %5, i64 %6)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t lcg_rand(uint32_t *seed) {
  return (*seed = *seed * 1103515245 + 12345);
}


x86 assembly (clang, -O0):
<lcg_rand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x41c64e6d,(%rax),%eax
add    $0x3039,%eax
mov    -0x8(%rbp),%rcx
mov    %eax,(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcg_rand>:
imul   $0x41c64e6d,(%rdi),%eax
add    $0x3039,%eax
mov    %eax,(%rdi)
ret

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

LLVM IR (-O2):
define i32 @lcg_rand(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = mul nsw i32 %2, 1103515245
%4 = add nsw i32 %3, 12345
store i32 %4, i32* %0
ret i32 %4
}
int av_tolower(int c) {
  if (c >= 'A' && c <= 'Z')
    c ^= 0x20;
  return c;
}


x86 assembly (clang, -O0):
<av_tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x41,-0x4(%rbp)
jl     1124 <av_tolower+0x24>
cmpl   $0x5a,-0x4(%rbp)
jg     1124 <av_tolower+0x24>
mov    -0x4(%rbp),%eax
xor    $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_tolower>:
lea    -0x41(%rdi),%ecx
mov    %edi,%eax
xor    $0x20,%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @av_tolower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 65
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 90
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = xor i32 %9, 32
store i32 %10, i32* %2
br label %11
11: ; preds = %8, %5, %1
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @av_tolower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = xor i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}