xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ assert_equal_str(int /*<<< orphan*/ *, char *, char *,
                                    char *);
char *pl_slice(char *, int /*<<< orphan*/, int);
void test_slice_limit_oor() {
  char the_string[] = "spam, eggs, and ham";
  char *ret_val;
  ret_val = pl_slice(the_string, 0, 99);
  assert_equal_str(NULL, ret_val, "test_slice_limit_oor",
                   "The ret_val was not NULL.");
}


x86 assembly (clang, -O0):
<test_slice_limit_oor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1040 <pl_slice@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    0xeaa(%rip),%rdx
lea    0xeb8(%rip),%rcx
call   1030 <assert_equal_str@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_slice_limit_oor>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x6d6168,0x10(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x63,%edx
call   1040 <pl_slice@plt>
lea    0xec7(%rip),%rdx
lea    0xed5(%rip),%rcx
xor    %edi,%edi
mov    %rax,%rsi
call   1030 <assert_equal_str@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.test_slice_limit_oor.the_string = [20 x i8] c"spam, eggs, and ham\00"
@.str = [21 x i8] c"test_slice_limit_oor\00"
@.str.1 = [26 x i8] c"The ret_val was not NULL.\00"
define void @test_slice_limit_oor() {
%1 = alloca [20 x i8]
%2 = alloca i8*
%3 = bitcast [20 x i8]* %1 to i8*
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = call i8* @pl_slice(i8* %4, i32 0, i32 99)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @assert_equal_str(i32* null, i8* %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__const.test_slice_limit_oor.the_string = [20 x i8] c"spam, eggs, and ham\00"
@.str = [21 x i8] c"test_slice_limit_oor\00"
@.str.1 = [26 x i8] c"The ret_val was not NULL.\00"
define void @test_slice_limit_oor() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i8* @pl_slice(i8* %2, i32 0, i32 99)
%4 = call i32 @assert_equal_str(i32* null, i8* %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int getMissingNo(int *, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a[] = {1, 2, 4, 5, 6};
  int miss = getMissingNo(a, 5);
  printf("%d", miss);
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xebc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1030 <getMissingNo@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xed6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xebb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1030 <getMissingNo@plt>
lea    0xeb7(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 4, i32 5, i32 6]
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca i32
%3 = bitcast [5 x i32]* %1 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @getMissingNo(i32* %4, i32 5)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 4, i32 5, i32 6]
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i32 @getMissingNo(i32* %3, i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int binExist(char *filename) {
  if (access(filename, F_OK)) {
    printf("Binary non exist!\n");
    exit(1);
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<binExist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%esi
call   1040 <access@plt>
cmp    $0x0,%rax
je     116e <binExist+0x3e>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binExist>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
call   1040 <access@plt>
test   %rax,%rax
jne    1148 <binExist+0x18>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@F_OK = global i32 0
@.str = [19 x i8] c"Binary non exist!\0A\00"
define i32 @binExist(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @F_OK
%5 = call i64 @access(i8* %3, i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 1)
unreachable
10: ; preds = %1
ret i32 0
}

LLVM IR (-O2):
@F_OK = global i32 0
@str = [18 x i8] c"Binary non exist!\00"
define i32 @binExist(i8* nocapture %0) {
%2 = load i32, i32* @F_OK
%3 = tail call i64 @access(i8* %0, i32 %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i32 0
}
/* Variables and functions */
char *_s2_f2cstr(char *, unsigned int);
int /*<<< orphan*/ cs2sptxy(char *, float, float);
int /*<<< orphan*/ free(char *);
void cs2sptxy_(char *prompt, float *xfrac, float *yfrac,
               unsigned int promptlen) {
  char *pp = _s2_f2cstr(prompt, promptlen);
  cs2sptxy(pp, *xfrac, *yfrac);
  free(pp);
}


x86 assembly (clang, -O0):
<cs2sptxy_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1050 <_s2_f2cstr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm1
call   1040 <cs2sptxy@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cs2sptxy_>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %ecx,%esi
call   1050 <_s2_f2cstr@plt>
mov    %rax,%rbx
movss  (%r15),%xmm0
movss  (%r14),%xmm1
mov    %rax,%rdi
call   1040 <cs2sptxy@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @cs2sptxy_(i8* %0, float* %1, float* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca float*
%7 = alloca float*
%8 = alloca i32
%9 = alloca i8*
store i8* %0, i8** %5
store float* %1, float** %6
store float* %2, float** %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = load i32, i32* %8
%12 = call i8* @_s2_f2cstr(i8* %10, i32 %11)
store i8* %12, i8** %9
%13 = load i8*, i8** %9
%14 = load float*, float** %6
%15 = load float, float* %14
%16 = load float*, float** %7
%17 = load float, float* %16
%18 = call i32 @cs2sptxy(i8* %13, float %15, float %17)
%19 = load i8*, i8** %9
%20 = call i32 @free(i8* %19)
ret void
}

LLVM IR (-O2):
define void @cs2sptxy_(i8* %0, float* nocapture %1, float* nocapture %2, i32 %3) {
%5 = tail call i8* @_s2_f2cstr(i8* %0, i32 %3)
%6 = load float, float* %1
%7 = load float, float* %2
%8 = tail call i32 @cs2sptxy(i8* %5, float %6, float %7)
%9 = tail call i32 @free(i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void DefaultPath(char *path, char *basepath) {
  char temp[128];
  if (path[0] == '\\')
    return;
  strcpy(temp, path);
  strcpy(path, basepath);
  strcat(path, temp);
}


x86 assembly (clang, -O0):
<DefaultPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
jne    1148 <DefaultPath+0x28>
jmp    1175 <DefaultPath+0x55>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DefaultPath>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
cmpb   $0x5c,(%rdi)
je     115b <DefaultPath+0x3b>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @DefaultPath(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [128 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 92
br i1 %10, label %11, label %12
11: ; preds = %2
br label %22
12: ; preds = %2
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %3
%17 = load i8*, i8** %4
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = load i8*, i8** %3
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%21 = call i32 @strcat(i8* %19, i8* %20)
br label %22
22: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @DefaultPath(i8* %0, i8* %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 92
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = call i32 @strcpy(i8* %4, i8* %0)
%9 = call i32 @strcpy(i8* %0, i8* %1)
%10 = call i32 @strcat(i8* %0, i8* %4)
br label %11
11: ; preds = %2, %7
ret void
}
/* Type definitions */
struct sshbuf {
  int dummy;
};
typedef int /*<<< orphan*/ EC_KEY;

/* Variables and functions */
int /*<<< orphan*/ EC_KEY_get0_group(int /*<<< orphan*/ const *);
int /*<<< orphan*/ EC_KEY_get0_public_key(int /*<<< orphan*/ const *);
int sshbuf_put_ec(struct sshbuf *, int /*<<< orphan*/, int /*<<< orphan*/);
int sshbuf_put_eckey(struct sshbuf *buf, const EC_KEY *v) {
  return sshbuf_put_ec(buf, EC_KEY_get0_public_key(v), EC_KEY_get0_group(v));
}


x86 assembly (clang, -O0):
<sshbuf_put_eckey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <EC_KEY_get0_public_key@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <EC_KEY_get0_group@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    %eax,%edx
call   1040 <sshbuf_put_ec@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sshbuf_put_eckey>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <EC_KEY_get0_public_key@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <EC_KEY_get0_group@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <sshbuf_put_ec@plt>

LLVM IR (-O0):
%struct.sshbuf = type { i32 }
define i32 @sshbuf_put_eckey(%struct.sshbuf* %0, i32* %1) {
%3 = alloca %struct.sshbuf*
%4 = alloca i32*
store %struct.sshbuf* %0, %struct.sshbuf** %3
store i32* %1, i32** %4
%5 = load %struct.sshbuf*, %struct.sshbuf** %3
%6 = load i32*, i32** %4
%7 = call i32 @EC_KEY_get0_public_key(i32* %6)
%8 = load i32*, i32** %4
%9 = call i32 @EC_KEY_get0_group(i32* %8)
%10 = call i32 @sshbuf_put_ec(%struct.sshbuf* %5, i32 %7, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.sshbuf = type { i32 }
define i32 @sshbuf_put_eckey(%struct.sshbuf* %0, i32* %1) {
%3 = tail call i32 @EC_KEY_get0_public_key(i32* %1)
%4 = tail call i32 @EC_KEY_get0_group(i32* %1)
%5 = tail call i32 @sshbuf_put_ec(%struct.sshbuf* %0, i32 %3, i32 %4)
ret i32 %5
}
/* Variables and functions */
scalar_t__ gt_double_relative_equal(double, double);
int gt_double_compare(double d1, double d2) {
  if (gt_double_relative_equal(d1, d2))
    return 0;
  if (d1 > d2)
    return 1;
  return -1;
}


x86 assembly (clang, -O0):
<gt_double_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <gt_double_relative_equal@plt>
cmp    $0x0,%rax
je     1147 <gt_double_compare+0x37>
movl   $0x0,-0x4(%rbp)
jmp    116a <gt_double_compare+0x5a>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1163 <gt_double_compare+0x53>
movl   $0x1,-0x4(%rbp)
jmp    116a <gt_double_compare+0x5a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gt_double_compare>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
call   1030 <gt_double_relative_equal@plt>
xor    %ecx,%ecx
movsd  0x10(%rsp),%xmm0
ucomisd 0x8(%rsp),%xmm0
seta   %cl
xor    %edx,%edx
test   %rax,%rax
lea    -0x1(%rcx,%rcx,1),%eax
cmovne %edx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @gt_double_compare(double %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = call i64 @gt_double_relative_equal(double %6, double %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 0, i32* %3
br label %17
11: ; preds = %2
%12 = load double, double* %4
%13 = load double, double* %5
%14 = fcmp ogt double %12, %13
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 1, i32* %3
br label %17
16: ; preds = %11
store i32 -1, i32* %3
br label %17
17: ; preds = %16, %15, %10
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @gt_double_compare(double %0, double %1) {
%3 = tail call i64 @gt_double_relative_equal(double %0, double %1)
%4 = icmp eq i64 %3, 0
%5 = fcmp ogt double %0, %1
%6 = select i1 %5, i32 1, i32 -1
%7 = select i1 %4, i32 %6, i32 0
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
uint16_t ext_dev_read_16(uint32_t addr, void *ctxt) { return 0; }


x86 assembly (clang, -O0):
<ext_dev_read_16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ext_dev_read_16(i32 %0, i8* nocapture readnone %1) {
ret i32 0
}
int test_imm_30uint16_reg(unsigned short val) {
  return ((val) & (-0x30 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_30uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffffd0,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_30uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -48
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char, int);
int /*<<< orphan*/ stdout;
void print_item(void *cc, void *e) {
  int *sum = (int *)cc;
  (*sum)++;
  fprintf(stdout, "item(%c) sum: %d\n", *(char *)e, *sum);
}


x86 assembly (clang, -O0):
<print_item>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
lea    0xeb1(%rip),%rsi
movsbl %al,%edx
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_item>:
mov    (%rdi),%ecx
add    $0x1,%ecx
mov    %ecx,(%rdi)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
movsbl (%rsi),%edx
lea    0xed6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [18 x i8] c"item(%c) sum: %d\0A\00"
define void @print_item(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %8
%11 = load i32, i32* @stdout
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = load i32*, i32** %5
%15 = load i32, i32* %14
%16 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 signext %13, i32 %15)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [18 x i8] c"item(%c) sum: %d\0A\00"
define void @print_item(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
store i32 %5, i32* %3
%6 = load i32, i32* @stdout
%7 = load i8, i8* %1
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8 signext %7, i32 %5)
ret void
}
/* Variables and functions */
int readBuffer(int, char *, int);
int readCrlf(int fd) {
  char buf[2];
  int n;
  n = readBuffer(fd, buf, 2);
  return n;
}


x86 assembly (clang, -O0):
<readCrlf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x6(%rbp),%rsi
mov    $0x2,%edx
call   1030 <readBuffer@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readCrlf>:
push   %rax
lea    0x6(%rsp),%rsi
mov    $0x2,%edx
call   1030 <readBuffer@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @readCrlf(i32 %0) {
%2 = alloca i32
%3 = alloca [2 x i8]
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%7 = call i32 @readBuffer(i32 %5, i8* %6, i32 2)
store i32 %7, i32* %4
%8 = load i32, i32* %4
ret i32 %8
}

LLVM IR (-O2):
define i32 @readCrlf(i32 %0) {
%2 = alloca [2 x i8]
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%4 = call i32 @readBuffer(i32 %0, i8* %3, i32 2)
ret i32 %4
}
double EOS_RHO(double p, double temperature) { return p / 287.0 / temperature; }


x86 assembly (clang, -O0):
<EOS_RHO>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xee5(%rip),%xmm1
divsd  %xmm1,%xmm0
divsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<EOS_RHO>:
divsd  0xef8(%rip),%xmm0
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @EOS_RHO(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fdiv double %5, 2.870000e+02
%7 = load double, double* %4
%8 = fdiv double %6, %7
ret double %8
}

LLVM IR (-O2):
define double @EOS_RHO(double %0, double %1) {
%3 = fdiv double %0, 2.870000e+02
%4 = fdiv double %3, %1
ret double %4
}
/* Type definitions */
struct ll {
  int dummy;
};

/* Variables and functions */
struct ll *ll_ins(struct ll *, struct ll *(*)());
struct ll *ll_init(struct ll *head, unsigned n, struct ll *(*born)()) {
  if (n)
    return (ll_init(ll_ins(head, born), n - 1, born));
  return (head);
}


x86 assembly (clang, -O0):
<ll_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1165 <ll_init+0x45>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <ll_ins@plt>
mov    %rax,%rdi
mov    -0x14(%rbp),%esi
sub    $0x1,%esi
mov    -0x20(%rbp),%rdx
call   1030 <ll_init@plt>
mov    %rax,-0x8(%rbp)
jmp    116d <ll_init+0x4d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ll_init>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rax
test   %esi,%esi
je     1130 <ll_init+0x20>
mov    %rdx,%rbx
mov    %esi,%ebp
nop
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <ll_ins@plt>
add    $0xffffffff,%ebp
jne    1120 <ll_init+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.ll = type { i32 }
define %struct.ll* @ll_init(%struct.ll* %0, i32 %1, %struct.ll* (...)* %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %11, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = phi %struct.ll* [ %8, %5 ], [ %0, %3 ]
%8 = tail call %struct.ll* @ll_ins(%struct.ll* %7, %struct.ll* (...)* %2)
%9 = add i32 %6, -1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %5
11: ; preds = %5, %3
%12 = phi %struct.ll* [ %0, %3 ], [ %8, %5 ]
ret %struct.ll* %12
}
void wait() { __asm__ __volatile("sti;hlt"); }


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

x86 assembly (clang, -O2):
<wait>:
sti
hlt
ret

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

LLVM IR (-O2):
define void @wait() {
tail call void asm sideeffect "sti;hlt", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Add(int, int);
int /*<<< orphan*/ Mul(int, int);
int /*<<< orphan*/ Sub(int, int);
int main() {
  Add(5, 10);
  Sub(10, 5);
  Mul(15, 5);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
mov    $0xa,%esi
call   1050 <Add@plt>
mov    $0xa,%edi
mov    $0x5,%esi
call   1040 <Sub@plt>
mov    $0xf,%edi
mov    $0x5,%esi
call   1030 <Mul@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
mov    $0xa,%esi
call   1050 <Add@plt>
mov    $0xa,%edi
mov    $0x5,%esi
call   1040 <Sub@plt>
mov    $0xf,%edi
mov    $0x5,%esi
call   1030 <Mul@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @Add(i32 5, i32 10)
%2 = call i32 @Sub(i32 10, i32 5)
%3 = call i32 @Mul(i32 15, i32 5)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @Add(i32 5, i32 10)
%2 = tail call i32 @Sub(i32 10, i32 5)
%3 = tail call i32 @Mul(i32 15, i32 5)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool handle_dqform(uint32_t insn, unsigned long *gprs, unsigned long *addr) {
  if ((((insn) >> (32 - (11) - (5))) & ((1 << (5)) - 1)) != 0)
    *addr = gprs[(((insn) >> (32 - (11) - (5))) & ((1 << (5)) - 1))];
  *addr +=
      ((((unsigned long)((((insn) >> (32 - (16) - (12))) & ((1 << (12)) - 1))) &
         (((unsigned long)1 << (12)) - 1)) ^
        ((unsigned long)1 << ((12) - 1))) -
       ((unsigned long)1 << ((12) - 1)))
      << 4;
  return true;
}


x86 assembly (clang, -O0):
<handle_dqform>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
and    $0x1f,%eax
cmp    $0x0,%eax
je     113c <handle_dqform+0x3c>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sar    $0x10,%ecx
and    $0x1f,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
and    $0xfff,%eax
movslq %eax,%rcx
and    $0xfff,%rcx
xor    $0x800,%rcx
sub    $0x800,%rcx
shl    $0x4,%rcx
mov    -0x18(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_dqform>:
mov    %edi,%eax
shr    $0x10,%eax
and    $0x1f,%eax
lea    (%rsi,%rax,8),%rax
cmove  %rdx,%rax
mov    (%rax),%rax
and    $0xfff0,%edi
xor    $0x8000,%edi
add    %rdi,%rax
add    $0xffffffffffff8000,%rax
mov    %rax,(%rdx)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @handle_dqform(i32 %0, i64* %1, i64* %2) {
%4 = alloca i32
%5 = alloca i64*
%6 = alloca i64*
store i32 %0, i32* %4
store i64* %1, i64** %5
store i64* %2, i64** %6
%7 = load i32, i32* %4
%8 = ashr i32 %7, 16
%9 = and i32 %8, 31
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %3
%12 = load i64*, i64** %5
%13 = load i32, i32* %4
%14 = ashr i32 %13, 16
%15 = and i32 %14, 31
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i64, i64* %12, i64 %16
%18 = load i64, i64* %17
%19 = load i64*, i64** %6
store i64 %18, i64* %19
br label %20
20: ; preds = %11, %3
%21 = load i32, i32* %4
%22 = ashr i32 %21, 4
%23 = and i32 %22, 4095
%24 = sext i32 %23 to i64
%25 = and i64 %24, 4095
%26 = xor i64 %25, 2048
%27 = sub i64 %26, 2048
%28 = shl i64 %27, 4
%29 = load i64*, i64** %6
%30 = load i64, i64* %29
%31 = add i64 %30, %28
store i64 %31, i64* %29
ret i32 1
}

LLVM IR (-O2):
define i32 @handle_dqform(i32 %0, i64* nocapture %1, i64* nocapture %2) {
%4 = lshr i32 %0, 16
%5 = and i32 %4, 31
%6 = icmp eq i32 %5, 0
%7 = zext i32 %5 to i64
%8 = getelementptr inbounds i64, i64* %1, i64 %7
%9 = select i1 %6, i64* %2, i64* %8
%10 = load i64, i64* %9
%11 = and i32 %0, 65520
%12 = xor i32 %11, 32768
%13 = zext i32 %12 to i64
%14 = add nsw i64 %13, -32768
%15 = add i64 %14, %10
store i64 %15, i64* %2
ret i32 1
}
char *stpcpy(register char *__restrict s1, const char *__restrict s2) {
  while ((*s1++ = *s2++) != 0)
    ;
  return s1 - 1;
}


x86 assembly (clang, -O0):
<stpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     113f <stpcpy+0x3f>
jmp    110c <stpcpy+0xc>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @stpcpy(i8* noalias writeonly %0, i8* noalias nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %4
}
__strtok_r_1c(char *__s, char __sep, char **__nextp) {
  {
    {}
  }
}


x86 assembly (clang, -O0):
<__strtok_r_1c>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @__strtok_r_1c(i8* %0, i8 signext %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i8**
store i8* %0, i8** %5
store i8 %1, i8* %6
store i8** %2, i8*** %7
%8 = load i32, i32* %4
ret i32 %8
}

LLVM IR (-O2):
define i32 @__strtok_r_1c(i8* nocapture readnone %0, i8 signext %1, i8** nocapture readnone %2) {
ret i32 undef
}
int test_imm_BBint16_reg(short val) {
  return ((val) & (-0xBB << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_BBint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff45,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_BBint16_reg(i16 signext %0) {
%2 = and i16 %0, -187
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main() {
  printf("%s:Hello World\n",
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/OrangeTide/build/refs/heads/master/example/"
         "a/a.c");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"%s:Hello World\0A\00"
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/OrangeTide/build/refs/heads/master/example/a/a.c\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"%s:Hello World\0A\00"
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/OrangeTide/build/refs/heads/master/example/a/a.c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct vt_stat {
  int dummy;
};
typedef int /*<<< orphan*/ s;

/* Variables and functions */
int main(void) {
  struct vt_stat s;
  (void)s;
  return sizeof(s);
}


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

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

LLVM IR (-O0):
%struct.vt_stat = type { i32 }
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.vt_stat
store i32 0, i32* %1
ret i32 4
}

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
int get_unsigned_short_be(unsigned char **data) {
  int result;
  result = *(*data + 1) | (*(*data) << 8);
  *data += 2;
  return result;
}


x86 assembly (clang, -O0):
<get_unsigned_short_be>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzbl 0x1(%rax),%eax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
movzbl (%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x2,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_unsigned_short_be>:
mov    (%rdi),%rcx
movzwl (%rcx),%eax
shl    $0x10,%eax
bswap  %eax
add    $0x2,%rcx
mov    %rcx,(%rdi)
ret

LLVM IR (-O0):
define i32 @get_unsigned_short_be(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = load i8**, i8*** %2
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = or i32 %8, %13
store i32 %14, i32* %3
%15 = load i8**, i8*** %2
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8, i8* %16, i64 2
store i8* %17, i8** %15
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @get_unsigned_short_be(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = getelementptr inbounds i8, i8* %2, i64 1
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 8
%9 = or i32 %8, %5
%10 = getelementptr inbounds i8, i8* %2, i64 2
store i8* %10, i8** %0
ret i32 %9
}
void JmpM() {}


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

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

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

LLVM IR (-O2):
define void @JmpM() {
ret void
}
unsigned int tonibble(unsigned char ch) {
  return ch < 0x3a ? ch - 0x30 : ch - 0x37;
}


x86 assembly (clang, -O0):
<tonibble>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x3a,%eax
jge    1126 <tonibble+0x26>
movzbl -0x1(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <tonibble+0x30>
movzbl -0x1(%rbp),%eax
sub    $0x37,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tonibble>:
lea    -0x37(%rdi),%ecx
lea    -0x30(%rdi),%eax
cmp    $0x3a,%dil
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @tonibble(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp slt i32 %4, 58
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = sub nsw i32 %8, 48
br label %14
10: ; preds = %1
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = sub nsw i32 %12, 55
br label %14
14: ; preds = %10, %6
%15 = phi i32 [ %9, %6 ], [ %13, %10 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @tonibble(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = icmp ult i8 %0, 58
%4 = select i1 %3, i32 -48, i32 -55
%5 = add nsw i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int gv(char c) {
  if (c == '0')
    return 0;
  else if (c == '1')
    return 1;
  assert(1 == 0);
  return -1;
}


x86 assembly (clang, -O0):
<gv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jne    1137 <gv+0x27>
movl   $0x0,-0x4(%rbp)
jmp    1163 <gv+0x53>
movsbl -0x5(%rbp),%eax
cmp    $0x31,%eax
jne    1150 <gv+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1163 <gv+0x53>
jmp    1155 <gv+0x45>
xor    %edi,%edi
call   1030 <assert@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gv>:
cmp    $0x30,%dil
je     1122 <gv+0x12>
cmp    $0x31,%dil
jne    1125 <gv+0x15>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret
push   %rax
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @gv(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 48
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %16
8: ; preds = %1
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 49
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 1, i32* %2
br label %16
13: ; preds = %8
br label %14
14: ; preds = %13
%15 = call i32 @assert(i32 0)
store i32 -1, i32* %2
br label %16
16: ; preds = %14, %12, %7
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @gv(i8 signext %0) {
switch i8 %0, label %3 [
i8 48, label %5
i8 49, label %2
]
2: ; preds = %1
br label %5
3: ; preds = %1
%4 = tail call i32 @assert(i32 0)
br label %5
5: ; preds = %1, %3, %2
%6 = phi i32 [ 1, %2 ], [ -1, %3 ], [ 0, %1 ]
ret i32 %6
}
extern unsigned float_to_bits(float a) { return *((unsigned *)&a); }


x86 assembly (clang, -O0):
<float_to_bits>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_to_bits>:
movd   %xmm0,%eax
ret

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

LLVM IR (-O2):
define i32 @float_to_bits(float %0) {
%2 = bitcast float %0 to i32
ret i32 %2
}
/* Variables and functions */
int parse_int_file(int /*<<< orphan*/, char *, int);
int get_physical_core_id(int cpu) {
  return parse_int_file(0, "/sys/devices/system/cpu/cpu%d/topology/core_id",
                        cpu);
}


x86 assembly (clang, -O0):
<get_physical_core_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
xor    %edi,%edi
lea    0xed9(%rip),%rsi
call   1030 <parse_int_file@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_physical_core_id>:
mov    %edi,%edx
lea    0xee7(%rip),%rsi
xor    %edi,%edi
jmp    1030 <parse_int_file@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"/sys/devices/system/cpu/cpu%d/topology/core_id\00"
define i32 @get_physical_core_id(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @parse_int_file(i32 0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 %4
}

LLVM IR (-O2):
@.str = [47 x i8] c"/sys/devices/system/cpu/cpu%d/topology/core_id\00"
define i32 @get_physical_core_id(i32 %0) {
%2 = tail call i32 @parse_int_file(i32 0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 %2
}
int xio_set_log_fn(void *fn) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @xio_set_log_fn(i8* nocapture readnone %0) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ test_basename();
int /*<<< orphan*/ test_dirname();
void run_libgen_tests() {
  printf("\nRunning Test Case: %s\n", "Test POSIX libgen.h functions");
  ;
  test_basename();
  test_dirname();
}


x86 assembly (clang, -O0):
<run_libgen_tests>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <test_basename@plt>
mov    $0x0,%al
call   1050 <test_dirname@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_libgen_tests>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xed9(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <test_basename@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <test_dirname@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\0ARunning Test Case: %s\0A\00"
@.str.1 = [30 x i8] c"Test POSIX libgen.h functions\00"
define void @run_libgen_tests() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (...) @test_basename()
%3 = call i32 (...) @test_dirname()
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"\0ARunning Test Case: %s\0A\00"
@.str.1 = [30 x i8] c"Test POSIX libgen.h functions\00"
define void @run_libgen_tests() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (...) @test_basename()
%3 = tail call i32 (...) @test_dirname()
ret void
}
void freePartitionsList(char **list) {
  char **part;
  if (!list)
    return;
  for (part = list; *part; part++)
    if (*part)
      free(*part);
  free(list);
}


x86 assembly (clang, -O0):
<freePartitionsList>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <freePartitionsList+0x1c>
jmp    117b <freePartitionsList+0x6b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1172 <freePartitionsList+0x62>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     115c <freePartitionsList+0x4c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
jmp    1161 <freePartitionsList+0x51>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <freePartitionsList+0x24>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freePartitionsList>:
test   %rdi,%rdi
je     1150 <freePartitionsList+0x40>
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <freePartitionsList+0x31>
lea    0x8(%r14),%rbx
nopl   0x0(%rax,%rax,1)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <freePartitionsList+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @freePartitionsList(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %12, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %10, %6 ], [ %4, %3 ]
%8 = phi i8** [ %9, %6 ], [ %0, %3 ]
tail call void @free(i8* %7)
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %6
12: ; preds = %6, %3
%13 = bitcast i8** %0 to i8*
tail call void @free(i8* %13)
br label %14
14: ; preds = %1, %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int mpb_clear_screen(void) {
  printf("\033[2J\033[0;0H");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[2J\1B[0;0H\00"
define i32 @mpb_clear_screen() {
%1 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[2J\1B[0;0H\00"
define i32 @mpb_clear_screen() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int bmm050_compensate_Y(short, unsigned short);
signed int bmm050_compensate_Y_s32(signed short mdata_y,
                                   unsigned short data_R) {
  signed int retval;
  retval = bmm050_compensate_Y(mdata_y, data_R);
  if (retval == -32768)
    retval = ((signed int)(-2147483647 - 1));
  return retval;
}


x86 assembly (clang, -O0):
<bmm050_compensate_Y_s32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
movswl %ax,%edi
movzwl -0x4(%rbp),%esi
call   1030 <bmm050_compensate_Y@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffff8000,-0x8(%rbp)
jne    114d <bmm050_compensate_Y_s32+0x3d>
movl   $0x80000000,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bmm050_compensate_Y_s32>:
push   %rax
call   1030 <bmm050_compensate_Y@plt>
cmp    $0xffff8000,%eax
mov    $0x80000000,%ecx
cmove  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @bmm050_compensate_Y_s32(i16 signext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i32
store i16 %0, i16* %3
store i16 %1, i16* %4
%6 = load i16, i16* %3
%7 = load i16, i16* %4
%8 = call i32 @bmm050_compensate_Y(i16 signext %6, i16 zeroext %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, -32768
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -2147483648, i32* %5
br label %12
12: ; preds = %11, %2
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @bmm050_compensate_Y_s32(i16 signext %0, i16 zeroext %1) {
%3 = tail call i32 @bmm050_compensate_Y(i16 signext %0, i16 zeroext %1)
%4 = icmp eq i32 %3, -32768
%5 = select i1 %4, i32 -2147483648, i32 %3
ret i32 %5
}
void foo617(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo617(i32 %0) {
ret void
}