xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void write_u32_be(unsigned char *buf, uint32_t n) {
  buf[0] = n >> 24 & 0xff;
  buf[1] = n >> 16 & 0xff;
  buf[2] = n >> 8 & 0xff;
  buf[3] = n & 0xff;
}


x86 assembly (clang, -O0):
<write_u32_be>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_u32_be>:
bswap  %esi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @write_u32_be(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 = ashr i32 %5, 24
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %4
%12 = ashr i32 %11, 16
%13 = and i32 %12, 255
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
%17 = load i32, i32* %4
%18 = ashr i32 %17, 8
%19 = and i32 %18, 255
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %3
%22 = getelementptr inbounds i8, i8* %21, i64 2
store i8 %20, i8* %22
%23 = load i32, i32* %4
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 3
store i8 %25, i8* %27
ret void
}

LLVM IR (-O2):
define void @write_u32_be(i8* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = trunc i32 %3 to i8
store i8 %4, i8* %0
%5 = lshr i32 %1, 16
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %6, i8* %7
%8 = lshr i32 %1, 8
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %9, i8* %10
%11 = trunc i32 %1 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
/* Variables and functions */
int getch();
int /*<<< orphan*/ mvprintw(int, int, char *);
int key() {
  mvprintw(22, 24, "              KEY               ");
  return getch();
}


x86 assembly (clang, -O0):
<key>:
push   %rbp
mov    %rsp,%rbp
mov    $0x16,%edi
mov    $0x18,%esi
lea    0xecb(%rip),%rdx
call   1040 <mvprintw@plt>
mov    $0x0,%al
call   1030 <getch@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<key>:
push   %rax
lea    0xed8(%rip),%rdx
mov    $0x16,%edi
mov    $0x18,%esi
call   1040 <mvprintw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <getch@plt>

LLVM IR (-O0):
@.str = [33 x i8] c" KEY \00"
define i32 @key() {
%1 = call i32 @mvprintw(i32 22, i32 24, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @getch()
ret i32 %2
}

LLVM IR (-O2):
@.str = [33 x i8] c" KEY \00"
define i32 @key() {
%1 = tail call i32 @mvprintw(i32 22, i32 24, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @getch()
ret i32 %2
}
void foo() {
  __asm__ volatile("/* "
                   "pickANumber"
                   ": %c0 */" ::"i"(0xC0C0A));
  __asm__ volatile("/* "
                   "pickANumber2 "
                   ": %0 */" ::"i"(123));
}


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

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

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

LLVM IR (-O2):
define void @foo() {
tail call void asm sideeffect "/* pickANumber: ${0:c} */", "i,~{dirflag},~{fpsr},~{flags}"(i32 789514)
tail call void asm sideeffect "/* pickANumber2 : $0 */", "i,~{dirflag},~{fpsr},~{flags}"(i32 123)
ret void
}
/* Variables and functions */
int string_not_equal_display_error(void const *, void *);
int check_not_string(const void *value, void *check_value_data) {
  return string_not_equal_display_error(value, check_value_data);
}


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

x86 assembly (clang, -O2):
<check_not_string>:
jmp    1030 <string_not_equal_display_error@plt>

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

LLVM IR (-O2):
define i32 @check_not_string(i8* %0, i8* %1) {
%3 = tail call i32 @string_not_equal_display_error(i8* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ safe_exit(int);
int /*<<< orphan*/ stderr;
void *safe_release_malloc(size_t size) {
  void *ptr = malloc(size);
  if (!ptr) {
    fprintf(stderr, "Could not allocate memory! Out of memory?");
    safe_exit(2);
    return NULL;
  }
  return ptr;
}


x86 assembly (clang, -O0):
<safe_release_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1180 <safe_release_malloc+0x50>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <safe_exit@plt>
movq   $0x0,-0x8(%rbp)
jmp    1188 <safe_release_malloc+0x58>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_release_malloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115d <safe_release_malloc+0x2d>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1050 <safe_exit@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"Could not allocate memory! Out of memory?\00"
define i8* @safe_release_malloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %13, label %9
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @safe_exit(i32 2)
store i8* null, i8** %2
br label %15
13: ; preds = %1
%14 = load i8*, i8** %4
store i8* %14, i8** %2
br label %15
15: ; preds = %13, %9
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"Could not allocate memory! Out of memory?\00"
define noalias i8* @safe_release_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @safe_exit(i32 2)
br label %8
8: ; preds = %1, %4
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ foo(int, void *);
int main(int argc, char **args) {
  foo(argc, (void *)args);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = bitcast i8** %1 to i8*
%4 = tail call i32 @foo(i32 %0, i8* %3)
ret i32 0
}
const char *str_stmt_case_range() { return "case-range"; }


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

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

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

LLVM IR (-O2):
@.str = [11 x i8] c"case-range\00"
define i8* @str_stmt_case_range() {
ret i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
char *hdate_string(int, int const, int const, int /*<<< orphan*/);
char *hdate_get_parasha_string(int const parasha, int const short_form) {
  return hdate_string(2, parasha, short_form, 0);
}


x86 assembly (clang, -O0):
<hdate_get_parasha_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    $0x2,%edi
xor    %ecx,%ecx
call   1030 <hdate_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdate_get_parasha_string>:
mov    %esi,%edx
mov    %edi,%esi
mov    $0x2,%edi
xor    %ecx,%ecx
jmp    1030 <hdate_string@plt>

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

LLVM IR (-O2):
define i8* @hdate_get_parasha_string(i32 %0, i32 %1) {
%3 = tail call i8* @hdate_string(i32 2, i32 %0, i32 %1, i32 0)
ret i8* %3
}
/* Variables and functions */
char *lace_compat_string_duplicate(char const *);
char *lace_strdup(const char *s) { return lace_compat_string_duplicate(s); }


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

x86 assembly (clang, -O2):
<lace_strdup>:
jmp    1030 <lace_compat_string_duplicate@plt>

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

LLVM IR (-O2):
define i8* @lace_strdup(i8* %0) {
%2 = tail call i8* @lace_compat_string_duplicate(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ cm_swap_content__swap_char_arrays__are_swapped();
void cm_generic_run_tests(void) {
  cm_swap_content__swap_char_arrays__are_swapped();
}


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

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

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

LLVM IR (-O2):
define void @cm_generic_run_tests() {
%1 = tail call i32 (...) @cm_swap_content__swap_char_arrays__are_swapped()
ret void
}
/* Type definitions */
struct unittype {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cancelunit(struct unittype *);
scalar_t__ reduceunit(struct unittype *);
int /*<<< orphan*/ sortunit(struct unittype *);
int completereduce(struct unittype *unit) {
  if (reduceunit(unit))
    return 1;
  sortunit(unit);
  cancelunit(unit);
  return 0;
}


x86 assembly (clang, -O0):
<completereduce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <reduceunit@plt>
cmp    $0x0,%rax
je     115b <completereduce+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    1174 <completereduce+0x44>
mov    -0x10(%rbp),%rdi
call   1050 <sortunit@plt>
mov    -0x10(%rbp),%rdi
call   1030 <cancelunit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<completereduce>:
push   %rbx
mov    %rdi,%rbx
call   1040 <reduceunit@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1148 <completereduce+0x18>
pop    %rbx
ret
mov    %rbx,%rdi
call   1050 <sortunit@plt>
mov    %rbx,%rdi
call   1030 <cancelunit@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.unittype = type { i32 }
define i32 @completereduce(%struct.unittype* %0) {
%2 = alloca i32
%3 = alloca %struct.unittype*
store %struct.unittype* %0, %struct.unittype** %3
%4 = load %struct.unittype*, %struct.unittype** %3
%5 = call i64 @reduceunit(%struct.unittype* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %13
8: ; preds = %1
%9 = load %struct.unittype*, %struct.unittype** %3
%10 = call i32 @sortunit(%struct.unittype* %9)
%11 = load %struct.unittype*, %struct.unittype** %3
%12 = call i32 @cancelunit(%struct.unittype* %11)
store i32 0, i32* %2
br label %13
13: ; preds = %8, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.unittype = type { i32 }
define i32 @completereduce(%struct.unittype* %0) {
%2 = tail call i64 @reduceunit(%struct.unittype* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @sortunit(%struct.unittype* %0)
%6 = tail call i32 @cancelunit(%struct.unittype* %0)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ 0, %4 ], [ 1, %1 ]
ret i32 %8
}
void RTLogGetGroupSettings(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLogGetGroupSettings() {
ret void
}
void mmput(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<mmput>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mmput>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.mmput = [6 x i8] c"mmput\00"
define void @mmput() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.mmput, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.mmput = [6 x i8] c"mmput\00"
define void @mmput() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @__func__.mmput, i64 0, i64 0))
ret void
}
/* Variables and functions */
int foo(int);
int main(void) { return foo(18); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0x12,%edi
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 18)
ret i32 %1
}
void WDTimerWindowValueSet(unsigned long ulConfig) {
  ;
  (*((volatile unsigned long *)(0x40002C04))) &= ~0x0000007F;
  (*((volatile unsigned long *)(0x40002C04))) |= ulConfig;
}


x86 assembly (clang, -O0):
<WDTimerWindowValueSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x40002c04,%eax
mov    (%rax),%rcx
and    $0xffffffffffffff80,%rcx
mov    $0x40002c04,%eax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    $0x40002c04,%ecx
mov    (%rcx),%rcx
or     %rax,%rcx
mov    $0x40002c04,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<WDTimerWindowValueSet>:
andq   $0xffffffffffffff80,0x40002c04
40 80
or     %rdi,0x40002c04
40
ret

LLVM IR (-O0):
define void @WDTimerWindowValueSet(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load volatile i64, i64* inttoptr (i64 1073753092 to i64*)
%4 = and i64 %3, -128
store volatile i64 %4, i64* inttoptr (i64 1073753092 to i64*)
%5 = load i64, i64* %2
%6 = load volatile i64, i64* inttoptr (i64 1073753092 to i64*)
%7 = or i64 %6, %5
store volatile i64 %7, i64* inttoptr (i64 1073753092 to i64*)
ret void
}

LLVM IR (-O2):
define void @WDTimerWindowValueSet(i64 %0) {
%2 = load volatile i64, i64* inttoptr (i64 1073753092 to i64*)
%3 = and i64 %2, -128
store volatile i64 %3, i64* inttoptr (i64 1073753092 to i64*)
%4 = load volatile i64, i64* inttoptr (i64 1073753092 to i64*)
%5 = or i64 %4, %0
store volatile i64 %5, i64* inttoptr (i64 1073753092 to i64*)
ret void
}
void locale_init(void) {}


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

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

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

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

/* Variables and functions */
uint32_t peek32(const uint32_t *address) { return (*address); }


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

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

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

LLVM IR (-O2):
define i32 @peek32(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t hdsafe(uint32_t addr) { return addr & 0x1000000 - 1; }


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

x86 assembly (clang, -O2):
<hdsafe>:
mov    %edi,%eax
and    $0xffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @hdsafe(i32 %0) {
%2 = and i32 %0, 16777215
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void badusage(void) {
  fprintf(stderr,
          "Usage: fsagrowth [-ip d/s] [-v] [-primes x,y...] [filename]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<badusage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<badusage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [61 x i8] c"Usage: fsagrowth [-ip d/s] [-v] [-primes x,y...] [filename]\0A\00"
define void @badusage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [61 x i8] c"Usage: fsagrowth [-ip d/s] [-v] [-primes x,y...] [filename]\0A\00"
define void @badusage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef char int16_t;

/* Variables and functions */
int16_t get16bits(const char *d) { return ((char)d[0] << 8) + (char)d[1]; }


x86 assembly (clang, -O0):
<get16bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
add    %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get16bits>:
mov    0x1(%rdi),%al
ret

LLVM IR (-O0):
define signext i8 @get16bits(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = shl i32 %6, 8
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = add nsw i32 %7, %11
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
define signext i8 @get16bits(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %2
ret i8 %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ _UARTBaseValid(int);
void UARTEnable(uint32_t ui32Base) {
  ASSERT(_UARTBaseValid(ui32Base));
  (*((volatile uint32_t *)(ui32Base + 0x0000002C))) |= 0x00000010;
  (*((volatile uint32_t *)(ui32Base + 0x00000030))) |=
      (0x00000001 | 0x00000100 | 0x00000200);
}


x86 assembly (clang, -O0):
<UARTEnable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_UARTBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x2c,%eax
cltq
mov    (%rax),%ecx
or     $0x10,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x30,%eax
cltq
mov    (%rax),%ecx
or     $0x301,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTEnable>:
push   %rbx
mov    %edi,%ebx
call   1030 <_UARTBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
movslq %ebx,%rax
orl    $0x10,0x2c(%rax)
orl    $0x301,0x30(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @UARTEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_UARTBaseValid(i32 %3)
%5 = call i32 @ASSERT(i32 %4)
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 44
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
%11 = or i32 %10, 16
store volatile i32 %11, i32* %9
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 48
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i32*
%16 = load volatile i32, i32* %15
%17 = or i32 %16, 769
store volatile i32 %17, i32* %15
ret void
}

LLVM IR (-O2):
define void @UARTEnable(i32 %0) {
%2 = tail call i32 @_UARTBaseValid(i32 %0)
%3 = tail call i32 @ASSERT(i32 %2)
%4 = add nsw i32 %0, 44
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = or i32 %7, 16
store volatile i32 %8, i32* %6
%9 = add nsw i32 %0, 48
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = or i32 %12, 769
store volatile i32 %13, i32* %11
ret void
}
/* Variables and functions */
double g();
f() {
  char dummy[399999];
  double f1, f2, f3;
  f1 = g();
  f2 = g();
  f3 = g();
  return f1 + f2 + f3;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61aa0,%rsp
mov    $0x0,%al
call   1030 <g@plt>
movsd  %xmm0,-0x61a88(%rbp)
ff
mov    $0x0,%al
call   1030 <g@plt>
movsd  %xmm0,-0x61a90(%rbp)
ff
mov    $0x0,%al
call   1030 <g@plt>
movsd  %xmm0,-0x61a98(%rbp)
ff
movsd  -0x61a88(%rbp),%xmm0
ff
addsd  -0x61a90(%rbp),%xmm0
ff
addsd  -0x61a98(%rbp),%xmm0
ff
cvttsd2si %xmm0,%eax
add    $0x61aa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1030 <g@plt>
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <g@plt>
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <g@plt>
movsd  0x8(%rsp),%xmm1
addsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @f() {
%1 = alloca [399999 x i8]
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = call double (...) @g()
store double %5, double* %2
%6 = call double (...) @g()
store double %6, double* %3
%7 = call double (...) @g()
store double %7, double* %4
%8 = load double, double* %2
%9 = load double, double* %3
%10 = fadd double %8, %9
%11 = load double, double* %4
%12 = fadd double %10, %11
%13 = fptosi double %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @f() {
%1 = tail call double (...) @g()
%2 = tail call double (...) @g()
%3 = tail call double (...) @g()
%4 = fadd double %1, %2
%5 = fadd double %4, %3
%6 = fptosi double %5 to i32
ret i32 %6
}
signed long d_getsl(const unsigned char *ptr) {
  return (((signed long)ptr[0] << 24) | ((unsigned long)ptr[1] << 16) |
          ((unsigned long)ptr[2] << 8) | ((unsigned long)ptr[3] << 0));
}


x86 assembly (clang, -O0):
<d_getsl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%rax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%rcx
or     %rcx,%rax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
shl    $0x0,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_getsl>:
mov    (%rdi),%eax
shl    $0x20,%rax
bswap  %rax
ret

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

LLVM IR (-O2):
define i64 @d_getsl(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i64
%4 = shl nuw nsw i64 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = shl nuw nsw i64 %7, 16
%9 = or i64 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i64
%13 = shl nuw nsw i64 %12, 8
%14 = or i64 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i64
%18 = or i64 %14, %17
ret i64 %18
}
/* Variables and functions */
int n_names(char *);
char **new_argv(int, char *);
char *std_input();
void get_new_args(int *argcp, const char **argvp[]) {
  char *args = std_input();
  int argc = n_names(args);
  const char **argv = new_argv(argc, args);
  *argcp = argc, *argvp = argv;
}


x86 assembly (clang, -O0):
<get_new_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <std_input@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <n_names@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <new_argv@plt>
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_new_args>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
xor    %eax,%eax
call   1030 <std_input@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <n_names@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <new_argv@plt>
mov    %ebp,(%r15)
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @get_new_args(i32* %0, i8*** %1) {
%3 = alloca i32*
%4 = alloca i8***
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
store i32* %0, i32** %3
store i8*** %1, i8**** %4
%8 = call i8* (...) @std_input()
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = call i32 @n_names(i8* %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = load i8*, i8** %5
%13 = call i8** @new_argv(i32 %11, i8* %12)
store i8** %13, i8*** %7
%14 = load i32, i32* %6
%15 = load i32*, i32** %3
store i32 %14, i32* %15
%16 = load i8**, i8*** %7
%17 = load i8***, i8**** %4
store i8** %16, i8*** %17
ret void
}

LLVM IR (-O2):
define void @get_new_args(i32* nocapture writeonly %0, i8*** nocapture writeonly %1) {
%3 = tail call i8* (...) @std_input()
%4 = tail call i32 @n_names(i8* %3)
%5 = tail call i8** @new_argv(i32 %4, i8* %3)
store i32 %4, i32* %0
store i8** %5, i8*** %1
ret void
}
int stringCharPredicate(char c) { return c != '"' && c != '\n'; }


x86 assembly (clang, -O0):
<stringCharPredicate>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x22,%ecx
mov    %al,-0x2(%rbp)
je     1129 <stringCharPredicate+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringCharPredicate>:
cmp    $0x22,%dil
setne  %al
cmp    $0xa,%dil
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @stringCharPredicate(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 34
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 10
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @stringCharPredicate(i8 signext %0) {
%2 = icmp ne i8 %0, 34
%3 = icmp ne i8 %0, 10
%4 = and i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
int test_imm_01uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x01 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_01uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 65536
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ perror(char *);
void _alloc_failed() {
  perror("allocation failed");
  abort();
}


x86 assembly (clang, -O0):
<_alloc_failed>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <perror@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<_alloc_failed>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"allocation failed\00"
define void @_alloc_failed() {
%1 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [18 x i8] c"allocation failed\00"
define void @_alloc_failed() {
%1 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @abort()
unreachable
}
void my_sigusr2_handler(int signal) {
  printf("%s : signal = %d\n", __func__, signal);
}


x86 assembly (clang, -O0):
<my_sigusr2_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xedb(%rip),%rdi
lea    0xee6(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_sigusr2_handler>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xef2(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%s : signal = %d\0A\00"
@__func__.my_sigusr2_handler = [19 x i8] c"my_sigusr2_handler\00"
define void @my_sigusr2_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.my_sigusr2_handler, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s : signal = %d\0A\00"
@__func__.my_sigusr2_handler = [19 x i8] c"my_sigusr2_handler\00"
define void @my_sigusr2_handler(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @__func__.my_sigusr2_handler, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fail_test(int);
int sys_exec(char **);
char sys_wait(int);
void proc_check(char *env[], char exit_code) {
  int pid = sys_exec(env);
  char ret = sys_wait(pid);
  if (ret != exit_code)
    fail_test(43);
  ;
}


x86 assembly (clang, -O0):
<proc_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sys_exec@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <sys_wait@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
je     1173 <proc_check+0x43>
mov    $0x2b,%edi
call   1030 <fail_test@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc_check>:
push   %rbx
mov    %esi,%ebx
call   1040 <sys_exec@plt>
mov    %eax,%edi
call   1050 <sys_wait@plt>
cmp    %bl,%al
jne    1145 <proc_check+0x15>
pop    %rbx
ret
mov    $0x2b,%edi
pop    %rbx
jmp    1030 <fail_test@plt>

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

LLVM IR (-O2):
define void @proc_check(i8** %0, i8 signext %1) {
%3 = tail call i32 @sys_exec(i8** %0)
%4 = tail call signext i8 @sys_wait(i32 %3)
%5 = icmp eq i8 %4, %1
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @fail_test(i32 43)
br label %8
8: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ printArr(int *, int);
int /*<<< orphan*/ qsort(int *, int);
int main() {
  int arr[] = {6, 5, 1, 4, 3, 9, 7, 0, 2, 8};
  qsort(arr, sizeof(arr) / sizeof(int));
  printArr(arr, sizeof(arr) / sizeof(int));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1030 <qsort@plt>
lea    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1050 <printArr@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <qsort@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <printArr@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.arr = [10 x i32] [i32 6, i32 5, i32 1, i32 4, i32 3, i32 9, i32 7, i32 0, i32 2, i32 8]
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
store i32 0, i32* %1
%3 = bitcast [10 x i32]* %2 to i8*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%5 = call i32 @qsort(i32* %4, i32 10)
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%7 = call i32 @printArr(i32* %6, i32 10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [10 x i32] [i32 6, i32 5, i32 1, i32 4, i32 3, i32 9, i32 7, i32 0, i32 2, i32 8]
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @qsort(i32* %3, i32 10)
%5 = call i32 @printArr(i32* %3, i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("usage: sdbd [-df] port\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"usage: sdbd [-df] port\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [23 x i8] c"usage: sdbd [-df] port\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int uint64_t;
struct random_src {
  int dummy;
};

/* Variables and functions */
int random_u32(struct random_src *);
uint64_t random_u64(struct random_src *rnd) {
  uint64_t val = random_u32(rnd);
  val <<= 32;
  return val | random_u32(rnd);
}


x86 assembly (clang, -O0):
<random_u64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <random_u32@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <random_u32@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_u64>:
push   %rbx
mov    %rdi,%rbx
call   1030 <random_u32@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <random_u32@plt>

LLVM IR (-O0):
%struct.random_src = type { i32 }
define i32 @random_u64(%struct.random_src* %0) {
%2 = alloca %struct.random_src*
%3 = alloca i32
store %struct.random_src* %0, %struct.random_src** %2
%4 = load %struct.random_src*, %struct.random_src** %2
%5 = call i32 @random_u32(%struct.random_src* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = shl i32 %6, 32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = load %struct.random_src*, %struct.random_src** %2
%10 = call i32 @random_u32(%struct.random_src* %9)
%11 = or i32 %8, %10
ret i32 %11
}

LLVM IR (-O2):
%struct.random_src = type { i32 }
define i32 @random_u64(%struct.random_src* %0) {
%2 = tail call i32 @random_u32(%struct.random_src* %0)
%3 = tail call i32 @random_u32(%struct.random_src* %0)
ret i32 poison
}
/* Variables and functions */
void set_next_free_block(void *ptr, void *next_ptr) {
  char *p = ptr;
  void **next_block_info;
  p += (sizeof(size_t)) + (sizeof(void *));
  next_block_info = (void **)p;
  *next_block_info = next_ptr;
}


x86 assembly (clang, -O0):
<set_next_free_block>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_next_free_block>:
mov    %rsi,0x10(%rdi)
ret

LLVM IR (-O0):
define void @set_next_free_block(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8**
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i64 16
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to i8**
store i8** %11, i8*** %6
%12 = load i8*, i8** %4
%13 = load i8**, i8*** %6
store i8* %12, i8** %13
ret void
}

LLVM IR (-O2):
define void @set_next_free_block(i8* nocapture writeonly %0, i8* %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 16
%4 = bitcast i8* %3 to i8**
store i8* %1, i8** %4
ret void
}
/* Variables and functions */
scalar_t__ RandomInteger();
float RandomFloat() { return (float)RandomInteger() / 4294967296.0f; }


x86 assembly (clang, -O0):
<RandomFloat>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <RandomInteger@plt>
cvtsi2ss %rax,%xmm0
movss  0xed8(%rip),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFloat>:
push   %rax
xor    %eax,%eax
call   1030 <RandomInteger@plt>
cvtsi2ss %rax,%xmm0
mulss  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @RandomFloat() {
%1 = call i64 (...) @RandomInteger()
%2 = sitofp i64 %1 to float
%3 = fdiv float %2, 0x41F0000000000000
ret float %3
}

LLVM IR (-O2):
define float @RandomFloat() {
%1 = tail call i64 (...) @RandomInteger()
%2 = sitofp i64 %1 to float
%3 = fmul float %2, 0x3DF0000000000000
ret float %3
}
void glBindBuffer(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glBindBuffer() {
ret void
}
void test_func(int i, int j) {
  volatile int q;
  q = i + j;
}


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

x86 assembly (clang, -O2):
<test_func>:
add    %esi,%edi
mov    %edi,-0x4(%rsp)
ret

LLVM IR (-O0):
define void @test_func(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
store volatile i32 %8, i32* %5
ret void
}

LLVM IR (-O2):
define void @test_func(i32 %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = add nsw i32 %1, %0
store volatile i32 %5, i32* %3
ret void
}
int error_square_with_unit_2(int __attribute((unit("m"))) x) { return x * x; }


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

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

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

LLVM IR (-O2):
define i32 @error_square_with_unit_2(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_ERROR;
int getsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, int *, int *);
int socket_check(int fd) {
  int ret;
  int code;
  int len = sizeof(int);
  ret = getsockopt(fd, SOL_SOCKET, SO_ERROR, &code, &len);
  if ((ret || code) != 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<socket_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ebc(%rip),%rax
mov    (%rax),%esi
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <getsockopt@plt>
mov    %eax,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x15(%rbp)
jne    1160 <socket_check+0x50>
cmpl   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
je     117d <socket_check+0x6d>
movl   $0x1,-0x4(%rbp)
jmp    1184 <socket_check+0x74>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<socket_check>:
push   %rax
movl   $0x4,(%rsp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
call   1030 <getsockopt@plt>
xor    %ecx,%ecx
or     0x4(%rsp),%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
@SO_ERROR = global i32 0
define i32 @socket_check(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = load i32, i32* @SOL_SOCKET
%7 = load i32, i32* @SO_ERROR
%8 = call i32 @getsockopt(i32 %0, i32 %6, i32 %7, i32* %2, i32* %3)
%9 = icmp ne i32 %8, 0
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
%12 = select i1 %9, i1 true, i1 %11
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ REG_UART_BASE(scalar_t__);
__attribute__((always_)) __attribute__((flatten)) uint32_t
UART_LOWPULSE(uint32_t i) {
  return (REG_UART_BASE(i) + 0x28);
}


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

x86 assembly (clang, -O2):
<UART_LOWPULSE>:
push   %rax
call   1030 <REG_UART_BASE@plt>
add    $0x28,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @UART_LOWPULSE(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i64 @REG_UART_BASE(i64 %3)
%5 = add nsw i64 %4, 40
ret i64 %5
}

LLVM IR (-O2):
define i64 @UART_LOWPULSE(i64 %0) {
%2 = tail call i64 @REG_UART_BASE(i64 %0)
%3 = add nsw i64 %2, 40
ret i64 %3
}
/* Variables and functions */
short atan(short);
short internal_atan_s(short value) { return atan(value); }


x86 assembly (clang, -O0):
<internal_atan_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edi
call   1030 <atan@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_atan_s>:
jmp    1030 <atan@plt>

LLVM IR (-O0):
define signext i16 @internal_atan_s(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call signext i16 @atan(i16 signext %3)
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @internal_atan_s(i16 signext %0) {
%2 = tail call signext i16 @atan(i16 signext %0)
ret i16 %2
}
/* Variables and functions */
char *UTIL_appendStr(char *, char *);
char *OC_mkIsConstFuncName(char *name) { return UTIL_appendStr("is", name); }


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

x86 assembly (clang, -O2):
<OC_mkIsConstFuncName>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <UTIL_appendStr@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"is\00"
define i8* @OC_mkIsConstFuncName(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @UTIL_appendStr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i8* %4
}

LLVM IR (-O2):
@.str = [3 x i8] c"is\00"
define i8* @OC_mkIsConstFuncName(i8* %0) {
%2 = tail call i8* @UTIL_appendStr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* %2
}