xunge/DecIR huggingface dataset:
/* Variables and functions */
int scanf(char *, int *);
int getNextHexInt(int *i) {
  int result = 0;
  if (scanf("%x", i) == 1)
    result = 1;
  return result;
}


x86 assembly (clang, -O0):
<getNextHexInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed2(%rip),%rdi
call   1030 <scanf@plt>
cmp    $0x1,%eax
jne    1143 <getNextHexInt+0x33>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNextHexInt>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <scanf@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%x\00"
define i32 @getNextHexInt(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %3
br label %8
8: ; preds = %7, %1
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
define i32 @getNextHexInt(i32* %0) {
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %0)
%3 = icmp eq i32 %2, 1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
float expf(float);
float futrts_exp32(float x) { return expf(x); }


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

x86 assembly (clang, -O2):
<futrts_exp32>:
jmp    1030 <expf@plt>

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

LLVM IR (-O2):
define float @futrts_exp32(float %0) {
%2 = tail call float @expf(float %0)
ret float %2
}
int do_730() { return 730; }


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

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

LLVM IR (-O0):
define i32 @do_730() {
ret i32 730
}

LLVM IR (-O2):
define i32 @do_730() {
ret i32 730
}
void setpixel(unsigned char *pixels, unsigned x, unsigned y) { return; }


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

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

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

LLVM IR (-O2):
define void @setpixel(i8* nocapture %0, i32 %1, i32 %2) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ BIO_dump_fp(int /*<<< orphan*/ *, void *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void pr_data(FILE *fp, const char *name, char *data, int len) {
  fprintf(fp, "%s:\n", name);
  BIO_dump_fp(fp, (void *)data, len);
}


x86 assembly (clang, -O0):
<pr_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <BIO_dump_fp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_data>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %rdi,%rbp
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <BIO_dump_fp@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%s:\0A\00"
define void @pr_data(i32* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i8*, i8** %6
%11 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32*, i32** %5
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = call i32 @BIO_dump_fp(i32* %12, i8* %13, i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s:\0A\00"
define void @pr_data(i32* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = tail call i32 @BIO_dump_fp(i32* %0, i8* %2, i32 %3)
ret void
}
/* Variables and functions */
int tuner_i2c_write(void *, unsigned short, unsigned char, unsigned char,
                    unsigned char *, unsigned char);
int bbm_com_tuner_write(void *handle, unsigned short devid, unsigned char addr,
                        unsigned char alen, unsigned char *buffer,
                        unsigned char len) {
  int res;
  res = tuner_i2c_write(handle, devid, addr, alen, buffer, len);
  return res;
}


x86 assembly (clang, -O0):
<bbm_com_tuner_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %r9b,%al
mov    %rdi,-0x8(%rbp)
mov    %si,-0xa(%rbp)
mov    %dl,-0xb(%rbp)
mov    %cl,-0xc(%rbp)
mov    %r8,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%dx
mov    -0xb(%rbp),%cl
mov    -0xc(%rbp),%al
mov    -0x18(%rbp),%r8
movzwl %dx,%esi
movzbl %cl,%edx
movzbl %al,%ecx
movzbl -0x19(%rbp),%r9d
call   1030 <tuner_i2c_write@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbm_com_tuner_write>:
jmp    1030 <tuner_i2c_write@plt>

LLVM IR (-O0):
define i32 @bbm_com_tuner_write(i8* %0, i16 zeroext %1, i8 zeroext %2, i8 zeroext %3, i8* %4, i8 zeroext %5) {
%7 = alloca i8*
%8 = alloca i16
%9 = alloca i8
%10 = alloca i8
%11 = alloca i8*
%12 = alloca i8
%13 = alloca i32
store i8* %0, i8** %7
store i16 %1, i16* %8
store i8 %2, i8* %9
store i8 %3, i8* %10
store i8* %4, i8** %11
store i8 %5, i8* %12
%14 = load i8*, i8** %7
%15 = load i16, i16* %8
%16 = load i8, i8* %9
%17 = load i8, i8* %10
%18 = load i8*, i8** %11
%19 = load i8, i8* %12
%20 = call i32 @tuner_i2c_write(i8* %14, i16 zeroext %15, i8 zeroext %16, i8 zeroext %17, i8* %18, i8 zeroext %19)
store i32 %20, i32* %13
%21 = load i32, i32* %13
ret i32 %21
}

LLVM IR (-O2):
define i32 @bbm_com_tuner_write(i8* %0, i16 zeroext %1, i8 zeroext %2, i8 zeroext %3, i8* %4, i8 zeroext %5) {
%7 = tail call i32 @tuner_i2c_write(i8* %0, i16 zeroext %1, i8 zeroext %2, i8 zeroext %3, i8* %4, i8 zeroext %5)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main(void) {
  int phonegroup_1, phonegroup_2, phonegroup_3;
  printf("Enter phone number [(xxx) xxx-xxxx]: ");
  scanf("(%d) %d-%d", &phonegroup_1, &phonegroup_2, &phonegroup_3);
  printf("You entered %.3d.%.3d.%.4d\n", phonegroup_1, phonegroup_2,
         phonegroup_3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1040 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Enter phone number [(xxx) xxx-xxxx]: \00"
@.str.1 = [11 x i8] c"(%d) %d-%d\00"
@.str.2 = [28 x i8] c"You entered %.3d.%.3d.%.4d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Enter phone number [(xxx) xxx-xxxx]: \00"
@.str.1 = [11 x i8] c"(%d) %d-%d\00"
@.str.2 = [28 x i8] c"You entered %.3d.%.3d.%.4d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void sleeponesec(void) {
  printf("Sleeping one second ...\n");
  sleep(1);
}


x86 assembly (clang, -O0):
<sleeponesec>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleeponesec>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <sleep@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Sleeping one second ...\0A\00"
define void @sleeponesec() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @sleep(i32 1)
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"Sleeping one second ...\00"
define void @sleeponesec() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @sleep(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(void *);
void ExitHandler(int sig) { pthread_exit(((void *)0)); }


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

x86 assembly (clang, -O2):
<ExitHandler>:
xor    %edi,%edi
jmp    1030 <pthread_exit@plt>

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

LLVM IR (-O2):
define void @ExitHandler(i32 %0) {
%2 = tail call i32 @pthread_exit(i8* null)
ret void
}
char *get_dropbox_api_secret() { return "secret_key\0"; }


x86 assembly (clang, -O0):
<get_dropbox_api_secret>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_dropbox_api_secret>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"secret_key\00\00"
define i8* @get_dropbox_api_secret() {
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [12 x i8] c"secret_key\00\00"
define i8* @get_dropbox_api_secret() {
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int verify_result();
int simulate_thread_final_verify() { return verify_result(); }


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

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

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

LLVM IR (-O2):
define i32 @simulate_thread_final_verify() {
%1 = tail call i32 (...) @verify_result()
ret i32 %1
}
unsigned int bswap32(unsigned int x) {
  asm("bswapl %0" : "=r"(x) : "0"(x));
  return x;
}


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

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

LLVM IR (-O0):
define i32 @bswap32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
define i32 @bswap32(i32 %0) {
%2 = tail call i32 asm "bswapl $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i32 %2
}
int base64code2char(int c) {
  c &= 0x3f;
  if (c < 26)
    return 'A' + c;
  if (c < 52)
    return 'a' + c - 26;
  if (c < 62)
    return '0' + c - 52;
  return c == 62 ? '+' : '/';
}


x86 assembly (clang, -O0):
<base64code2char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1a,-0x8(%rbp)
jge    1128 <base64code2char+0x28>
mov    -0x8(%rbp),%eax
add    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <base64code2char+0x74>
cmpl   $0x34,-0x8(%rbp)
jge    1143 <base64code2char+0x43>
mov    -0x8(%rbp),%eax
add    $0x61,%eax
sub    $0x1a,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <base64code2char+0x74>
cmpl   $0x3e,-0x8(%rbp)
jge    115e <base64code2char+0x5e>
mov    -0x8(%rbp),%eax
add    $0x30,%eax
sub    $0x34,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <base64code2char+0x74>
mov    -0x8(%rbp),%edx
mov    $0x2f,%eax
mov    $0x2b,%ecx
cmp    $0x3e,%edx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64code2char>:
mov    %edi,%eax
and    $0x3f,%eax
cmp    $0x19,%eax
ja     110e <base64code2char+0xe>
add    $0x41,%eax
ret
cmp    $0x33,%eax
ja     1117 <base64code2char+0x17>
add    $0x47,%eax
ret
cmp    $0x3d,%eax
ja     1120 <base64code2char+0x20>
add    $0xfffffffc,%eax
ret
xor    %ecx,%ecx
cmp    $0x3e,%eax
setne  %cl
lea    0x2b(,%rcx,4),%eax
ret

LLVM IR (-O0):
define i32 @base64code2char(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 63
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 26
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %3
%10 = add nsw i32 65, %9
store i32 %10, i32* %2
br label %30
11: ; preds = %1
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 52
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* %3
%16 = add nsw i32 97, %15
%17 = sub nsw i32 %16, 26
store i32 %17, i32* %2
br label %30
18: ; preds = %11
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 62
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = load i32, i32* %3
%23 = add nsw i32 48, %22
%24 = sub nsw i32 %23, 52
store i32 %24, i32* %2
br label %30
25: ; preds = %18
%26 = load i32, i32* %3
%27 = icmp eq i32 %26, 62
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 43, i32 47
store i32 %29, i32* %2
br label %30
30: ; preds = %25, %21, %14, %8
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @base64code2char(i32 %0) {
%2 = and i32 %0, 63
%3 = icmp ult i32 %2, 26
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = add nuw nsw i32 %2, 65
br label %17
6: ; preds = %1
%7 = icmp ult i32 %2, 52
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = add nuw nsw i32 %2, 71
br label %17
10: ; preds = %6
%11 = icmp ult i32 %2, 62
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = add nsw i32 %2, -4
br label %17
14: ; preds = %10
%15 = icmp eq i32 %2, 62
%16 = select i1 %15, i32 43, i32 47
br label %17
17: ; preds = %14, %12, %8, %4
%18 = phi i32 [ %5, %4 ], [ %9, %8 ], [ %13, %12 ], [ %16, %14 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void testNegation() { printf("-%d = %d\n", 10, -10); }


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

x86 assembly (clang, -O2):
<testNegation>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
mov    $0xfffffff6,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"-%d = %d\0A\00"
define void @testNegation() {
%1 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10, i32 -10)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"-%d = %d\0A\00"
define void @testNegation() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 10, i32 -10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(char const);
int hasAlpha(const char *cpf) {
  do {
    if (!isdigit(*cpf)) {
      return 1;
    }
  } while (*(++cpf));
  return 0;
}


x86 assembly (clang, -O0):
<hasAlpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    113d <hasAlpha+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    1162 <hasAlpha+0x52>
jmp    1142 <hasAlpha+0x32>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,0x1(%rax)
jne    111c <hasAlpha+0xc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hasAlpha>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
add    $0x1,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     113b <hasAlpha+0x2b>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <hasAlpha+0x10>
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @hasAlpha(i8* nocapture %0) {
%2 = load i8, i8* %0
br label %3
3: ; preds = %8, %1
%4 = phi i8 [ %2, %1 ], [ %10, %8 ]
%5 = phi i8* [ %0, %1 ], [ %9, %8 ]
%6 = tail call i32 @isdigit(i8 signext %4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %5, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %3
12: ; preds = %8, %3
%13 = phi i32 [ 1, %3 ], [ 0, %8 ]
ret i32 %13
}
const char *aom_codec_version_extra_str(void) { return "309-g12287adee"; }


x86 assembly (clang, -O0):
<aom_codec_version_extra_str>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<aom_codec_version_extra_str>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [15 x i8] c"309-g12287adee\00"
define i8* @aom_codec_version_extra_str() {
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [15 x i8] c"309-g12287adee\00"
define i8* @aom_codec_version_extra_str() {
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int write(int, char const *, int /*<<< orphan*/);
int write_output_file(int fd, const char *data) {
  return write(fd, data, strlen(data));
}


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

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

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

LLVM IR (-O2):
define i32 @write_output_file(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
ret i32 %4
}
unsigned int fxunsdfsi(double d) { return d; }


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

x86 assembly (clang, -O2):
<fxunsdfsi>:
cvttsd2si %xmm0,%rax
ret

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

LLVM IR (-O2):
define i32 @fxunsdfsi(double %0) {
%2 = fptoui double %0 to i32
ret i32 %2
}
/* Variables and functions */
int encryption_data_send_recv(unsigned char *, int);
int encryption_in_network(unsigned char *buf, int len) {
  return encryption_data_send_recv(buf, len);
}


x86 assembly (clang, -O0):
<encryption_in_network>:
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 <encryption_data_send_recv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encryption_in_network>:
jmp    1030 <encryption_data_send_recv@plt>

LLVM IR (-O0):
define i32 @encryption_in_network(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 @encryption_data_send_recv(i8* %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @encryption_in_network(i8* %0, i32 %1) {
%3 = tail call i32 @encryption_data_send_recv(i8* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ ceil(double);
double lua_check_number(int, char *);
int /*<<< orphan*/ lua_pushnumber(int /*<<< orphan*/);
void math_ceil(void) {
  double d = lua_check_number(1, "ceil");
  lua_pushnumber(ceil(d));
}


x86 assembly (clang, -O0):
<math_ceil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
lea    0xebc(%rip),%rsi
call   1030 <lua_check_number@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <ceil@plt>
mov    %eax,%edi
call   1050 <lua_pushnumber@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_ceil>:
push   %rax
lea    0xec8(%rip),%rsi
mov    $0x1,%edi
call   1030 <lua_check_number@plt>
call   1040 <ceil@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <lua_pushnumber@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"ceil\00"
define void @math_ceil() {
%1 = alloca double
%2 = call double @lua_check_number(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store double %2, double* %1
%3 = load double, double* %1
%4 = call i32 @ceil(double %3)
%5 = call i32 @lua_pushnumber(i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"ceil\00"
define void @math_ceil() {
%1 = tail call double @lua_check_number(i32 1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @ceil(double %1)
%3 = tail call i32 @lua_pushnumber(i32 %2)
ret void
}
/* Type definitions */
typedef void *pthread_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *);
void *pthread_self();
int /*<<< orphan*/ sleep(int);
void *job1(void *arg) {
  pthread_t pid = pthread_self();
  sleep(1);
  printf("job1: print %p\n", arg);
  printf("job1: pthread_self: %lu\n", pid);
  sleep(1);
  return arg;
}


x86 assembly (clang, -O0):
<job1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x8(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<job1>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <pthread_self@plt>
mov    %rax,%r14
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [16 x i8] c"job1: print %p\0A\00"
@.str.1 = [25 x i8] c"job1: pthread_self: %lu\0A\00"
define i8* @job1(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i8* (...) @pthread_self()
store i8* %4, i8** %3
%5 = call i32 @sleep(i32 1)
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = call i32 @sleep(i32 1)
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@.str = [16 x i8] c"job1: print %p\0A\00"
@.str.1 = [25 x i8] c"job1: pthread_self: %lu\0A\00"
define i8* @job1(i8* returned %0) {
%2 = tail call i8* (...) @pthread_self()
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%6 = tail call i32 @sleep(i32 1)
ret i8* %0
}
/* Type definitions */
typedef union fc_sockaddr {
  int dummy;
} fc_sockaddr;
struct genlist_link {
  int dummy;
};
struct fc_sockaddr_list_link {
  int dummy;
};

/* Variables and functions */
scalar_t__ genlist_link_data(struct genlist_link const *);
union fc_sockaddr *
fc_sockaddr_list_link_data(const struct fc_sockaddr_list_link *plink) {
  return ((union fc_sockaddr *)genlist_link_data(
      (const struct genlist_link *)plink));
}


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

x86 assembly (clang, -O2):
<fc_sockaddr_list_link_data>:
jmp    1030 <genlist_link_data@plt>

LLVM IR (-O0):
%union.fc_sockaddr = type { i32 }
%struct.fc_sockaddr_list_link = type { i32 }
%struct.genlist_link = type { i32 }
define %union.fc_sockaddr* @fc_sockaddr_list_link_data(%struct.fc_sockaddr_list_link* %0) {
%2 = alloca %struct.fc_sockaddr_list_link*
store %struct.fc_sockaddr_list_link* %0, %struct.fc_sockaddr_list_link** %2
%3 = load %struct.fc_sockaddr_list_link*, %struct.fc_sockaddr_list_link** %2
%4 = bitcast %struct.fc_sockaddr_list_link* %3 to %struct.genlist_link*
%5 = call i64 @genlist_link_data(%struct.genlist_link* %4)
%6 = inttoptr i64 %5 to %union.fc_sockaddr*
ret %union.fc_sockaddr* %6
}

LLVM IR (-O2):
%union.fc_sockaddr = type { i32 }
%struct.fc_sockaddr_list_link = type { i32 }
%struct.genlist_link = type { i32 }
define %union.fc_sockaddr* @fc_sockaddr_list_link_data(%struct.fc_sockaddr_list_link* %0) {
%2 = bitcast %struct.fc_sockaddr_list_link* %0 to %struct.genlist_link*
%3 = tail call i64 @genlist_link_data(%struct.genlist_link* %2)
%4 = inttoptr i64 %3 to %union.fc_sockaddr*
ret %union.fc_sockaddr* %4
}
void main(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ _mm_sll_si64(int /*<<< orphan*/, int /*<<< orphan*/);
__m64 test61(__m64 a, __m64 b) { return _mm_sll_si64(a, b); }


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

x86 assembly (clang, -O2):
<test61>:
jmp    1030 <_mm_sll_si64@plt>

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

LLVM IR (-O2):
define i32 @test61(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_sll_si64(i32 %0, i32 %1)
ret i32 %3
}
const char *rcsid(const char *p) {
  return rcsid(p = "@(#)$Id: file.c 10 2006-07-10 18:22:27Z hyin $");
}


x86 assembly (clang, -O0):
<rcsid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xed2(%rip),%rdi
call   1030 <rcsid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rcsid>:
jmp    1100 <rcsid>

LLVM IR (-O0):
@.str = [47 x i8] c"@(#)$Id: file.c 10 2006-07-10 18:22:27Z hyin $\00"
define i8* @rcsid(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = call i8* @rcsid(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}

LLVM IR (-O2):
define noalias i8* @rcsid(i8* nocapture readnone %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
void __attribute__((warning("curl_easy_setopt expects a curl_sockopt_callback "
                            "argument for this option")))
__attribute__((unused)) __attribute__((no))
_curl_easy_setopt_err_sockopt_cb(void) {
  __asm__("");
}


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

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

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

LLVM IR (-O2):
define void @_curl_easy_setopt_err_sockopt_cb() {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void bitmap_clear_bit(unsigned long *bitmap, unsigned long bit) {
  bitmap[BITMAP_OFFSET(bit)] &= ~BITMAP_MASK(bit);
}


x86 assembly (clang, -O0):
<bitmap_clear_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <BITMAP_MASK@plt>
xor    $0xffffffff,%eax
cltq
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <BITMAP_OFFSET@plt>
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
and    (%rax,%rcx,8),%rdx
mov    %rdx,(%rax,%rcx,8)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_clear_bit>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
xor    %eax,%eax
call   1040 <BITMAP_MASK@plt>
not    %eax
movslq %eax,%r15
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <BITMAP_OFFSET@plt>
cltq
and    %r15,(%r14,%rax,8)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @bitmap_clear_bit(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = call i32 (i64, ...) bitcast (i32 (...)* @BITMAP_MASK to i32 (i64, ...)*)(i64 %5)
%7 = xor i32 %6, -1
%8 = sext i32 %7 to i64
%9 = load i64*, i64** %3
%10 = load i64, i64* %4
%11 = call i32 (i64, ...) bitcast (i32 (...)* @BITMAP_OFFSET to i32 (i64, ...)*)(i64 %10)
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i64, i64* %9, i64 %12
%14 = load i64, i64* %13
%15 = and i64 %14, %8
store i64 %15, i64* %13
ret void
}

LLVM IR (-O2):
define void @bitmap_clear_bit(i64* nocapture %0, i64 %1) {
%3 = tail call i32 (i64, ...) bitcast (i32 (...)* @BITMAP_MASK to i32 (i64, ...)*)(i64 %1)
%4 = xor i32 %3, -1
%5 = sext i32 %4 to i64
%6 = tail call i32 (i64, ...) bitcast (i32 (...)* @BITMAP_OFFSET to i32 (i64, ...)*)(i64 %1)
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i64, i64* %0, i64 %7
%9 = load i64, i64* %8
%10 = and i64 %9, %5
store i64 %10, i64* %8
ret void
}
int normalize(int x) {
  if (x < 0)
    return -1;
  if (x > 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<normalize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111d <normalize+0x1d>
movl   $0xffffffff,-0x4(%rbp)
jmp    113a <normalize+0x3a>
cmpl   $0x0,-0x8(%rbp)
jle    1133 <normalize+0x33>
movl   $0x1,-0x4(%rbp)
jmp    113a <normalize+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize>:
xor    %ecx,%ecx
test   %edi,%edi
setne  %cl
mov    $0xffffffff,%eax
cmovns %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @normalize(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
%4 = icmp sgt i32 %0, -1
%5 = select i1 %4, i32 %3, i32 -1
ret i32 %5
}
/* Variables and functions */
int strlen(char *);
int combination(char *string) {
  if (string == NULL) {
    return -1;
  }
  int length = strlen(string);
}


x86 assembly (clang, -O0):
<combination>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <combination+0x23>
movl   $0xffffffff,-0x4(%rbp)
jmp    113f <combination+0x2f>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<combination>:
test   %rdi,%rdi
je     111f <combination+0xf>
push   %rax
call   1030 <strlen@plt>
add    $0x8,%rsp
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @combination(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
br label %5
5: ; preds = %1, %3
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_SETMASK;
int sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int sigsetmask(int mask) {
  int omask, n;
  n = sigprocmask(SIG_SETMASK, (sigset_t *)&mask, (sigset_t *)&omask);
  if (n)
    return (n);
  return (omask);
}


x86 assembly (clang, -O0):
<sigsetmask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <sigprocmask@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1149 <sigsetmask+0x39>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114f <sigsetmask+0x3f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigsetmask>:
push   %rax
mov    %edi,0x4(%rsp)
mov    0x2ecc(%rip),%rax
mov    (%rax),%edi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1030 <sigprocmask@plt>
test   %eax,%eax
jne    1132 <sigsetmask+0x22>
mov    (%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@SIG_SETMASK = global i32 0
define i32 @sigsetmask(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = bitcast i32* %3 to i8*
%5 = load i32, i32* @SIG_SETMASK
%6 = call i32 @sigprocmask(i32 %5, i32* %2, i32* %3)
%7 = icmp eq i32 %6, 0
%8 = load i32, i32* %3
%9 = select i1 %7, i32 %8, i32 %6
ret i32 %9
}
/* Type definitions */
struct sigaction {
  int dummy;
};

/* Variables and functions */
int main() {
  struct sigaction sa;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void g_thread_pool_new() {}


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

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

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

LLVM IR (-O2):
define void @g_thread_pool_new() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
void panic(char *msg) {
  perror(msg);
  fprintf(stderr, "Fatal error encountered. Terminating!\n");
  exit(1);
}


x86 assembly (clang, -O0):
<panic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeab(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<panic>:
push   %rax
call   1040 <perror@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"Fatal error encountered. Terminating!\0A\00"
define void @panic(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"Fatal error encountered. Terminating!\0A\00"
define void @panic(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int get_fpscr();
int fegetround(void) { return get_fpscr() & 3; }


x86 assembly (clang, -O0):
<fegetround>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <get_fpscr@plt>
and    $0x3,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fegetround>:
push   %rax
xor    %eax,%eax
call   1030 <get_fpscr@plt>
and    $0x3,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @fegetround() {
%1 = call i32 (...) @get_fpscr()
%2 = and i32 %1, 3
ret i32 %2
}

LLVM IR (-O2):
define i32 @fegetround() {
%1 = tail call i32 (...) @get_fpscr()
%2 = and i32 %1, 3
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
typedef int /*<<< orphan*/ wctrans_t;

/* Variables and functions */
int /*<<< orphan*/ towctrans(int /*<<< orphan*/, int /*<<< orphan*/);
void uninitvar_towctrans(void) {
  wint_t c;
  wctrans_t desc;
  (void)towctrans(c, desc);
}


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

x86 assembly (clang, -O2):
<uninitvar_towctrans>:
jmp    1030 <towctrans@plt>

LLVM IR (-O0):
define void @uninitvar_towctrans() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* %1
%4 = load i32, i32* %2
%5 = call i32 @towctrans(i32 %3, i32 %4)
ret void
}

LLVM IR (-O2):
define void @uninitvar_towctrans() {
%1 = tail call i32 @towctrans(i32 undef, i32 undef)
ret void
}
void laptop_io_completion() { return; }


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

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

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

LLVM IR (-O2):
define void @laptop_io_completion() {
ret void
}
int test_imm_A8uint8_mem(unsigned char *val) {
  return ((*val) & (0xA8 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_A8uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -88
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int __builtin_arm_rsr(char *);
unsigned rsr_3() { return __builtin_arm_rsr("0:1:2"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"0:1:2\00"
define i32 @rsr_3() {
%1 = tail call i32 @__builtin_arm_rsr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
double solve_area(double x, int32_t n, double (*f)(double x)) {
  return ((0.25 * x) / (double)n) - f(x);
}


x86 assembly (clang, -O0):
<solve_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  0xee3(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  -0x8(%rbp),%xmm0
call   *%rax
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_area>:
push   %rax
movsd  0xef7(%rip),%xmm2
mulsd  %xmm0,%xmm2
cvtsi2sd %rdi,%xmm1
divsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
call   *%rsi
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @solve_area(double %0, i64 %1, double (double)* %2) {
%4 = alloca double
%5 = alloca i64
%6 = alloca double (double)*
store double %0, double* %4
store i64 %1, i64* %5
store double (double)* %2, double (double)** %6
%7 = load double, double* %4
%8 = fmul double 2.500000e-01, %7
%9 = load i64, i64* %5
%10 = sitofp i64 %9 to double
%11 = fdiv double %8, %10
%12 = load double (double)*, double (double)** %6
%13 = load double, double* %4
%14 = call double %12(double %13)
%15 = fsub double %11, %14
ret double %15
}

LLVM IR (-O2):
define double @solve_area(double %0, i64 %1, double (double)* nocapture %2) {
%4 = fmul double %0, 2.500000e-01
%5 = sitofp i64 %1 to double
%6 = fdiv double %4, %5
%7 = tail call double %2(double %0)
%8 = fsub double %6, %7
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_usage(char *file) {
  printf("Usage : \n");
  printf("%s write <file>\n", file);
  printf("%s replay\n", file);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Usage : \0A\00"
@.str.1 = [17 x i8] c"%s write <file>\0A\00"
@.str.2 = [11 x i8] c"%s replay\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"%s write <file>\0A\00"
@.str.2 = [11 x i8] c"%s replay\0A\00"
@str = [9 x i8] c"Usage : \00"
define void @print_usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int isonum_721(char *);
int isonum_723(char *p) { return (isonum_721(p)); }


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

x86 assembly (clang, -O2):
<isonum_723>:
jmp    1030 <isonum_721@plt>

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

LLVM IR (-O2):
define i32 @isonum_723(i8* %0) {
%2 = tail call i32 @isonum_721(i8* %0)
ret i32 %2
}