xunge/DecIR huggingface dataset:
/* Type definitions */
struct tNode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ print_tree_genomes_uncondensed(struct tNode *, int, int *,
                                                  int *, int);
int /*<<< orphan*/ print_tree_nexus(struct tNode *);
void print_tree_uncondensed(struct tNode *tree, int num_genes,
                            int *condense_succ, int *condense_decode,
                            int orig_num_genes) {
  print_tree_nexus(tree);
  print_tree_genomes_uncondensed(tree, num_genes, condense_succ,
                                 condense_decode, orig_num_genes);
  return;
}


x86 assembly (clang, -O0):
<print_tree_uncondensed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <print_tree_nexus@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1040 <print_tree_genomes_uncondensed@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_tree_uncondensed>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r14d
mov    %rcx,%r15
mov    %rdx,%r12
mov    %esi,%ebx
mov    %rdi,%rbp
call   1030 <print_tree_nexus@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14d,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <print_tree_genomes_uncondensed@plt>

LLVM IR (-O0):
%struct.tNode = type { i32 }
define void @print_tree_uncondensed(%struct.tNode* %0, i32 %1, i32* %2, i32* %3, i32 %4) {
%6 = alloca %struct.tNode*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
store %struct.tNode* %0, %struct.tNode** %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%11 = load %struct.tNode*, %struct.tNode** %6
%12 = call i32 @print_tree_nexus(%struct.tNode* %11)
%13 = load %struct.tNode*, %struct.tNode** %6
%14 = load i32, i32* %7
%15 = load i32*, i32** %8
%16 = load i32*, i32** %9
%17 = load i32, i32* %10
%18 = call i32 @print_tree_genomes_uncondensed(%struct.tNode* %13, i32 %14, i32* %15, i32* %16, i32 %17)
ret void
}

LLVM IR (-O2):
%struct.tNode = type { i32 }
define void @print_tree_uncondensed(%struct.tNode* %0, i32 %1, i32* %2, i32* %3, i32 %4) {
%6 = tail call i32 @print_tree_nexus(%struct.tNode* %0)
%7 = tail call i32 @print_tree_genomes_uncondensed(%struct.tNode* %0, i32 %1, i32* %2, i32* %3, i32 %4)
ret void
}
int test_imm_68uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x68 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_68uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 104
%6 = icmp ne i64 %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_68uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 6815744
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void __foo2(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ MC_avg_x_mmx(int, int, int /*<<< orphan*/ *,
                                int /*<<< orphan*/ const *, int);
void MC_avg_x_8_mmx(uint8_t *dest, const uint8_t *ref, int stride, int height) {
  MC_avg_x_mmx(8, height, dest, ref, stride);
}


x86 assembly (clang, -O0):
<MC_avg_x_8_mmx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    $0x8,%edi
call   1030 <MC_avg_x_mmx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MC_avg_x_8_mmx>:
mov    %edx,%r8d
mov    %rsi,%rax
mov    %rdi,%rdx
mov    $0x8,%edi
mov    %ecx,%esi
mov    %rax,%rcx
jmp    1030 <MC_avg_x_mmx@plt>

LLVM IR (-O0):
define void @MC_avg_x_8_mmx(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = load i32*, i32** %5
%11 = load i32*, i32** %6
%12 = load i32, i32* %7
%13 = call i32 @MC_avg_x_mmx(i32 8, i32 %9, i32* %10, i32* %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @MC_avg_x_8_mmx(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = tail call i32 @MC_avg_x_mmx(i32 8, i32 %3, i32* %0, i32* %1, i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int search(int *, int, int);
int main() {
  int arr[] = {2, 3, 1, 5};
  int size = sizeof(arr) / sizeof(arr[0]);
  int find = 1;
  printf("Position of %d is %d\n", find, search(arr, size, find));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x4,-0x24(%rbp)
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1040 <search@plt>
mov    -0x2c(%rbp),%esi
mov    %eax,%edx
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <search@plt>
lea    0xec8(%rip),%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [4 x i32] [i32 2, i32 3, i32 1, i32 5]
@.str = [22 x i8] c"Position of %d is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [4 x i32]* %2 to i8*
store i32 4, i32* %3
store i32 1, i32* %4
%6 = load i32, i32* %4
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @search(i32* %7, i32 %8, i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [4 x i32] [i32 2, i32 3, i32 1, i32 5]
@.str = [22 x i8] c"Position of %d is %d\0A\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @search(i32* %3, i32 4, i32 1)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 1, i32 %4)
ret i32 0
}
void *SAL_Socket_CallbackWorker_Run(void *startupArgument) { startupArgument; }


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

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

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

LLVM IR (-O2):
define noalias i8* @SAL_Socket_CallbackWorker_Run(i8* nocapture readnone %0) {
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("syntax: \ndirewrite source dest.\nsource is the path to the source "
         "directory while dest is the path to the destination directory.\n");
  return;
}


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

x86 assembly (clang, -O2):
<print_usage>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [129 x i8] c"syntax: \0Adirewrite source dest.\0Asource is the path to the source directory while dest is the path to the destination directory.\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [128 x i8] c"syntax: \0Adirewrite source dest.\0Asource is the path to the source directory while dest is the path to the destination directory.\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([128 x i8], [128 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime_r(int /*<<< orphan*/ *, struct tm *);
void test(void) {
  time_t time;
  struct tm *timestruct_pointer;
  struct tm timestruct;
  timestruct_pointer = localtime_r(&time, &timestruct);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    %rax,-0x10(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <localtime_r@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define void @test() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca %struct.tm
%4 = call %struct.tm* @localtime_r(i32* %1, %struct.tm* %3)
store %struct.tm* %4, %struct.tm** %2
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define void @test() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = bitcast i32* %1 to i8*
%4 = bitcast %struct.tm* %2 to i8*
%5 = call %struct.tm* @localtime_r(i32* %1, %struct.tm* %2)
ret void
}
/* Variables and functions */
int fabsf(float);
unsigned char is_equal(float a, float b) { return fabsf(a - b) < 1e-5; }


x86 assembly (clang, -O0):
<is_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
call   1030 <fabsf@plt>
cvtsi2sd %eax,%xmm1
movsd  0xec3(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_equal>:
push   %rax
subss  %xmm1,%xmm0
call   1030 <fabsf@plt>
test   %eax,%eax
setle  %al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i8 @is_equal(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 = fsub float %5, %6
%8 = call i32 @fabsf(float %7)
%9 = sitofp i32 %8 to double
%10 = fcmp olt double %9, 1.000000e-05
%11 = zext i1 %10 to i32
%12 = trunc i32 %11 to i8
ret i8 %12
}

LLVM IR (-O2):
define zeroext i8 @is_equal(float %0, float %1) {
%3 = fsub float %0, %1
%4 = tail call i32 @fabsf(float %3)
%5 = icmp slt i32 %4, 1
%6 = zext i1 %5 to i8
ret i8 %6
}
/* Variables and functions */
int /*<<< orphan*/ callrts(char *);
asl() { callrts("ccasl"); }


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

x86 assembly (clang, -O2):
<asl>:
lea    0xee9(%rip),%rdi
jmp    1030 <callrts@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"ccasl\00"
define i32 @asl() {
%1 = tail call i32 @callrts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
void sprint_rr(char *str) { sprintf(str, "RR    A                         "); }


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

x86 assembly (clang, -O2):
<sprint_rr>:
movups 0xf09(%rip),%xmm0
movups %xmm0,0x10(%rdi)
movups 0xeee(%rip),%xmm0
movups %xmm0,(%rdi)
movb   $0x0,0x20(%rdi)
ret

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

LLVM IR (-O2):
@.str = [33 x i8] c"RR A \00"
define void @sprint_rr(i8* nocapture writeonly %0) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(33) %0, i8* align 1 dereferenceable(33) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 33, i1 false)
ret void
}
/* Variables and functions */
size_t strlen(const char *str) {
  size_t len = 0;
  while (*str++) {
    len++;
  }
  return len;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1139 <strlen+0x39>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(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 i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i64 %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 i64 [ 0, %1 ], [ %8, %4 ]
ret i64 %12
}
/* Variables and functions */
int isalpha(int);
int first(int c) { return isalpha(c); }


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

x86 assembly (clang, -O2):
<first>:
jmp    1030 <isalpha@plt>

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

LLVM IR (-O2):
define i32 @first(i32 %0) {
%2 = tail call i32 @isalpha(i32 %0)
ret i32 %2
}
/* Variables and functions */
int square(char, char);
int stringToSquare(char *str) {
  return str[0] == '-' ? -1 : square(str[1] - '1', str[0] - 'a');
}


x86 assembly (clang, -O0):
<stringToSquare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1139 <stringToSquare+0x29>
mov    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    115e <stringToSquare+0x4e>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
sub    $0x31,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x61,%eax
movsbl %cl,%edi
movsbl %al,%esi
call   1030 <square@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringToSquare>:
mov    (%rdi),%al
cmp    $0x2d,%al
jne    111c <stringToSquare+0xc>
mov    $0xffffffff,%eax
ret
mov    0x1(%rdi),%cl
add    $0xcf,%cl
add    $0x9f,%al
movsbl %al,%esi
movsbl %cl,%edi
jmp    1030 <square@plt>

LLVM IR (-O0):
define i32 @stringToSquare(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 45
br i1 %7, label %8, label %9
8: ; preds = %1
br label %23
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 49
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = sub nsw i32 %19, 97
%21 = trunc i32 %20 to i8
%22 = call i32 @square(i8 signext %15, i8 signext %21)
br label %23
23: ; preds = %9, %8
%24 = phi i32 [ -1, %8 ], [ %22, %9 ]
ret i32 %24
}

LLVM IR (-O2):
define i32 @stringToSquare(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 45
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = add i8 %6, -49
%8 = add i8 %2, -97
%9 = tail call i32 @square(i8 signext %7, i8 signext %8)
br label %10
10: ; preds = %1, %4
%11 = phi i32 [ %9, %4 ], [ -1, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ foo(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test(int, int /*<<< orphan*/);
int /*<<< orphan*/ test2(int, int /*<<< orphan*/);
int main() {
  foo(10, 0);
  test(10, 0);
  test2(10, 0);
  {
    printf("Success\n");
    exit(0);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
xor    %esi,%esi
call   1040 <foo@plt>
mov    $0xa,%edi
xor    %esi,%esi
call   1070 <test@plt>
mov    $0xa,%edi
xor    %esi,%esi
call   1050 <test2@plt>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
xor    %esi,%esi
call   1040 <foo@plt>
mov    $0xa,%edi
xor    %esi,%esi
call   1070 <test@plt>
mov    $0xa,%edi
xor    %esi,%esi
call   1050 <test2@plt>
lea    0xe84(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"Success\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i32 10, i32 0)
%3 = call i32 @test(i32 10, i32 0)
%4 = call i32 @test2(i32 10, i32 0)
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [8 x i8] c"Success\00"
define i32 @main() {
%1 = tail call i32 @foo(i32 10, i32 0)
%2 = tail call i32 @test(i32 10, i32 0)
%3 = tail call i32 @test2(i32 10, i32 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main(int argc, char **argv) {
  setlocale(0, "portuguese");
  printf("Seu sistema é LINUX!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
lea    0xec8(%rip),%rsi
call   1040 <setlocale@plt>
lea    0xec7(%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),%rsi
xor    %edi,%edi
call   1040 <setlocale@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"portuguese\00"
@.str.1 = [23 x i8] c"Seu sistema \C3\A9 LINUX!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @setlocale(i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"portuguese\00"
@str = [22 x i8] c"Seu sistema \C3\A9 LINUX!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @setlocale(i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int justhere(int local) { return 3; }


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

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

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

LLVM IR (-O2):
define i32 @justhere(i32 %0) {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int hello1() {
  printf("Hello, world!");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, world!\00"
define i32 @hello1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello, world!\00"
define i32 @hello1() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void output(int array[], int length) {
  int i = 0;
  for (i = 0; i < length; i++) {
    printf("%4d", array[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1160 <output+0x50>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <output+0x1d>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <output+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <output+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%4d\00"
define void @output(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ InitSD();
int /*<<< orphan*/ Nand_Init();
int /*<<< orphan*/ SD_Init();
void sdmmc_sdcard_init() {
  InitSD();
  Nand_Init();
  SD_Init();
}


x86 assembly (clang, -O0):
<sdmmc_sdcard_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <InitSD@plt>
mov    $0x0,%al
call   1040 <Nand_Init@plt>
mov    $0x0,%al
call   1050 <SD_Init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdmmc_sdcard_init>:
push   %rax
xor    %eax,%eax
call   1030 <InitSD@plt>
xor    %eax,%eax
call   1040 <Nand_Init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <SD_Init@plt>

LLVM IR (-O0):
define void @sdmmc_sdcard_init() {
%1 = call i32 (...) @InitSD()
%2 = call i32 (...) @Nand_Init()
%3 = call i32 (...) @SD_Init()
ret void
}

LLVM IR (-O2):
define void @sdmmc_sdcard_init() {
%1 = tail call i32 (...) @InitSD()
%2 = tail call i32 (...) @Nand_Init()
%3 = tail call i32 (...) @SD_Init()
ret void
}
/* Variables and functions */
bool nrf52_errata_179(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_179() {
ret i32 0
}
/* Type definitions */
struct UPnPService {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void AVRCP_ResponseSink_AVTransport_Play(struct UPnPService *Service,
                                         int ErrorCode, void *User) {
  printf("AVRCP_ Invoke Response: AVTransport/Play[ErrorCode:%d]()\r\n",
         ErrorCode);
}


x86 assembly (clang, -O0):
<AVRCP_ResponseSink_AVTransport_Play>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AVRCP_ResponseSink_AVTransport_Play>:
lea    0xee9(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.UPnPService = type { i32 }
@.str = [59 x i8] c"AVRCP_ Invoke Response: AVTransport/Play[ErrorCode:%d]()\0D\0A\00"
define void @AVRCP_ResponseSink_AVTransport_Play(%struct.UPnPService* %0, i32 %1, i8* %2) {
%4 = alloca %struct.UPnPService*
%5 = alloca i32
%6 = alloca i8*
store %struct.UPnPService* %0, %struct.UPnPService** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
%struct.UPnPService = type { i32 }
@.str = [59 x i8] c"AVRCP_ Invoke Response: AVTransport/Play[ErrorCode:%d]()\0D\0A\00"
define void @AVRCP_ResponseSink_AVTransport_Play(%struct.UPnPService* nocapture readnone %0, i32 %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
void mystrcpy(char dest[], char src[]) {
  size_t i = 0;
  while ((dest[i] = src[i]) != '\0')
    ++i;
}


x86 assembly (clang, -O0):
<mystrcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0x0,%eax
je     1147 <mystrcpy+0x47>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <mystrcpy+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrcpy>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <mystrcpy+0x10>
ret

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

LLVM IR (-O2):
define void @mystrcpy(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ 0, %2 ], [ %9, %3 ]
%5 = getelementptr inbounds i8, i8* %1, i64 %4
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %0, i64 %4
store i8 %6, i8* %7
%8 = icmp eq i8 %6, 0
%9 = add i64 %4, 1
br i1 %8, label %10, label %3
10: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ testfcchol();
int /*<<< orphan*/ testfcinv();
int /*<<< orphan*/ testfrchol();
int /*<<< orphan*/ testfrgolub();
int /*<<< orphan*/ testfrinv();
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  srandom(time(NULL));
  testfrgolub();
  testfrinv();
  testfrchol();
  testfcinv();
  testfcchol();
  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)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
mov    $0x0,%al
call   1070 <testfrgolub@plt>
mov    $0x0,%al
call   1090 <testfrinv@plt>
mov    $0x0,%al
call   1050 <testfrchol@plt>
mov    $0x0,%al
call   1080 <testfcinv@plt>
mov    $0x0,%al
call   1040 <testfcchol@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1070 <testfrgolub@plt>
xor    %eax,%eax
call   1090 <testfrinv@plt>
xor    %eax,%eax
call   1050 <testfrchol@plt>
xor    %eax,%eax
call   1080 <testfcinv@plt>
xor    %eax,%eax
call   1040 <testfcchol@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**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @time(i32* null)
%7 = call i32 @srandom(i32 %6)
%8 = call i32 (...) @testfrgolub()
%9 = call i32 (...) @testfrinv()
%10 = call i32 (...) @testfrchol()
%11 = call i32 (...) @testfcinv()
%12 = call i32 (...) @testfcchol()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srandom(i32 %3)
%5 = tail call i32 (...) @testfrgolub()
%6 = tail call i32 (...) @testfrinv()
%7 = tail call i32 (...) @testfrchol()
%8 = tail call i32 (...) @testfcinv()
%9 = tail call i32 (...) @testfcchol()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void Puts(int *c) {
  char ch;
  while (*c != '\0') {
    ch = *c;
    putchar(ch);
    c++;
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<Puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
je     114c <Puts+0x3c>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <Puts+0xc>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Puts>:
push   %rbx
mov    (%rdi),%eax
test   %eax,%eax
je     1132 <Puts+0x22>
mov    %rdi,%rbx
add    $0x4,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    (%rbx),%eax
add    $0x4,%rbx
test   %eax,%eax
jne    1120 <Puts+0x10>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @Puts(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %10, %4 ], [ %2, %1 ]
%6 = phi i32* [ %9, %4 ], [ %0, %1 ]
%7 = trunc i32 %5 to i8
%8 = tail call i32 @putchar(i8 signext %7)
%9 = getelementptr inbounds i32, i32* %6, i64 1
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = tail call i32 @putchar(i8 signext 10)
ret void
}
/* Variables and functions */
int numa_node_id();
int numa_mem_id(void) { return numa_node_id(); }


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

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

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

LLVM IR (-O2):
define i32 @numa_mem_id() {
%1 = tail call i32 (...) @numa_node_id()
ret i32 %1
}
/* Variables and functions */
unsigned int bit_propagate_ones_towards_right(unsigned int);
unsigned int bit_align_up_nearest_pow2(unsigned int n) {
  n--;
  n = bit_propagate_ones_towards_right(n);
  return n + 1;
}


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

x86 assembly (clang, -O2):
<bit_align_up_nearest_pow2>:
push   %rax
add    $0xffffffff,%edi
call   1030 <bit_propagate_ones_towards_right@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bit_align_up_nearest_pow2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, -1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @bit_propagate_ones_towards_right(i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = add i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @bit_align_up_nearest_pow2(i32 %0) {
%2 = add i32 %0, -1
%3 = tail call i32 @bit_propagate_ones_towards_right(i32 %2)
%4 = add i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int open(char const *, int);
int multimap_open(const char *path, int flags) { return open(path, flags); }


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

x86 assembly (clang, -O2):
<multimap_open>:
jmp    1030 <open@plt>

LLVM IR (-O0):
define i32 @multimap_open(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 = load i32, i32* %4
%7 = call i32 @open(i8* %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @multimap_open(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @open(i8* %0, i32 %1)
ret i32 %3
}
OP(fd, cf) {
  illegal_1();
  op_cf();
}


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_1()
%4 = tail call i32 (...) @op_cf()
ret i32 undef
}
void gfarm_timerval_calibrate(void) {}


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

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

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

LLVM IR (-O2):
define void @gfarm_timerval_calibrate() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ endpwent();
void sys_endpwent(void) { endpwent(); }


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

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

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

LLVM IR (-O2):
define void @sys_endpwent() {
%1 = tail call i32 (...) @endpwent()
ret void
}
unsigned xrop3_103_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = T | S;
  stk3 = ~stk3;
  stk2 = D | stk3;
  stk1 = S ^ stk2;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_103_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_103_1_1>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%eax
shl    $0x8,%eax
or     %esi,%eax
or     %ecx,%eax
not    %eax
or     %edi,%esi
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_103_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = load i32, i32* %6
%25 = or i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %10
%27 = xor i32 %26, -1
store i32 %27, i32* %10
%28 = load i32, i32* %5
%29 = load i32, i32* %10
%30 = or i32 %28, %29
store i32 %30, i32* %9
%31 = load i32, i32* %6
%32 = load i32, i32* %9
%33 = xor i32 %31, %32
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = load i32, i32* %6
%36 = xor i32 %35, -1
%37 = and i32 %34, %36
%38 = load i32, i32* %7
%39 = xor i32 %38, -1
%40 = and i32 %37, %39
%41 = load i32, i32* %5
%42 = load i32, i32* %6
%43 = and i32 %41, %42
%44 = or i32 %40, %43
%45 = load i32, i32* %5
%46 = load i32, i32* %7
%47 = and i32 %45, %46
%48 = or i32 %44, %47
ret i32 %48
}

LLVM IR (-O2):
define i32 @xrop3_103_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = or i32 %4, %5
%8 = or i32 %7, %6
%9 = xor i32 %8, -1
%10 = or i8 %1, %0
%11 = zext i8 %10 to i32
%12 = or i32 %11, %9
ret i32 %12
}
int comment(const char *s) {
  while (*s == ' ' || *s == '\t')
    s++;
  return !*s || *s == '#';
}


x86 assembly (clang, -O0):
<comment>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x9(%rbp)
je     112d <comment+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <comment+0x3d>
jmp    114e <comment+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <comment+0x8>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpb   $0x0,(%rcx)
mov    %al,-0xa(%rbp)
je     1170 <comment+0x70>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
sete   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<comment>:
jmp    1114 <comment+0x14>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0x9,%cl
je     1110 <comment+0x10>
cmp    $0x20,%cl
je     1110 <comment+0x10>
test   %cl,%cl
jne    112b <comment+0x2b>
mov    $0x1,%eax
ret
xor    %eax,%eax
cmp    $0x23,%cl
sete   %al
ret

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

LLVM IR (-O2):
define i32 @comment(i8* nocapture %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
i8 0, label %10
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
%8 = icmp eq i8 %4, 35
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %2, %7
%11 = phi i32 [ %9, %7 ], [ 1, %2 ]
ret i32 %11
}
int isspace(int c) {
  return c == '\t' || c == '\n' || c == '\v' || c == '\f' || c == '\r' ||
         c == ' ';
}


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x9,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <isspace+0x5c>
mov    $0x1,%al
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <isspace+0x5c>
mov    $0x1,%al
cmpl   $0xb,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <isspace+0x5c>
mov    $0x1,%al
cmpl   $0xc,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <isspace+0x5c>
mov    $0x1,%al
cmpl   $0xd,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <isspace+0x5c>
cmpl   $0x20,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
lea    -0x9(%rdi),%eax
cmp    $0x5,%eax
setb   %al
cmp    $0x20,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
%2 = add i32 %0, -9
%3 = icmp ult i32 %2, 5
%4 = icmp eq i32 %0, 32
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
int run(int n) {
  int i = n, sum = 0;
  while (i >= 0) {
    sum = sum + i;
    i = i - 1;
  }
  return sum;
}


x86 assembly (clang, -O0):
<run>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1135 <run+0x35>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1114 <run+0x14>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<run>:
test   %edi,%edi
js     1118 <run+0x18>
mov    %edi,%eax
mov    %edi,%ecx
lea    -0x1(%rax),%edx
imul   %rcx,%rdx
shr    %rdx
imul   %eax,%eax
sub    %edx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @run(i32 %0) {
%2 = icmp sgt i32 %0, -1
br i1 %2, label %3, label %12
3: ; preds = %1
%4 = zext i32 %0 to i33
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = mul i33 %4, %6
%8 = lshr i33 %7, 1
%9 = trunc i33 %8 to i32
%10 = mul i32 %0, %0
%11 = sub i32 %10, %9
br label %12
12: ; preds = %3, %1
%13 = phi i32 [ 0, %1 ], [ %11, %3 ]
ret i32 %13
}
/* Type definitions */
struct test_type_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ test_assert(int);
int a_func(struct test_type_t *tttttttt) {
  test_assert(1);
  return 1;
}


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

x86 assembly (clang, -O2):
<a_func>:
push   %rax
mov    $0x1,%edi
call   1030 <test_assert@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.test_type_t = type { i32 }
define i32 @a_func(%struct.test_type_t* %0) {
%2 = alloca %struct.test_type_t*
store %struct.test_type_t* %0, %struct.test_type_t** %2
%3 = call i32 @test_assert(i32 1)
ret i32 1
}

LLVM IR (-O2):
%struct.test_type_t = type { i32 }
define i32 @a_func(%struct.test_type_t* nocapture readnone %0) {
%2 = tail call i32 @test_assert(i32 1)
ret i32 1
}