xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned long READ_VIP32(unsigned long);
unsigned long gfx_read_vip32(unsigned long offset) {
  unsigned long value;
  value = READ_VIP32(offset);
  return value;
}


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

x86 assembly (clang, -O2):
<gfx_read_vip32>:
jmp    1030 <READ_VIP32@plt>

LLVM IR (-O0):
define i64 @gfx_read_vip32(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 @READ_VIP32(i64 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @gfx_read_vip32(i64 %0) {
%2 = tail call i64 @READ_VIP32(i64 %0)
ret i64 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char const *, char const *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *);
int /*<<< orphan*/ stderr;
FILE *fopen_safe(const char *filename, const char *mode) {
  FILE *fp;
  fp = fopen(filename, mode);
  if (fp == NULL) {
    fprintf(stderr, "\nError: Couldn't open file '%s' for '%s'\n\n", filename,
            mode);
    exit(-1);
  }
  return (fp);
}


x86 assembly (clang, -O0):
<fopen_safe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1183 <fopen_safe+0x53>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe8c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fopen_safe>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <fopen@plt>
test   %rax,%rax
je     114c <fopen_safe+0x1c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"\0AError: Couldn't open file '%s' for '%s'\0A\0A\00"
define i32* @fopen_safe(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 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %6, i8* %7)
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %2
%18 = load i32*, i32** %5
ret i32* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"\0AError: Couldn't open file '%s' for '%s'\0A\0A\00"
define noalias i32* @fopen_safe(i8* %0, i8* %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
ret i32* %3
}
/* Variables and functions */
unsigned int ioread32(void *);
unsigned int COM_ReadReg32(unsigned int addr) { return ioread32((void *)addr); }


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

x86 assembly (clang, -O2):
<COM_ReadReg32>:
mov    %edi,%edi
jmp    1030 <ioread32@plt>

LLVM IR (-O0):
define i32 @COM_ReadReg32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = call i32 @ioread32(i8* %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @COM_ReadReg32(i32 %0) {
%2 = zext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @ioread32(i8* %3)
ret i32 %4
}
void AlarmToTimerC$0$Timer$fired(void) { VirtualizeTimerC$0$TimerFrom$fired(); }


x86 assembly (clang, -O0):
<AlarmToTimerC$0$Timer$fired>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <VirtualizeTimerC$0$TimerFrom$fired@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<AlarmToTimerC$0$Timer$fired>:
xor    %eax,%eax
jmp    1030 <VirtualizeTimerC$0$TimerFrom$fired@plt>

LLVM IR (-O0):
define void @"AlarmToTimerC$0$Timer$fired"() {
%1 = call i32 (...) @"VirtualizeTimerC$0$TimerFrom$fired"()
ret void
}

LLVM IR (-O2):
define void @"AlarmToTimerC$0$Timer$fired"() {
%1 = tail call i32 (...) @"VirtualizeTimerC$0$TimerFrom$fired"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("Usage: fifos "
         "-s/--size <bytes> "
         "-c/--count <number>"
         "\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Usage: fifos -s/--size <bytes> -c/--count <number>\0A\00"
@EXIT_FAILURE = global i32 0
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@str = [51 x i8] c"Usage: fifos -s/--size <bytes> -c/--count <number>\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_FAILURE
%3 = tail call i32 @exit(i32 %2)
unreachable
}
/* Variables and functions */
int do_smbus_write_byte(int, unsigned int, unsigned int, unsigned char);
int smbusx_write_byte(unsigned smb_index, unsigned device, unsigned address,
                      unsigned char val) {
  return do_smbus_write_byte(0x1000 + (smb_index << 8), device, address, val);
}


x86 assembly (clang, -O0):
<smbusx_write_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x8,%edi
add    $0x1000,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movzbl -0xd(%rbp),%ecx
call   1030 <do_smbus_write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smbusx_write_byte>:
shl    $0x8,%edi
add    $0x1000,%edi
jmp    1030 <do_smbus_write_byte@plt>

LLVM IR (-O0):
define i32 @smbusx_write_byte(i32 %0, i32 %1, i32 %2, i8 zeroext %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8 %3, i8* %8
%9 = load i32, i32* %5
%10 = shl i32 %9, 8
%11 = add i32 4096, %10
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i8, i8* %8
%15 = call i32 @do_smbus_write_byte(i32 %11, i32 %12, i32 %13, i8 zeroext %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @smbusx_write_byte(i32 %0, i32 %1, i32 %2, i8 zeroext %3) {
%5 = shl i32 %0, 8
%6 = add i32 %5, 4096
%7 = tail call i32 @do_smbus_write_byte(i32 %6, i32 %1, i32 %2, i8 zeroext %3)
ret i32 %7
}
double exphrf(double x, double l) { return l; }


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

x86 assembly (clang, -O2):
<exphrf>:
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @exphrf(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
ret double %5
}

LLVM IR (-O2):
define double @exphrf(double %0, double returned %1) {
ret double %1
}
void rop3_192_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  stk1 = T & S;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_192_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_192_1_0>:
and    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_192_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %6
%9 = zext i8 %8 to i32
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = and i32 %9, %11
%13 = trunc i32 %12 to i8
store i8 %13, i8* %7
%14 = load i8, i8* %7
%15 = zext i8 %14 to i32
%16 = load i8, i8* %5
%17 = zext i8 %16 to i32
%18 = xor i32 %17, -1
%19 = and i32 %15, %18
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i8, i8* %5
%24 = zext i8 %23 to i32
%25 = and i32 %22, %24
%26 = or i32 %19, %25
%27 = trunc i32 %26 to i8
%28 = load i8*, i8** %4
store i8 %27, i8* %28
ret void
}

LLVM IR (-O2):
define void @rop3_192_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %1
store i8 %5, i8* %0
ret void
}
/* Variables and functions */
int *malloc(int);
int *arr(int nelems) {
  if (nelems <= 0)
    return NULL;
  return malloc(nelems * sizeof(int));
}


x86 assembly (clang, -O0):
<arr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1132 <arr+0x22>
movq   $0x0,-0x8(%rbp)
jmp    1145 <arr+0x35>
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arr>:
test   %edi,%edi
jle    111c <arr+0xc>
shl    $0x2,%edi
jmp    1030 <malloc@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32* @arr(i32 %0) {
%2 = alloca i32*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32* null, i32** %2
br label %13
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 4
%11 = trunc i64 %10 to i32
%12 = call i32* @malloc(i32 %11)
store i32* %12, i32** %2
br label %13
13: ; preds = %7, %6
%14 = load i32*, i32** %2
ret i32* %14
}

LLVM IR (-O2):
define noalias i32* @arr(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = shl i32 %0, 2
%5 = tail call i32* @malloc(i32 %4)
br label %6
6: ; preds = %1, %3
%7 = phi i32* [ %5, %3 ], [ null, %1 ]
ret i32* %7
}
double apparent_sun_longitude(double theta, double delta_psi,
                              double delta_tau) {
  return theta + delta_psi + delta_tau;
}


x86 assembly (clang, -O0):
<apparent_sun_longitude>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<apparent_sun_longitude>:
addsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
ret

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

LLVM IR (-O2):
define double @apparent_sun_longitude(double %0, double %1, double %2) {
%4 = fadd double %0, %1
%5 = fadd double %4, %2
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ dp_env_destroy();
int /*<<< orphan*/ dp_env_init();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ test_dns_query();
int /*<<< orphan*/ test_enterprise_http_query();
int /*<<< orphan*/ test_http_query();
int /*<<< orphan*/ test_prefetch();
void dplus_test() {
  printf("test dplus functions\n");
  dp_env_init();
  test_http_query();
  test_enterprise_http_query();
  test_dns_query();
  test_prefetch();
  dp_env_destroy();
}


x86 assembly (clang, -O0):
<dplus_test>:
push   %rbp
mov    %rsp,%rbp
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <dp_env_init@plt>
mov    $0x0,%al
call   1050 <test_http_query@plt>
mov    $0x0,%al
call   1070 <test_enterprise_http_query@plt>
mov    $0x0,%al
call   1080 <test_dns_query@plt>
mov    $0x0,%al
call   1060 <test_prefetch@plt>
mov    $0x0,%al
call   1090 <dp_env_destroy@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dplus_test>:
push   %rax
lea    0xe88(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <dp_env_init@plt>
xor    %eax,%eax
call   1050 <test_http_query@plt>
xor    %eax,%eax
call   1070 <test_enterprise_http_query@plt>
xor    %eax,%eax
call   1080 <test_dns_query@plt>
xor    %eax,%eax
call   1060 <test_prefetch@plt>
xor    %eax,%eax
pop    %rcx
jmp    1090 <dp_env_destroy@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"test dplus functions\0A\00"
define void @dplus_test() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @dp_env_init()
%3 = call i32 (...) @test_http_query()
%4 = call i32 (...) @test_enterprise_http_query()
%5 = call i32 (...) @test_dns_query()
%6 = call i32 (...) @test_prefetch()
%7 = call i32 (...) @dp_env_destroy()
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"test dplus functions\00"
define void @dplus_test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @dp_env_init()
%3 = tail call i32 (...) @test_http_query()
%4 = tail call i32 (...) @test_enterprise_http_query()
%5 = tail call i32 (...) @test_dns_query()
%6 = tail call i32 (...) @test_prefetch()
%7 = tail call i32 (...) @dp_env_destroy()
ret void
}
void testInputValidity(char *eqaStr) {}


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

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

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

LLVM IR (-O2):
define void @testInputValidity(i8* nocapture %0) {
ret void
}
int test_imm_EAuint8_reg(unsigned char val) {
  return ((val) & (0xEA << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_EAuint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xea,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_EAuint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 234
%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_EAuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -22
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                          int);
int __int16_t_clone_array(const int16_t *p, int16_t *q, int elements) {
  memcpy(q, p, elements * sizeof(int16_t));
  return 0;
}


x86 assembly (clang, -O0):
<__int16_t_clone_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <memcpy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__int16_t_clone_array>:
push   %rax
mov    %rdi,%rax
shl    $0x2,%edx
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <memcpy@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @__int16_t_clone_array(i32* %0, i32* %1, i32 %2) {
%4 = shl i32 %2, 2
%5 = tail call i32 @memcpy(i32* %1, i32* %0, i32 %4)
ret i32 0
}
void mk20dx256_gpo_port_c_init(unsigned int pin) {
  *((volatile unsigned int *)0x40048038) |= (1 << 11);
  *((volatile unsigned int *)(0x4004B000 + 4 * pin)) =
      ((1) << 8) | (1 << 1) | (1 << 0) | (1 << 6);
  *((volatile unsigned int *)0x400FF094) |= 1 << pin;
  *((volatile unsigned int *)0x400FF080) |= 1 << pin;
}


x86 assembly (clang, -O0):
<mk20dx256_gpo_port_c_init>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x40048038,%eax
mov    (%rax),%ecx
or     $0x800,%ecx
mov    $0x40048038,%eax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
add    $0x4004b000,%eax
mov    %eax,%eax
movl   $0x143,(%rax)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    $0x400ff094,%ecx
mov    (%rcx),%ecx
or     %eax,%ecx
mov    $0x400ff094,%eax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    $0x400ff080,%ecx
mov    (%rcx),%ecx
or     %eax,%ecx
mov    $0x400ff080,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<mk20dx256_gpo_port_c_init>:
mov    %edi,%ecx
orl    $0x800,0x40048038
lea    0x4004b000(,%rcx,4),%eax
mov    $0x1,%edx
shl    %cl,%edx
movl   $0x143,(%rax)
or     %edx,0x400ff094
or     %edx,0x400ff080
ret

LLVM IR (-O0):
define void @mk20dx256_gpo_port_c_init(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load volatile i32, i32* inttoptr (i64 1074036792 to i32*)
%4 = or i32 %3, 2048
store volatile i32 %4, i32* inttoptr (i64 1074036792 to i32*)
%5 = load i32, i32* %2
%6 = mul i32 4, %5
%7 = add i32 1074049024, %6
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store volatile i32 323, i32* %9
%10 = load i32, i32* %2
%11 = shl i32 1, %10
%12 = load volatile i32, i32* inttoptr (i64 1074786452 to i32*)
%13 = or i32 %12, %11
store volatile i32 %13, i32* inttoptr (i64 1074786452 to i32*)
%14 = load i32, i32* %2
%15 = shl i32 1, %14
%16 = load volatile i32, i32* inttoptr (i64 1074786432 to i32*)
%17 = or i32 %16, %15
store volatile i32 %17, i32* inttoptr (i64 1074786432 to i32*)
ret void
}

LLVM IR (-O2):
define void @mk20dx256_gpo_port_c_init(i32 %0) {
%2 = load volatile i32, i32* inttoptr (i64 1074036792 to i32*)
%3 = or i32 %2, 2048
store volatile i32 %3, i32* inttoptr (i64 1074036792 to i32*)
%4 = shl i32 %0, 2
%5 = add i32 %4, 1074049024
%6 = zext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
store volatile i32 323, i32* %7
%8 = shl nuw i32 1, %0
%9 = load volatile i32, i32* inttoptr (i64 1074786452 to i32*)
%10 = or i32 %9, %8
store volatile i32 %10, i32* inttoptr (i64 1074786452 to i32*)
%11 = load volatile i32, i32* inttoptr (i64 1074786432 to i32*)
%12 = or i32 %11, %8
store volatile i32 %12, i32* inttoptr (i64 1074786432 to i32*)
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
char *stringMalloc(void) {
  char *str = malloc(sizeof(char) * 32);
  strcpy(str, "Hello world");
  return str;
}


x86 assembly (clang, -O0):
<stringMalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x20,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringMalloc>:
push   %rbx
mov    $0x20,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xecb(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello world\00"
define i8* @stringMalloc() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 32)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %1
ret i8* %5
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello world\00"
define i8* @stringMalloc() {
%1 = tail call dereferenceable_or_null(32) i8* @malloc(i32 32)
%2 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ cpu_nswap64p(int /*<<< orphan*/ *, int /*<<< orphan*/);
void le64_to_cpup(uint64_t *outp, uint64_t in) { cpu_nswap64p(outp, in); }


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

x86 assembly (clang, -O2):
<le64_to_cpup>:
jmp    1030 <cpu_nswap64p@plt>

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

LLVM IR (-O2):
define void @le64_to_cpup(i32* %0, i32 %1) {
%3 = tail call i32 @cpu_nswap64p(i32* %0, i32 %1)
ret void
}
/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ sprintf(char *, char *, double);
char *formatDouble(double value) {
  char *buf = (char *)calloc(1, 40);
  sprintf(buf, "%.2F", value);
  return buf;
}


x86 assembly (clang, -O0):
<formatDouble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    $0x1,%edi
mov    $0x28,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
lea    0xeb0(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<formatDouble>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
mov    $0x1,%edi
mov    $0x28,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
lea    0xebc(%rip),%rsi
mov    %rax,%rdi
movsd  0x8(%rsp),%xmm0
call   1040 <sprintf@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.2F\00"
define i8* @formatDouble(double %0) {
%2 = alloca double
%3 = alloca i8*
store double %0, double* %2
%4 = call i64 @calloc(i32 1, i32 40)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load double, double* %2
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.2F\00"
define i8* @formatDouble(double %0) {
%2 = tail call i64 @calloc(i32 1, i32 40)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %0)
ret i8* %3
}
const char *ccnxNotifyAPIAbout_MiniNotice(void) {
  return "Copyright (c) 2017 Cisco and/or its affiliates.\n";
}


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

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

LLVM IR (-O0):
@.str = [49 x i8] c"Copyright (c) 2017 Cisco and/or its affiliates.\0A\00"
define i8* @ccnxNotifyAPIAbout_MiniNotice() {
ret i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [49 x i8] c"Copyright (c) 2017 Cisco and/or its affiliates.\0A\00"
define i8* @ccnxNotifyAPIAbout_MiniNotice() {
ret i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int detect();
int /*<<< orphan*/ printf(char *);
void get_libname(void) {
  if (detect() == 1) {
    printf("loongson3r5\n");
  } else {
    printf("loongarch64\n");
  }
}


x86 assembly (clang, -O0):
<get_libname>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <detect@plt>
cmp    $0x1,%eax
jne    1145 <get_libname+0x25>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
jmp    1151 <get_libname+0x31>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_libname>:
push   %rax
xor    %eax,%eax
call   1040 <detect@plt>
cmp    $0x1,%eax
lea    0xeda(%rip),%rax
lea    0xec7(%rip),%rdi
cmove  %rax,%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"loongson3r5\0A\00"
@.str.1 = [13 x i8] c"loongarch64\0A\00"
define void @get_libname() {
%1 = call i32 (...) @detect()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"loongarch64\00"
@str.2 = [12 x i8] c"loongson3r5\00"
define void @get_libname() {
%1 = tail call i32 (...) @detect()
%2 = icmp eq i32 %1, 1
%3 = select i1 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret void
}
/* Type definitions */
struct option {
  int dummy;
};

/* Variables and functions */
int getopt_internal(int, char *const *, char const *, struct option const *,
                    int *, int);
int getopt_long_only(int argc, char *const argv[], const char *shortopts,
                     const struct option *longopts, int *longind) {
  return getopt_internal(argc, argv, shortopts, longopts, longind, 1);
}


x86 assembly (clang, -O0):
<getopt_long_only>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    $0x1,%r9d
call   1030 <getopt_internal@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getopt_long_only>:
mov    $0x1,%r9d
jmp    1030 <getopt_internal@plt>

LLVM IR (-O0):
%struct.option = type { i32 }
define i32 @getopt_long_only(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca %struct.option*
%10 = alloca i32*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store %struct.option* %3, %struct.option** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i8**, i8*** %7
%13 = load i8*, i8** %8
%14 = load %struct.option*, %struct.option** %9
%15 = load i32*, i32** %10
%16 = call i32 @getopt_internal(i32 %11, i8** %12, i8* %13, %struct.option* %14, i32* %15, i32 1)
ret i32 %16
}

LLVM IR (-O2):
%struct.option = type { i32 }
define i32 @getopt_long_only(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4) {
%6 = tail call i32 @getopt_internal(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 1)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ dcc_write(int);
void debug_write(char msg) { dcc_write(0x02 | ((msg & 0xff) << 16)); }


x86 assembly (clang, -O0):
<debug_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
and    $0xff,%edi
shl    $0x10,%edi
or     $0x2,%edi
call   1030 <dcc_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debug_write>:
movzbl %dil,%edi
shl    $0x10,%edi
or     $0x2,%edi
jmp    1030 <dcc_write@plt>

LLVM IR (-O0):
define void @debug_write(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 255
%6 = shl i32 %5, 16
%7 = or i32 2, %6
%8 = call i32 @dcc_write(i32 %7)
ret void
}

LLVM IR (-O2):
define void @debug_write(i8 signext %0) {
%2 = zext i8 %0 to i32
%3 = shl nuw nsw i32 %2, 16
%4 = or i32 %3, 2
%5 = tail call i32 @dcc_write(i32 %4)
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ type;
};
struct TYPE_4__ {
  TYPE_1__ xgraphicsexpose;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xgraphicsexpose_type(void *_p) {
  return (int)((XEvent *)_p)->xgraphicsexpose.type;
}


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

x86 assembly (clang, -O2):
<get_XEvent_xgraphicsexpose_type>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i32 @get_XEvent_xgraphicsexpose_type(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_XEvent_xgraphicsexpose_type(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
char *place_commas_in_number_string(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *place_commas_in_integer(int n) {
  char s[20];
  sprintf(s, "%d", n);
  return place_commas_in_number_string(s);
}


x86 assembly (clang, -O0):
<place_commas_in_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xec7(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <place_commas_in_number_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<place_commas_in_integer>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%edx
lea    0xed2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <place_commas_in_number_string@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i8* @place_commas_in_integer(i32 %0) {
%2 = alloca i32
%3 = alloca [20 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = call i8* @place_commas_in_number_string(i8* %7)
ret i8* %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i8* @place_commas_in_integer(i32 %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = call i8* @place_commas_in_number_string(i8* %3)
ret i8* %5
}
void RandomFunc(unsigned short input[1], unsigned short output[1]) {
  unsigned short state[1];
  unsigned short local1;
  {
    state[0UL] = (input[0UL] + 51238316UL) + (unsigned short)8426;
    local1 = 0UL;
    while (local1 < 1UL) {
      local1 += 2UL;
    }
    output[0UL] = (state[0UL] + 707305405UL) * (unsigned short)58185;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
add    $0x30dd5ac,%rax
add    $0x20ea,%rax
mov    %ax,-0x12(%rbp)
movw   $0x0,-0x14(%rbp)
movzwl -0x14(%rbp),%eax
cmp    $0x1,%rax
jae    1148 <RandomFunc+0x48>
movzwl -0x14(%rbp),%eax
add    $0x2,%rax
mov    %ax,-0x14(%rbp)
jmp    1129 <RandomFunc+0x29>
movzwl -0x12(%rbp),%eax
add    $0x2a289fbd,%rax
imul   $0xe349,%rax,%rax
mov    %ax,%cx
mov    -0x10(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
movzwl (%rdi),%eax
imul   $0xffffe349,%eax,%eax
add    $0x76ab,%eax
mov    %ax,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i16* %0, i16* %1) {
%3 = alloca i16*
%4 = alloca i16*
%5 = alloca [1 x i16]
%6 = alloca i16
store i16* %0, i16** %3
store i16* %1, i16** %4
%7 = load i16*, i16** %3
%8 = getelementptr inbounds i16, i16* %7, i64 0
%9 = load i16, i16* %8
%10 = zext i16 %9 to i64
%11 = add i64 %10, 51238316
%12 = add i64 %11, 8426
%13 = trunc i64 %12 to i16
%14 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
store i16 %13, i16* %14
store i16 0, i16* %6
br label %15
15: ; preds = %19, %2
%16 = load i16, i16* %6
%17 = zext i16 %16 to i64
%18 = icmp ult i64 %17, 1
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = load i16, i16* %6
%21 = zext i16 %20 to i64
%22 = add i64 %21, 2
%23 = trunc i64 %22 to i16
store i16 %23, i16* %6
br label %15
24: ; preds = %15
%25 = getelementptr inbounds [1 x i16], [1 x i16]* %5, i64 0, i64 0
%26 = load i16, i16* %25
%27 = zext i16 %26 to i64
%28 = add i64 %27, 707305405
%29 = mul i64 %28, 58185
%30 = trunc i64 %29 to i16
%31 = load i16*, i16** %4
%32 = getelementptr inbounds i16, i16* %31, i64 0
store i16 %30, i16* %32
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i16* nocapture %0, i16* nocapture writeonly %1) {
%3 = load i16, i16* %0
%4 = mul i16 %3, -7351
%5 = add i16 %4, 30379
store i16 %5, i16* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ doathing(int /*<<< orphan*/);
int main() { doathing(0); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <doathing@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @doathing(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @doathing(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
void __attribute__((__section__("mlocked_text")))
stress_sigsegv_handler(int signum) {
  (void)signum;
  _exit(0);
}


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

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

LLVM IR (-O0):
define void @stress_sigsegv_handler(i32 %0) section "mlocked_text" {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @stress_sigsegv_handler(i32 %0) section "mlocked_text" {
%2 = tail call i32 @_exit(i32 0)
unreachable
}
unsigned long BKDRHash(const char *str) {
  unsigned long seed = 131;
  unsigned long hash = 0;
  while (*str) {
    hash = hash * seed + (*str);
    str++;
  }
  return hash;
}


x86 assembly (clang, -O0):
<BKDRHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x83,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114e <BKDRHash+0x4e>
mov    -0x18(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
movsbq (%rcx),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1118 <BKDRHash+0x18>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BKDRHash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112a <BKDRHash+0x2a>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
imul   $0x83,%rax,%rdx
movsbq %cl,%rax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <BKDRHash+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @BKDRHash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i64 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = mul i64 %6, 131
%9 = sext i8 %5 to i64
%10 = add i64 %8, %9
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 0, %1 ], [ %10, %4 ]
ret i64 %15
}
/* Variables and functions */
float areafunc(int);
int /*<<< orphan*/ printf(char *, float);
int main() {
  int radius = 10;
  float result;
  result = areafunc(radius);
  printf("The result is %f\n", result);
  result = areafunc(2);
  printf("The result is %f\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <areafunc@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <areafunc@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
call   1040 <areafunc@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <areafunc@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"The result is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store i32 0, i32* %1
store i32 10, i32* %2
%4 = load i32, i32* %2
%5 = call float @areafunc(i32 %4)
store float %5, float* %3
%6 = load float, float* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), float %6)
%8 = call float @areafunc(i32 2)
store float %8, float* %3
%9 = load float, float* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), float %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"The result is %f\0A\00"
define i32 @main() {
%1 = tail call float @areafunc(i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), float %1)
%3 = tail call float @areafunc(i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), float %3)
ret i32 0
}
/* Variables and functions */
double choose(int, int);
double pow(int, int);
double success_prob(int successes, int trials, double probability) {
  return choose(trials, successes) * pow(probability, successes) *
         pow(1 - probability, trials - successes);
}


x86 assembly (clang, -O0):
<success_prob>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <choose@plt>
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x10(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe97(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%edi
mov    -0x8(%rbp),%esi
sub    -0x4(%rbp),%esi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<success_prob>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%edi
mov    %ebp,%esi
call   1030 <choose@plt>
movsd  %xmm0,0x8(%rsp)
cvttsd2si 0x10(%rsp),%edi
mov    %ebp,%esi
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xea0(%rip),%xmm0
subsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%edi
sub    %ebp,%ebx
mov    %ebx,%esi
call   1040 <pow@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @success_prob(i32 %0, i32 %1, double %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
store double %2, double* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = call double @choose(i32 %7, i32 %8)
%10 = load double, double* %6
%11 = fptosi double %10 to i32
%12 = load i32, i32* %4
%13 = call double @pow(i32 %11, i32 %12)
%14 = fmul double %9, %13
%15 = load double, double* %6
%16 = fsub double 1.000000e+00, %15
%17 = fptosi double %16 to i32
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = sub nsw i32 %18, %19
%21 = call double @pow(i32 %17, i32 %20)
%22 = fmul double %14, %21
ret double %22
}

LLVM IR (-O2):
define double @success_prob(i32 %0, i32 %1, double %2) {
%4 = tail call double @choose(i32 %1, i32 %0)
%5 = fptosi double %2 to i32
%6 = tail call double @pow(i32 %5, i32 %0)
%7 = fmul double %4, %6
%8 = fsub double 1.000000e+00, %2
%9 = fptosi double %8 to i32
%10 = sub nsw i32 %1, %0
%11 = tail call double @pow(i32 %9, i32 %10)
%12 = fmul double %7, %11
ret double %12
}
int main(void) {
  int a[10];
  a[10000] = 1;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 10000
store i32 1, i32* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int test(int);
int main() { return test(1) != 1; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <test@plt>
cmp    $0x1,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <test@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test(i32 1)
%3 = icmp ne i32 %2, 1
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test(i32 1)
%2 = icmp ne i32 %1, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int blah(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
main() {
  if (blah(-1) != 1)
    abort();
  else
    exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffff,%edi
call   1040 <blah@plt>
cmp    $0x1,%eax
je     1159 <main+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
call   1040 <blah@plt>
cmp    $0x1,%eax
jne    1147 <main+0x17>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @blah(i32 -1)
%3 = icmp ne i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @blah(i32 -1)
%2 = icmp eq i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
void psClosePrng(void) { return; }


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

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

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

LLVM IR (-O2):
define void @psClosePrng() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *strerror(int);
int main(void) {
  printf("%s\n", strerror(2));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1040 <strerror@plt>
lea    0xece(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i8* @strerror(i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ const wchar_t;

/* Variables and functions */
wchar_t *(rawwmemrchr)(const wchar_t *segment, wchar_t c, size_t size) {
  for (;;)
    if (segment[--size] == c)
      return segment + size;
}


x86 assembly (clang, -O0):
<rawwmemrchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rax,%rcx,8),%rax
cmp    -0x10(%rbp),%rax
jne    1143 <rawwmemrchr+0x43>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
pop    %rbp
ret
jmp    1110 <rawwmemrchr+0x10>

x86 assembly (clang, -O2):
<rawwmemrchr>:
lea    (%rdi,%rdx,8),%rax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%rcx
add    $0xfffffffffffffff8,%rax
cmp    %rsi,-0x8(%rcx)
jne    1110 <rawwmemrchr+0x10>
ret

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

LLVM IR (-O2):
define i64* @rawwmemrchr(i64* %0, i64 %1, i64 %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i64 [ %2, %3 ], [ %6, %4 ]
%6 = add i64 %5, -1
%7 = getelementptr inbounds i64, i64* %0, i64 %6
%8 = load i64, i64* %7
%9 = icmp eq i64 %8, %1
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = getelementptr inbounds i64, i64* %0, i64 %6
ret i64* %11
}