xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ expect_equal_failed(long, long, char const *, int);
int /*<<< orphan*/ expectation_passed();
void _expect_equal(long exp, long act, const char *file, int line) {
  if (exp == act)
    expectation_passed();
  else
    expect_equal_failed(exp, act, file, line);
}


x86 assembly (clang, -O0):
<_expect_equal>:
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),%rax
cmp    -0x10(%rbp),%rax
jne    1151 <_expect_equal+0x31>
mov    $0x0,%al
call   1030 <expectation_passed@plt>
jmp    1165 <_expect_equal+0x45>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1040 <expect_equal_failed@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_expect_equal>:
cmp    %rsi,%rdi
jne    112c <_expect_equal+0xc>
xor    %eax,%eax
jmp    1030 <expectation_passed@plt>
jmp    1040 <expect_equal_failed@plt>

LLVM IR (-O0):
define void @_expect_equal(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i64 %0, i64* %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = call i32 (...) @expectation_passed()
br label %20
14: ; preds = %4
%15 = load i64, i64* %5
%16 = load i64, i64* %6
%17 = load i8*, i8** %7
%18 = load i32, i32* %8
%19 = call i32 @expect_equal_failed(i64 %15, i64 %16, i8* %17, i32 %18)
br label %20
20: ; preds = %14, %12
ret void
}

LLVM IR (-O2):
define void @_expect_equal(i64 %0, i64 %1, i8* %2, i32 %3) {
%5 = icmp eq i64 %0, %1
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = tail call i32 (...) @expectation_passed()
br label %10
8: ; preds = %4
%9 = tail call i32 @expect_equal_failed(i64 %0, i64 %1, i8* %2, i32 %3)
br label %10
10: ; preds = %8, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void report(const char *label) {
  fprintf(stderr, "cleantmp: %s: %s\n", label, strerror(errno));
}


x86 assembly (clang, -O0):
<report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    %rax,%rcx
lea    0xea1(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb3(%rip),%rax
mov    (%rax),%ebp
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xebc(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"cleantmp: %s: %s\0A\00"
@errno = global i32 0
define void @report(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = load i32, i32* @errno
%6 = call i8* @strerror(i32 %5)
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"cleantmp: %s: %s\0A\00"
@errno = global i32 0
define void @report(i8* %0) {
%2 = load i32, i32* @stderr
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
%5 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4)
ret void
}
int main() {
  int data1 = 10;
  int data2 = 20;
  asm("imull %[value1], %[value2]"
      : [value2] "=r"(data2)
      : [value1] "r"(data1), "0"(data2));
  printf("The result is %d\n", data2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0x14,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"The result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 20, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = call i32 asm "imull $1, $0", "=r,r,0,~{dirflag},~{fpsr},~{flags}"(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"The result is %d\0A\00"
define i32 @main() {
%1 = tail call i32 asm "imull $1, $0", "=r,r,0,~{dirflag},~{fpsr},~{flags}"(i32 10, i32 20)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ put_char(char);
int /*<<< orphan*/ put_word(unsigned int);
void target_write_word(unsigned addr, unsigned data) {
  put_char('w');
  put_word(addr);
  put_word(data);
}


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

x86 assembly (clang, -O2):
<target_write_word>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x77,%edi
call   1030 <put_char@plt>
mov    %ebp,%edi
call   1040 <put_word@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <put_word@plt>

LLVM IR (-O0):
define void @target_write_word(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @put_char(i8 signext 119)
%6 = load i32, i32* %3
%7 = call i32 @put_word(i32 %6)
%8 = load i32, i32* %4
%9 = call i32 @put_word(i32 %8)
ret void
}

LLVM IR (-O2):
define void @target_write_word(i32 %0, i32 %1) {
%3 = tail call i32 @put_char(i8 signext 119)
%4 = tail call i32 @put_word(i32 %0)
%5 = tail call i32 @put_word(i32 %1)
ret void
}
/* Variables and functions */
char *U_WMRCORENONE_set(char *);
char *U_WMR46_set(void) { return U_WMRCORENONE_set("U_WMR46"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR46\00"
define i8* @U_WMR46_set() {
%1 = call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR46\00"
define i8* @U_WMR46_set() {
%1 = tail call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
void wifi_evt_sme_ap_client_left(
    const struct wifi_msg_sme_ap_client_left_evt_t *msg) {}


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

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

LLVM IR (-O0):
%struct.wifi_msg_sme_ap_client_left_evt_t = type opaque
define void @wifi_evt_sme_ap_client_left(%struct.wifi_msg_sme_ap_client_left_evt_t* %0) {
%2 = alloca %struct.wifi_msg_sme_ap_client_left_evt_t*
store %struct.wifi_msg_sme_ap_client_left_evt_t* %0, %struct.wifi_msg_sme_ap_client_left_evt_t** %2
ret void
}

LLVM IR (-O2):
%struct.wifi_msg_sme_ap_client_left_evt_t = type opaque
define void @wifi_evt_sme_ap_client_left(%struct.wifi_msg_sme_ap_client_left_evt_t* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void I2C3_EV_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @I2C3_EV_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @I2C3_EV_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void drawPlotter(void *data) {
  char pattern;
  pattern = *((char *)data);
  printf("%c", pattern);
}


x86 assembly (clang, -O0):
<drawPlotter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
lea    0xed4(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawPlotter>:
movsbl (%rdi),%esi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @drawPlotter(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %2)
ret void
}
int merge_two_s(int a, unsigned int b, int n) { return (int)((a << n) + b); }


x86 assembly (clang, -O0):
<merge_two_s>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_two_s>:
mov    %edx,%ecx
shl    %cl,%edi
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @merge_two_s(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %0, %2
%5 = add i32 %4, %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ scanline_col32cb16blend_test();
int main() {
  scanline_col32cb16blend_test();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @scanline_col32cb16blend_test()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void flvii_destroy_tag_body(char *buf) {
  if (buf) {
    free(buf);
  }
}


x86 assembly (clang, -O0):
<flvii_destroy_tag_body>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <flvii_destroy_tag_body+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flvii_destroy_tag_body>:
test   %rdi,%rdi
je     111a <flvii_destroy_tag_body+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @flvii_destroy_tag_body(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i32 @free(i8* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @flvii_destroy_tag_body(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
int neg(int n) { return n * (-1); }


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

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

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

LLVM IR (-O2):
define i32 @neg(i32 %0) {
%2 = sub nsw i32 0, %0
ret i32 %2
}
int gui_loadResources() { return -1; }


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

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

LLVM IR (-O0):
define i32 @gui_loadResources() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @gui_loadResources() {
ret i32 -1
}
/* Variables and functions */
char *getcwd(char *, int);
char *GETCWD(char *cwd, int size) { return getcwd(cwd, size); }


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

x86 assembly (clang, -O2):
<GETCWD>:
jmp    1030 <getcwd@plt>

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

LLVM IR (-O2):
define i8* @GETCWD(i8* %0, i32 %1) {
%3 = tail call i8* @getcwd(i8* %0, i32 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void aliyun_iot_memory_free(void *ptr) {
  free(ptr);
  return;
}


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

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

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

LLVM IR (-O2):
define void @aliyun_iot_memory_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ sscanf(char const *, char *, int *);
void foo(const char *s, int *p) {
  scanf("%ld", p);
  sscanf(s, "%ld", p);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xec5(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeb1(%rip),%rsi
call   1030 <sscanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xece(%rip),%r15
mov    %r15,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <sscanf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
define void @foo(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %4
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %5)
%7 = load i8*, i8** %3
%8 = load i32*, i32** %4
%9 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %8)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
define void @foo(i8* nocapture %0, i32* %1) {
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = tail call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
ret void
}
int main() {
  int a;
  a = 42;
  return a;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 42
}
/* Type definitions */
struct i8x_object {
  int dummy;
};
struct i8x_ctx {
  int dummy;
};

/* Variables and functions */
void *i8x_ob_get_userdata(struct i8x_object *);
void *__attribute__((always_)) i8x_ctx_get_userdata(struct i8x_ctx *x) {
  return i8x_ob_get_userdata((struct i8x_object *)x);
}


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

x86 assembly (clang, -O2):
<i8x_ctx_get_userdata>:
jmp    1030 <i8x_ob_get_userdata@plt>

LLVM IR (-O0):
%struct.i8x_ctx = type { i32 }
%struct.i8x_object = type { i32 }
define i8* @i8x_ctx_get_userdata(%struct.i8x_ctx* %0) {
%2 = alloca %struct.i8x_ctx*
store %struct.i8x_ctx* %0, %struct.i8x_ctx** %2
%3 = load %struct.i8x_ctx*, %struct.i8x_ctx** %2
%4 = bitcast %struct.i8x_ctx* %3 to %struct.i8x_object*
%5 = call i8* @i8x_ob_get_userdata(%struct.i8x_object* %4)
ret i8* %5
}

LLVM IR (-O2):
%struct.i8x_ctx = type { i32 }
%struct.i8x_object = type { i32 }
define i8* @i8x_ctx_get_userdata(%struct.i8x_ctx* %0) {
%2 = bitcast %struct.i8x_ctx* %0 to %struct.i8x_object*
%3 = tail call i8* @i8x_ob_get_userdata(%struct.i8x_object* %2)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ PTHREAD_CREATE_JOINABLE;
int /*<<< orphan*/ pthread_attr_init(int /*<<< orphan*/ *);
int /*<<< orphan*/ pthread_attr_setdetachstate(int /*<<< orphan*/ *,
                                               int /*<<< orphan*/);
int /*<<< orphan*/ pthread_attr_setstacksize(int /*<<< orphan*/ *,
                                             unsigned int);
void default_pthead_attr(pthread_attr_t *attr) {
  if (attr == (pthread_attr_t *)NULL) {
    return;
  }
  pthread_attr_init(attr);
  pthread_attr_setdetachstate(attr, PTHREAD_CREATE_JOINABLE);
  pthread_attr_setstacksize(attr, 1024u * 1024u);
  return;
}


x86 assembly (clang, -O0):
<default_pthead_attr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    114c <default_pthead_attr+0x1c>
jmp    1175 <default_pthead_attr+0x45>
mov    -0x8(%rbp),%rdi
call   1030 <pthread_attr_init@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e88(%rip),%rax
mov    (%rax),%esi
call   1040 <pthread_attr_setdetachstate@plt>
mov    -0x8(%rbp),%rdi
mov    $0x100000,%esi
call   1050 <pthread_attr_setstacksize@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<default_pthead_attr>:
test   %rdi,%rdi
je     115d <default_pthead_attr+0x2d>
push   %rbx
mov    %rdi,%rbx
call   1030 <pthread_attr_init@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1040 <pthread_attr_setdetachstate@plt>
mov    %rbx,%rdi
mov    $0x100000,%esi
pop    %rbx
jmp    1050 <pthread_attr_setstacksize@plt>
ret

LLVM IR (-O0):
@PTHREAD_CREATE_JOINABLE = global i32 0
define void @default_pthead_attr(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %6
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = load i32*, i32** %2
%8 = call i32 @pthread_attr_init(i32* %7)
%9 = load i32*, i32** %2
%10 = load i32, i32* @PTHREAD_CREATE_JOINABLE
%11 = call i32 @pthread_attr_setdetachstate(i32* %9, i32 %10)
%12 = load i32*, i32** %2
%13 = call i32 @pthread_attr_setstacksize(i32* %12, i32 1048576)
br label %14
14: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
@PTHREAD_CREATE_JOINABLE = global i32 0
define void @default_pthead_attr(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = tail call i32 @pthread_attr_init(i32* %0)
%5 = load i32, i32* @PTHREAD_CREATE_JOINABLE
%6 = tail call i32 @pthread_attr_setdetachstate(i32* %0, i32 %5)
%7 = tail call i32 @pthread_attr_setstacksize(i32* %0, i32 1048576)
br label %8
8: ; preds = %1, %3
ret void
}
int f(int a, int b) { return 2 * a - b; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
sub    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    (%rdi,%rdi,1),%eax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @f(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 = mul nsw i32 2, %5
%7 = load i32, i32* %4
%8 = sub nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 1
%4 = sub nsw i32 %3, %1
ret i32 %4
}
/* Variables and functions */
int foo(int);
int main(int argc, const char *argv[]) { return foo(argc); }


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

x86 assembly (clang, -O2):
<main>:
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @foo(i32 %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ insl(unsigned int, void *, unsigned long);
void nsp_multi_read_4(unsigned int BaseAddr, unsigned int Register, void *buf,
                      unsigned long count) {
  insl(BaseAddr + Register, buf, count);
}


x86 assembly (clang, -O0):
<nsp_multi_read_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
add    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <insl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nsp_multi_read_4>:
add    %esi,%edi
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1030 <insl@plt>

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

LLVM IR (-O2):
define void @nsp_multi_read_4(i32 %0, i32 %1, i8* %2, i64 %3) {
%5 = add i32 %1, %0
%6 = tail call i32 @insl(i32 %5, i8* %2, i64 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CC2420SpiP__ChipSpiResource__abortRelease();
void CC2420TransmitP__ChipSpiResource__abortRelease(void) {
  CC2420SpiP__ChipSpiResource__abortRelease();
}


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

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

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

LLVM IR (-O2):
define void @CC2420TransmitP__ChipSpiResource__abortRelease() {
%1 = tail call i32 (...) @CC2420SpiP__ChipSpiResource__abortRelease()
ret void
}
unsigned int num_digits(unsigned int num) {
  if (num < 10)
    return 1;
  return 1 + num_digits(num / 10);
}


x86 assembly (clang, -O0):
<num_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jae    1131 <num_digits+0x21>
movl   $0x1,-0x4(%rbp)
jmp    114a <num_digits+0x3a>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%edi
call   1030 <num_digits@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_digits>:
mov    $0x1,%eax
cmp    $0xa,%edi
jb     1134 <num_digits+0x34>
mov    $0x1,%eax
mov    $0xcccccccd,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%eax
cmp    $0x63,%edi
mov    %edx,%edi
ja     1120 <num_digits+0x20>
ret

LLVM IR (-O0):
define i32 @num_digits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ult i32 %4, 10
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 = udiv i32 %8, 10
%10 = call i32 @num_digits(i32 %9)
%11 = add i32 1, %10
store i32 %11, i32* %2
br label %12
12: ; preds = %7, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @num_digits(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = phi i32 [ %7, %3 ], [ 0, %1 ]
%6 = udiv i32 %4, 10
%7 = add i32 %5, 1
%8 = icmp ult i32 %4, 100
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = add i32 %5, 2
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 1, %1 ], [ %10, %9 ]
ret i32 %12
}
float lerpf(float a, float b, float t) { return a * (1.f - t) + b * t; }


x86 assembly (clang, -O0):
<lerpf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xee0(%rip),%xmm2
subss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lerpf>:
movss  0xef8(%rip),%xmm3
subss  %xmm2,%xmm3
mulss  %xmm2,%xmm1
mulss  %xmm3,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @lerpf(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %6
%9 = fsub float 1.000000e+00, %8
%10 = load float, float* %5
%11 = load float, float* %6
%12 = fmul float %10, %11
%13 = call float @llvm.fmuladd.f32(float %7, float %9, float %12)
ret float %13
}

LLVM IR (-O2):
define float @lerpf(float %0, float %1, float %2) {
%4 = fsub float 1.000000e+00, %2
%5 = fmul float %1, %2
%6 = tail call float @llvm.fmuladd.f32(float %0, float %4, float %5)
ret float %6
}
/* Variables and functions */
scalar_t__ strncmp(char const *, char *, int);
int is_dos2unix(const char *progname) {
  if ((strncmp(progname, "dos2unix", sizeof("dos2unix")) == 0) ||
      (strncmp(progname, "mac2unix", sizeof("mac2unix")) == 0))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<is_dos2unix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     115a <is_dos2unix+0x4a>
mov    -0x10(%rbp),%rdi
lea    0xec3(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1166 <is_dos2unix+0x56>
movl   $0x1,-0x4(%rbp)
jmp    116d <is_dos2unix+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_dos2unix>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0x9,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     114b <is_dos2unix+0x3b>
lea    0xed8(%rip),%rsi
mov    %rbx,%rdi
mov    $0x9,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"dos2unix\00"
@.str.1 = [9 x i8] c"mac2unix\00"
define i32 @is_dos2unix(i8* %0) {
%2 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 9)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 9)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
__attribute__((no, noclone)) short foo4(short arg) {
  short ret = 1;
  if (arg + 1 < 12 || arg + 1 > ((!0) ? ((1 << (sizeof(short) * 8 - 1)) - 1)
                                      : ((1 << (sizeof(short) * 8)) - 1)) +
                                    1)
    return ret;
  arg = arg + 1;
  ret = (char)arg;
  return arg;
}


x86 assembly (clang, -O0):
<foo4>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
movw   $0x1,-0x6(%rbp)
movswl -0x4(%rbp),%eax
add    $0x1,%eax
cmp    $0xc,%eax
jl     1133 <foo4+0x33>
movswl -0x4(%rbp),%eax
add    $0x1,%eax
cmp    $0x8000,%eax
jle    1140 <foo4+0x40>
mov    -0x6(%rbp),%ax
mov    %ax,-0x2(%rbp)
jmp    115e <foo4+0x5e>
movswl -0x4(%rbp),%eax
add    $0x1,%eax
mov    %ax,-0x4(%rbp)
mov    -0x4(%rbp),%ax
movsbl %al,%eax
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo4>:
lea    0x1(%rdi),%ecx
cmp    $0xb,%di
mov    $0x1,%eax
cmovge %ecx,%eax
ret

LLVM IR (-O0):
define signext i16 @foo4(i16 signext %0) {
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 1, i16* %4
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
%7 = add nsw i32 %6, 1
%8 = icmp slt i32 %7, 12
br i1 %8, label %14, label %9
9: ; preds = %1
%10 = load i16, i16* %3
%11 = sext i16 %10 to i32
%12 = add nsw i32 %11, 1
%13 = icmp sgt i32 %12, 32768
br i1 %13, label %14, label %16
14: ; preds = %9, %1
%15 = load i16, i16* %4
store i16 %15, i16* %2
br label %25
16: ; preds = %9
%17 = load i16, i16* %3
%18 = sext i16 %17 to i32
%19 = add nsw i32 %18, 1
%20 = trunc i32 %19 to i16
store i16 %20, i16* %3
%21 = load i16, i16* %3
%22 = trunc i16 %21 to i8
%23 = sext i8 %22 to i16
store i16 %23, i16* %4
%24 = load i16, i16* %3
store i16 %24, i16* %2
br label %25
25: ; preds = %16, %14
%26 = load i16, i16* %2
ret i16 %26
}

LLVM IR (-O2):
define signext i16 @foo4(i16 signext %0) {
%2 = add i16 %0, 1
%3 = icmp slt i16 %0, 11
%4 = select i1 %3, i16 1, i16 %2
ret i16 %4
}
/* Variables and functions */
scalar_t__ pow(int, int);
int sumfif(int n) {
  int res = 0, i = n;
  while (i > 0) {
    res += pow(i % 10, 5);
    i = i / 10;
  }
  return res;
}


x86 assembly (clang, -O0):
<sumfif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1169 <sumfif+0x59>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
mov    $0x5,%esi
call   1030 <pow@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1128 <sumfif+0x18>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumfif>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    115a <sumfif+0x4a>
mov    %edi,%ebp
xor    %r15d,%r15d
mov    $0xcccccccd,%r14d
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%ebx
imul   %r14,%rbx
shr    $0x23,%rbx
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %ebp,%edi
sub    %eax,%edi
mov    $0x5,%esi
call   1030 <pow@plt>
add    %eax,%r15d
cmp    $0x9,%ebp
mov    %ebx,%ebp
ja     1130 <sumfif+0x20>
jmp    115d <sumfif+0x4d>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @sumfif(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = load i32, i32* %2
store i32 %5, i32* %4
br label %6
6: ; preds = %9, %1
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %4
%11 = srem i32 %10, 10
%12 = call i64 @pow(i32 %11, i32 5)
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = add nsw i64 %14, %12
%16 = trunc i64 %15 to i32
store i32 %16, i32* %3
%17 = load i32, i32* %4
%18 = sdiv i32 %17, 10
store i32 %18, i32* %4
br label %6
19: ; preds = %6
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @sumfif(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %12
3: ; preds = %1, %3
%4 = phi i32 [ %10, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = urem i32 %4, 10
%7 = tail call i64 @pow(i32 %6, i32 5)
%8 = trunc i64 %7 to i32
%9 = add i32 %5, %8
%10 = udiv i32 %4, 10
%11 = icmp ult i32 %4, 10
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ 0, %1 ], [ %9, %3 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
__attribute__((always_)) void hp3(void) { printf("hello, world!\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"hello, world!\00"
define void @hp3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
main() {
  int x[5];
  return x[6];
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 poison
}
int get_ScrnRows(void) { return 25; }


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

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

LLVM IR (-O0):
define i32 @get_ScrnRows() {
ret i32 25
}

LLVM IR (-O2):
define i32 @get_ScrnRows() {
ret i32 25
}
void subsystem_init(struct kset *x) { return; }


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

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

LLVM IR (-O0):
%struct.kset = type opaque
define void @subsystem_init(%struct.kset* %0) {
%2 = alloca %struct.kset*
store %struct.kset* %0, %struct.kset** %2
ret void
}

LLVM IR (-O2):
%struct.kset = type opaque
define void @subsystem_init(%struct.kset* nocapture %0) {
ret void
}
int GetMaxInt(void) { return ((unsigned int)-1) >> 1; }


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

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

LLVM IR (-O0):
define i32 @GetMaxInt() {
ret i32 2147483647
}

LLVM IR (-O2):
define i32 @GetMaxInt() {
ret i32 2147483647
}
void devfreq_cooling_unregister(struct thermal_cooling_device *cdev) { return; }


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

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

LLVM IR (-O0):
%struct.thermal_cooling_device = type opaque
define void @devfreq_cooling_unregister(%struct.thermal_cooling_device* %0) {
%2 = alloca %struct.thermal_cooling_device*
store %struct.thermal_cooling_device* %0, %struct.thermal_cooling_device** %2
ret void
}

LLVM IR (-O2):
%struct.thermal_cooling_device = type opaque
define void @devfreq_cooling_unregister(%struct.thermal_cooling_device* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ expand(char *, char const *, char **, int,
                          int /*<<< orphan*/);
void expand_s(char *str, const char *fmt, char **args, int len) {
  expand(str, fmt, args, len, 0);
}


x86 assembly (clang, -O0):
<expand_s>:
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),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
xor    %r8d,%r8d
call   1030 <expand@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand_s>:
xor    %r8d,%r8d
jmp    1030 <expand@plt>

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

LLVM IR (-O2):
define void @expand_s(i8* %0, i8* %1, i8** %2, i32 %3) {
%5 = tail call i32 @expand(i8* %0, i8* %1, i8** %2, i32 %3, i32 0)
ret void
}
/* Variables and functions */
scalar_t__ Pop();
int /*<<< orphan*/ Push(int);
int CmdOrLogical(void) {
  Push(Pop() || Pop());
  return 0;
}


x86 assembly (clang, -O0):
<CmdOrLogical>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <Pop@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
jne    1152 <CmdOrLogical+0x32>
mov    $0x0,%al
call   1030 <Pop@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <Push@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdOrLogical>:
push   %rax
xor    %eax,%eax
call   1030 <Pop@plt>
mov    $0x1,%edi
test   %rax,%rax
jne    1142 <CmdOrLogical+0x22>
xor    %eax,%eax
call   1030 <Pop@plt>
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1040 <Push@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @CmdOrLogical() {
%1 = call i64 (...) @Pop()
%2 = icmp ne i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = call i64 (...) @Pop()
%5 = icmp ne i64 %4, 0
br label %6
6: ; preds = %3, %0
%7 = phi i1 [ true, %0 ], [ %5, %3 ]
%8 = zext i1 %7 to i32
%9 = call i32 @Push(i32 %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @CmdOrLogical() {
%1 = tail call i64 (...) @Pop()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i64 (...) @Pop()
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ 1, %0 ], [ %6, %3 ]
%9 = tail call i32 @Push(i32 %8)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_shuffle_epi32(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i test_mm_shuffle_epi32(__m128i A) { return _mm_shuffle_epi32(A, 0); }


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

x86 assembly (clang, -O2):
<test_mm_shuffle_epi32>:
xor    %esi,%esi
jmp    1030 <_mm_shuffle_epi32@plt>

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

LLVM IR (-O2):
define i32 @test_mm_shuffle_epi32(i32 %0) {
%2 = tail call i32 @_mm_shuffle_epi32(i32 %0, i32 0)
ret i32 %2
}
void Lower_Read(char *s) {
  static char letter[4] = {'a', 'c', 'g', 't'};
  for (; *s != 4; s++)
    *s = letter[(int)*s];
  *s = '\0';
}


x86 assembly (clang, -O0):
<Lower_Read>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x4,%eax
je     1143 <Lower_Read+0x43>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movslq %eax,%rcx
lea    0x2ef7(%rip),%rax
mov    (%rax,%rcx,1),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <Lower_Read+0x8>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lower_Read>:
mov    (%rdi),%al
cmp    $0x4,%al
je     1126 <Lower_Read+0x26>
lea    0xef3(%rip),%rcx
nopl   (%rax)
movsbq %al,%rax
movzbl (%rax,%rcx,1),%eax
mov    %al,(%rdi)
movzbl 0x1(%rdi),%eax
add    $0x1,%rdi
cmp    $0x4,%al
jne    1110 <Lower_Read+0x10>
movb   $0x0,(%rdi)
ret

LLVM IR (-O0):
@Lower_Read.letter = internal global [4 x i8] c"acgt"
define void @Lower_Read(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %16, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 4
br i1 %7, label %8, label %19
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [4 x i8], [4 x i8]* @Lower_Read.letter, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = load i8*, i8** %2
store i8 %14, i8* %15
br label %16
16: ; preds = %8
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
br label %3
19: ; preds = %3
%20 = load i8*, i8** %2
store i8 0, i8* %20
ret void
}

LLVM IR (-O2):
@Lower_Read.letter = internal unnamed_addr constant [4 x i8] c"acgt"
define void @Lower_Read(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 4
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i8* [ %10, %4 ], [ %0, %1 ]
%7 = sext i8 %5 to i64
%8 = getelementptr inbounds [4 x i8], [4 x i8]* @Lower_Read.letter, i64 0, i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* %6
%10 = getelementptr inbounds i8, i8* %6, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 4
br i1 %12, label %13, label %4
13: ; preds = %4, %1
%14 = phi i8* [ %0, %1 ], [ %10, %4 ]
store i8 0, i8* %14
ret void
}
/* Variables and functions */
scalar_t__ array_begin(void *);
scalar_t__ array_end(void *);
int array_empty(void *A) { return (array_begin(A) == array_end(A)); }


x86 assembly (clang, -O0):
<array_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <array_begin@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <array_end@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_empty>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <array_begin@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <array_end@plt>
xor    %ecx,%ecx
cmp    %rax,%r14
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @array_empty(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @array_begin(i8* %3)
%5 = load i8*, i8** %2
%6 = call i64 @array_end(i8* %5)
%7 = icmp eq i64 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @array_empty(i8* %0) {
%2 = tail call i64 @array_begin(i8* %0)
%3 = tail call i64 @array_end(i8* %0)
%4 = icmp eq i64 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int comp(const void *base, size_t nmemb, size_t size,
         int (*compare)(const void *a, const void *b, void *context),
         void *context, const void *key, size_t b) {
  void *bp;
  (void)nmemb;
  bp = ((char *)base) + (b * size);
  return compare(key, bp, context);
}


x86 assembly (clang, -O0):
<comp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rbp),%rcx
imul   -0x18(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   *%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comp>:
imul   0x8(%rsp),%rdx
lea    (%rdx,%rdi,1),%rsi
mov    %r9,%rdi
mov    %r8,%rdx
jmp    *%rcx

LLVM IR (-O0):
define i32 @comp(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*, i8*)* %3, i8* %4, i8* %5, i64 %6) {
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32 (i8*, i8*, i8*)*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i8*
store i8* %0, i8** %8
store i64 %1, i64* %9
store i64 %2, i64* %10
store i32 (i8*, i8*, i8*)* %3, i32 (i8*, i8*, i8*)** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i64 %6, i64* %14
%16 = load i64, i64* %9
%17 = load i8*, i8** %8
%18 = load i64, i64* %14
%19 = load i64, i64* %10
%20 = mul i64 %18, %19
%21 = getelementptr inbounds i8, i8* %17, i64 %20
store i8* %21, i8** %15
%22 = load i32 (i8*, i8*, i8*)*, i32 (i8*, i8*, i8*)** %11
%23 = load i8*, i8** %13
%24 = load i8*, i8** %15
%25 = load i8*, i8** %12
%26 = call i32 %22(i8* %23, i8* %24, i8* %25)
ret i32 %26
}

LLVM IR (-O2):
define i32 @comp(i8* %0, i64 %1, i64 %2, i32 (i8*, i8*, i8*)* nocapture %3, i8* %4, i8* %5, i64 %6) {
%8 = mul i64 %6, %2
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = tail call i32 %3(i8* %5, i8* %9, i8* %4)
ret i32 %10
}
/* Variables and functions */
scalar_t__ ascii_isupper(int);
int ascii_tolower(int c) {
  if (ascii_isupper(c))
    return c | 32;
  return c;
}


x86 assembly (clang, -O0):
<ascii_tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <ascii_isupper@plt>
cmp    $0x0,%rax
je     113b <ascii_tolower+0x2b>
mov    -0x8(%rbp),%eax
or     $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <ascii_tolower+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascii_tolower>:
push   %rbx
mov    %edi,%ebx
call   1030 <ascii_isupper@plt>
mov    %ebx,%ecx
or     $0x20,%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ascii_tolower(i32 %0) {
%2 = tail call i64 @ascii_isupper(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = or i32 %0, 32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}