xunge/DecIR huggingface dataset:
/* Variables and functions */
char *strstr(char *, char *);
char *strstr2(char *str, char *sub1, char *sub2) {
  char *t1, *t2;
  t1 = strstr(str, sub1);
  t2 = strstr(str, sub2);
  if (t2 < t1)
    return t2;
  return t1;
}


x86 assembly (clang, -O0):
<strstr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1161 <strstr2+0x51>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1169 <strstr2+0x59>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strstr2>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <strstr@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strstr@plt>
cmp    %r15,%rax
cmovae %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strstr2(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i8* @strstr(i8* %10, i8* %11)
store i8* %12, i8** %8
%13 = load i8*, i8** %5
%14 = load i8*, i8** %7
%15 = call i8* @strstr(i8* %13, i8* %14)
store i8* %15, i8** %9
%16 = load i8*, i8** %9
%17 = load i8*, i8** %8
%18 = icmp ult i8* %16, %17
br i1 %18, label %19, label %21
19: ; preds = %3
%20 = load i8*, i8** %9
store i8* %20, i8** %4
br label %23
21: ; preds = %3
%22 = load i8*, i8** %8
store i8* %22, i8** %4
br label %23
23: ; preds = %21, %19
%24 = load i8*, i8** %4
ret i8* %24
}

LLVM IR (-O2):
define i8* @strstr2(i8* %0, i8* nocapture %1, i8* nocapture %2) {
%4 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%5 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %2)
%6 = icmp ult i8* %5, %4
%7 = select i1 %6, i8* %5, i8* %4
ret i8* %7
}
/* Variables and functions */
int min(int, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int convertCopy(char *from, int fromLen, char *to, int toLen, int term) {
  int len = min(toLen - term, fromLen);
  strncpy(to, from, len);
  if (term)
    to[len] = '\0';
  return len;
}


x86 assembly (clang, -O0):
<convertCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
sub    -0x20(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <min@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncpy@plt>
cmpl   $0x0,-0x20(%rbp)
je     1171 <convertCopy+0x51>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertCopy>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%ebx
mov    %rdx,%r14
mov    %rdi,%r15
sub    %r8d,%ecx
mov    %ecx,%edi
call   1040 <min@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
test   %ebx,%ebx
je     1155 <convertCopy+0x35>
movslq %ebp,%rax
movb   $0x0,(%r14,%rax,1)
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @convertCopy(i8* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = sub nsw i32 %3, %4
%7 = tail call i32 @min(i32 %6, i32 %1)
%8 = tail call i32 @strncpy(i8* %2, i8* %0, i32 %7)
%9 = icmp eq i32 %4, 0
br i1 %9, label %13, label %10
10: ; preds = %5
%11 = sext i32 %7 to i64
%12 = getelementptr inbounds i8, i8* %2, i64 %11
store i8 0, i8* %12
br label %13
13: ; preds = %10, %5
ret i32 %7
}
/* Variables and functions */
int dcache_init_root(int);
int inode_init(void) { return dcache_init_root(2); }


x86 assembly (clang, -O0):
<inode_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <dcache_init_root@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<inode_init>:
mov    $0x2,%edi
jmp    1030 <dcache_init_root@plt>

LLVM IR (-O0):
define i32 @inode_init() {
%1 = call i32 @dcache_init_root(i32 2)
ret i32 %1
}

LLVM IR (-O2):
define i32 @inode_init() {
%1 = tail call i32 @dcache_init_root(i32 2)
ret i32 %1
}
int _test_system_exclusive(void *buffer) {
  return ((unsigned char *)buffer)[0] == 0xf0;
}


x86 assembly (clang, -O0):
<_test_system_exclusive>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xf0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_test_system_exclusive>:
xor    %eax,%eax
cmpb   $0xf0,(%rdi)
sete   %al
ret

LLVM IR (-O0):
define i32 @_test_system_exclusive(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 i32
%7 = icmp eq i32 %6, 240
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @_test_system_exclusive(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, -16
%4 = zext i1 %3 to i32
ret i32 %4
}
void TLSv1_server_method(void) {}


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

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

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

LLVM IR (-O2):
define void @TLSv1_server_method() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int evaluate_postfix(char *);
void test_addition() { assert(evaluate_postfix("2 3 +") == 5); }


x86 assembly (clang, -O0):
<test_addition>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <evaluate_postfix@plt>
cmp    $0x5,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_addition>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <evaluate_postfix@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"2 3 +\00"
define void @test_addition() {
%1 = call i32 @evaluate_postfix(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 5
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"2 3 +\00"
define void @test_addition() {
%1 = tail call i32 @evaluate_postfix(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 5
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _fail(char const *const, int const);
int /*<<< orphan*/ integer_not_in_range_display_error(unsigned long long const,
                                                      unsigned long long const,
                                                      unsigned long long const);
void _assert_not_in_range(const unsigned long long value,
                          const unsigned long long minimum,
                          const unsigned long long maximum,
                          const char *const file, const int line) {
  if (!integer_not_in_range_display_error(value, minimum, maximum)) {
    _fail(file, line);
  }
}


x86 assembly (clang, -O0):
<_assert_not_in_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <integer_not_in_range_display_error@plt>
cmp    $0x0,%eax
jne    1162 <_assert_not_in_range+0x42>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <_fail@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_assert_not_in_range>:
push   %rbp
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    %rcx,%rbx
call   1030 <integer_not_in_range_display_error@plt>
test   %eax,%eax
je     1139 <_assert_not_in_range+0x19>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <_fail@plt>

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

LLVM IR (-O2):
define void @_assert_not_in_range(i64 %0, i64 %1, i64 %2, i8* %3, i32 %4) {
%6 = tail call i32 @integer_not_in_range_display_error(i64 %0, i64 %1, i64 %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @_fail(i8* %3, i32 %4)
br label %10
10: ; preds = %8, %5
ret void
}
void gtk_tree_selection_iter_is_selected() {}


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

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

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

LLVM IR (-O2):
define void @gtk_tree_selection_iter_is_selected() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned int *, char *, int);
void deserialize_uint(char **f, unsigned *n) {
  memcpy(n, *f, sizeof(unsigned));
  *f += sizeof(unsigned);
}


x86 assembly (clang, -O0):
<deserialize_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deserialize_uint>:
push   %rbx
mov    %rsi,%rax
mov    %rdi,%rbx
mov    (%rdi),%rsi
mov    %rax,%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
addq   $0x4,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @deserialize_uint(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 = load i8**, i8*** %3
%7 = load i8*, i8** %6
%8 = call i32 @memcpy(i32* %5, i8* %7, i32 4)
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8, i8* %10, i64 4
store i8* %11, i8** %9
ret void
}

LLVM IR (-O2):
define void @deserialize_uint(i8** nocapture %0, i32* %1) {
%3 = load i8*, i8** %0
%4 = tail call i32 @memcpy(i32* %1, i8* %3, i32 4)
%5 = load i8*, i8** %0
%6 = getelementptr inbounds i8, i8* %5, i64 4
store i8* %6, i8** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ C67_asm(char *, int, int, int);
void C67_ADDSP(int r, int v) { C67_asm("ADDSP.L", v, r, v); }


x86 assembly (clang, -O0):
<C67_ADDSP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xed2(%rip),%rdi
call   1030 <C67_asm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C67_ADDSP>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
mov    %esi,%ecx
jmp    1030 <C67_asm@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"ADDSP.L\00"
define void @C67_ADDSP(i32 %0, i32 %1) {
%3 = tail call i32 @C67_asm(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ process_header(void *, void *);
int process_method_teardown(void *p_req, void *p_res) {
  process_header(p_req, p_res);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @process_method_teardown(i8* %0, i8* %1) {
%3 = tail call i32 @process_header(i8* %0, i8* %1)
ret i32 0
}
int n_th_even_recur(int n) {
  if (n == 0)
    return 0;
  else if (n == 1)
    return 2;
  return 2 + n_th_even_recur(n - 1);
}


x86 assembly (clang, -O0):
<n_th_even_recur>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <n_th_even_recur+0x21>
movl   $0x0,-0x4(%rbp)
jmp    115d <n_th_even_recur+0x4d>
cmpl   $0x1,-0x8(%rbp)
jne    1147 <n_th_even_recur+0x37>
movl   $0x2,-0x4(%rbp)
jmp    115d <n_th_even_recur+0x4d>
jmp    114c <n_th_even_recur+0x3c>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <n_th_even_recur@plt>
add    $0x2,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<n_th_even_recur>:
mov    %edi,%eax
xor    %ecx,%ecx
test   %eax,%eax
je     111f <n_th_even_recur+0x1f>
nopl   0x0(%rax,%rax,1)
cmp    $0x1,%eax
je     1122 <n_th_even_recur+0x22>
add    $0xffffffff,%eax
add    $0x2,%ecx
test   %eax,%eax
jne    1110 <n_th_even_recur+0x10>
add    %ecx,%eax
ret
mov    $0x2,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @n_th_even_recur(i32 %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i32 [ 0, %1 ], [ %7, %5 ]
%4 = phi i32 [ %0, %1 ], [ %6, %5 ]
switch i32 %4, label %5 [
i32 0, label %8
i32 1, label %9
]
5: ; preds = %2
%6 = add nsw i32 %4, -1
%7 = add nuw nsw i32 %3, 2
br label %2
8: ; preds = %2
br label %9
9: ; preds = %2, %8
%10 = phi i32 [ %4, %8 ], [ 2, %2 ]
%11 = add nuw nsw i32 %10, %3
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int, unsigned int);
int /*<<< orphan*/ scanf(char *, unsigned int *);
void main() {
  unsigned int a, b, c, d;
  scanf("%x", &a);
  b = a >> 4;
  c = ~(~0 << 4);
  d = b & c;
  printf("%x\n%x\n", a, d);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
mov    %eax,-0x8(%rbp)
movl   $0xf,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    %esi,%edx
shr    $0x4,%edx
and    $0xf,%edx
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
@.str.1 = [7 x i8] c"%x\0A%x\0A\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = lshr i32 %4, 4
%6 = and i32 %5, 15
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %6)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ stdscr;
int /*<<< orphan*/ vwprintw(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void nc_vprintf(const char *fmt, va_list l) { vwprintw(stdscr, fmt, l); }


x86 assembly (clang, -O0):
<nc_vprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <vwprintw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nc_vprintf>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ecc(%rip),%rax
mov    (%rax),%edi
jmp    1030 <vwprintw@plt>

LLVM IR (-O0):
@stdscr = global i32 0
define void @nc_vprintf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stdscr
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @vwprintw(i32 %5, i8* %6, i32 %7)
ret void
}

LLVM IR (-O2):
@stdscr = global i32 0
define void @nc_vprintf(i8* %0, i32 %1) {
%3 = load i32, i32* @stdscr
%4 = tail call i32 @vwprintw(i32 %3, i8* %0, i32 %1)
ret void
}
char *eat(char *s, int (*p)(int), int r) {
  while (s != '\0' && p(*s) == r)
    s++;
  return s;
}


x86 assembly (clang, -O0):
<eat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x15(%rbp)
je     1139 <eat+0x39>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%edi
call   *%rax
cmp    -0x14(%rbp),%eax
sete   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1149 <eat+0x49>
jmp    115a <eat+0x5a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <eat+0x13>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eat>:
push   %rbp
push   %r14
push   %rbx
test   %rdi,%rdi
je     1131 <eat+0x31>
mov    %edx,%r14d
mov    %rsi,%rbp
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   *%rbp
cmp    %r14d,%eax
je     1120 <eat+0x20>
jmp    1133 <eat+0x33>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @eat(i8* %0, i32 (i32)* nocapture %1, i32 %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %12, label %5
5: ; preds = %3, %5
%6 = phi i8* [ %11, %5 ], [ %0, %3 ]
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = tail call i32 %1(i32 %8)
%10 = icmp eq i32 %9, %2
%11 = getelementptr inbounds i8, i8* %6, i64 1
br i1 %10, label %5, label %12
12: ; preds = %5, %3
%13 = phi i8* [ null, %3 ], [ %6, %5 ]
ret i8* %13
}
/* Variables and functions */
int rand();
int random(int low, int high) {
  int diff, val;
  diff = high - low;
  if (diff == 0) {
    return low;
  }
  val = rand() % diff;
  return val + low;
}


x86 assembly (clang, -O0):
<random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    113c <random+0x2c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <random+0x43>
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
sub    %edi,%ebp
je     1127 <random+0x17>
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebp
add    %edx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = sub nsw i32 %8, %9
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = load i32, i32* %4
store i32 %14, i32* %3
br label %22
15: ; preds = %2
%16 = call i32 (...) @rand()
%17 = load i32, i32* %6
%18 = srem i32 %16, %17
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = load i32, i32* %4
%21 = add nsw i32 %19, %20
store i32 %21, i32* %3
br label %22
22: ; preds = %15, %13
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @random(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, %3
%8 = add nsw i32 %7, %0
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ %0, %2 ]
ret i32 %10
}
unsigned int isonum_723(unsigned char *addr) { return *(unsigned short *)addr; }


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

x86 assembly (clang, -O2):
<isonum_723>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @isonum_723(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i16*
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @isonum_723(i8* nocapture %0) {
%2 = bitcast i8* %0 to i16*
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
ret i32 %4
}
/* Variables and functions */
char **argsadd(char **, char *);
scalar_t__ exists(char **, char *);
char **argsuniq(char *argv[], char *item) {
  return exists(argv, item) ? argv : argsadd(argv, item);
}


x86 assembly (clang, -O0):
<argsuniq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <exists@plt>
cmp    $0x0,%rax
je     1154 <argsuniq+0x34>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1165 <argsuniq+0x45>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <argsadd@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<argsuniq>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <exists@plt>
test   %rax,%rax
je     113f <argsuniq+0x1f>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <argsadd@plt>

LLVM IR (-O0):
define i8** @argsuniq(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 i64 @exists(i8** %5, i8* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i8**, i8*** %3
br label %15
11: ; preds = %2
%12 = load i8**, i8*** %3
%13 = load i8*, i8** %4
%14 = call i8** @argsadd(i8** %12, i8* %13)
br label %15
15: ; preds = %11, %9
%16 = phi i8** [ %10, %9 ], [ %14, %11 ]
ret i8** %16
}

LLVM IR (-O2):
define i8** @argsuniq(i8** %0, i8* %1) {
%3 = tail call i64 @exists(i8** %0, i8* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i8** @argsadd(i8** %0, i8* %1)
br label %7
7: ; preds = %2, %5
%8 = phi i8** [ %6, %5 ], [ %0, %2 ]
ret i8** %8
}
int funcB() { return 3; }


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

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

LLVM IR (-O0):
define i32 @funcB() {
ret i32 3
}

LLVM IR (-O2):
define i32 @funcB() {
ret i32 3
}
/* Variables and functions */
int __get_array_length(char const *);
int /*<<< orphan*/ __require_allocated_array(char const *);
scalar_t__ malloc(int);
char *strdup(const char *s) {
  int size;
  __require_allocated_array(s);
  size = __get_array_length(s);
  return (char *)malloc(size);
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <__require_allocated_array@plt>
mov    -0x8(%rbp),%rdi
call   1050 <__get_array_length@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %rbx
mov    %rdi,%rbx
call   1030 <__require_allocated_array@plt>
mov    %rbx,%rdi
call   1050 <__get_array_length@plt>
mov    %eax,%edi
pop    %rbx
jmp    1040 <malloc@plt>

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @__require_allocated_array(i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @__get_array_length(i8* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @__require_allocated_array(i8* %0)
%3 = tail call i32 @__get_array_length(i8* %0)
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
/* Variables and functions */
int config_weechat_init_options();
int /*<<< orphan*/ gui_chat_printf_date_tags(int /*<<< orphan*/ *,
                                             int /*<<< orphan*/,
                                             int /*<<< orphan*/ *, char *);
int config_weechat_init() {
  int rc;
  rc = config_weechat_init_options();
  if (!rc) {
    gui_chat_printf_date_tags(
        NULL, 0, NULL, ("FATAL: error initializing configuration options"));
  }
  return rc;
}


x86 assembly (clang, -O0):
<config_weechat_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <config_weechat_init_options@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1151 <config_weechat_init+0x31>
xor    %eax,%eax
mov    %eax,%edx
xor    %esi,%esi
lea    0xeb7(%rip),%rcx
mov    %rdx,%rdi
call   1040 <gui_chat_printf_date_tags@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_weechat_init>:
push   %rbx
xor    %eax,%eax
call   1030 <config_weechat_init_options@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1140 <config_weechat_init+0x20>
lea    0xecb(%rip),%rcx
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <gui_chat_printf_date_tags@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"FATAL: error initializing configuration options\00"
define i32 @config_weechat_init() {
%1 = alloca i32
%2 = call i32 (...) @config_weechat_init_options()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @gui_chat_printf_date_tags(i32* null, i32 0, i32* null, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
@.str = [48 x i8] c"FATAL: error initializing configuration options\00"
define i32 @config_weechat_init() {
%1 = tail call i32 (...) @config_weechat_init_options()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @gui_chat_printf_date_tags(i32* null, i32 0, i32* null, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret i32 %1
}
/* Variables and functions */
int __builtin_abs(int);
int /*<<< orphan*/ link_error();
foo(int i) {
  int x;
  x = i;
  if (i < -10) {
    x = __builtin_abs(i);
    if (x < 0)
      link_error();
  }
  return x;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xfffffff6,-0x4(%rbp)
jge    1151 <foo+0x41>
mov    -0x4(%rbp),%eax
xor    %ecx,%ecx
sub    %eax,%ecx
cmp    $0x0,%eax
cmovl  %ecx,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    114c <foo+0x3c>
mov    $0x0,%al
call   1030 <link_error@plt>
jmp    1151 <foo+0x41>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,%eax
neg    %eax
cmp    $0xfffffff6,%edi
cmovge %edi,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, -10
br i1 %6, label %7, label %17
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sub nsw i32 0, %8
%10 = icmp slt i32 %8, 0
%11 = select i1 %10, i32 %9, i32 %8
store i32 %11, i32* %3
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %7
%15 = call i32 (...) @link_error()
br label %16
16: ; preds = %14, %7
br label %17
17: ; preds = %16, %1
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp slt i32 %0, -10
%3 = sub nsw i32 0, %0
%4 = select i1 %2, i32 %3, i32 %0
ret i32 %4
}
unsigned int bcm2835_version(void) { return 10055; }


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

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

LLVM IR (-O0):
define i32 @bcm2835_version() {
ret i32 10055
}

LLVM IR (-O2):
define i32 @bcm2835_version() {
ret i32 10055
}
signed char return_sc(signed char sc) { return sc; }


x86 assembly (clang, -O0):
<return_sc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @return_sc(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
ret i8 %3
}

LLVM IR (-O2):
define signext i8 @return_sc(i8 returned signext %0) {
ret i8 %0
}
int isleapyear(int year) {
  return ((year % 400) == 0)   ? 1
         : ((year % 100) == 0) ? 0
         : ((year % 4) == 0)   ? 1
                               : 0;
}


x86 assembly (clang, -O0):
<isleapyear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1128 <isleapyear+0x28>
mov    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1167 <isleapyear+0x67>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1146 <isleapyear+0x46>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    1161 <isleapyear+0x61>
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isleapyear>:
imul   $0xc28f5c29,%edi,%eax
add    $0x51eb850,%eax
mov    %eax,%ecx
ror    $0x4,%ecx
cmp    $0xa3d70b,%ecx
jb     112c <isleapyear+0x2c>
ror    $0x2,%eax
cmp    $0x28f5c29,%eax
jb     1132 <isleapyear+0x32>
xor    %eax,%eax
test   $0x3,%dil
sete   %al
ret
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @isleapyear(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 400
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %20
7: ; preds = %1
%8 = load i32, i32* %2
%9 = srem i32 %8, 100
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
br label %18
12: ; preds = %7
%13 = load i32, i32* %2
%14 = srem i32 %13, 4
%15 = icmp eq i32 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 1, i32 0
br label %18
18: ; preds = %12, %11
%19 = phi i32 [ 0, %11 ], [ %17, %12 ]
br label %20
20: ; preds = %18, %6
%21 = phi i32 [ 1, %6 ], [ %19, %18 ]
ret i32 %21
}

LLVM IR (-O2):
define i32 @isleapyear(i32 %0) {
%2 = srem i32 %0, 400
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = srem i32 %0, 100
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = and i32 %0, 3
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 1, %1 ], [ %10, %7 ], [ 0, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void errorExit(int e) { exit(e); }


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

x86 assembly (clang, -O2):
<errorExit>:
push   %rax
call   1030 <exit@plt>

LLVM IR (-O0):
define void @errorExit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
define void @errorExit(i32 %0) {
%2 = tail call i32 @exit(i32 %0)
unreachable
}
void lmk_destroy_config() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *);
FILE *open_file(char *fil) {
  FILE *fichier = fopen(fil, "r");
  if (fichier == NULL)
    printf("null");
  return fichier;
}


x86 assembly (clang, -O0):
<open_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1157 <open_file+0x37>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_file>:
push   %rbx
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1141 <open_file+0x21>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [5 x i8] c"null\00"
define noalias i32* @open_file(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i32* %2
}
struct dir_i2c_t *get_dir1(void) {
  static struct dir_i2c_t *dir1 = (struct dir_i2c_t *)(0x3F804000UL);
  return dir1;
}


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

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

LLVM IR (-O0):
%struct.dir_i2c_t = type opaque
@get_dir1.dir1 = internal global %struct.dir_i2c_t* inttoptr (i64 1065369600 to %struct.dir_i2c_t*)
define %struct.dir_i2c_t* @get_dir1() {
%1 = load %struct.dir_i2c_t*, %struct.dir_i2c_t** @get_dir1.dir1
ret %struct.dir_i2c_t* %1
}

LLVM IR (-O2):
%struct.dir_i2c_t = type opaque
define %struct.dir_i2c_t* @get_dir1() {
ret %struct.dir_i2c_t* inttoptr (i64 1065369600 to %struct.dir_i2c_t*)
}
/* Type definitions */
typedef size_t uint32_t;

/* Variables and functions */
size_t random_uint(int);
void random_ranks(uint32_t n, uint32_t *rank) {
  uint32_t i;
  for (i = 0; i < n; i++) {
    rank[i] = random_uint(50);
  }
}


x86 assembly (clang, -O0):
<random_ranks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    1160 <random_ranks+0x50>
mov    $0x32,%edi
call   1030 <random_uint@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <random_ranks+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_ranks>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1147 <random_ranks+0x37>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x32,%edi
call   1030 <random_uint@plt>
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <random_ranks+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @random_ranks(i64 %0, i64* nocapture writeonly %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %10, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %8, %4 ], [ 0, %2 ]
%6 = tail call i64 @random_uint(i32 50)
%7 = getelementptr inbounds i64, i64* %1, i64 %5
store i64 %6, i64* %7
%8 = add nuw i64 %5, 1
%9 = icmp eq i64 %8, %0
br i1 %9, label %10, label %4
10: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ android_atomic_add(int, int /*<<< orphan*/ volatile *);
extern __attribute__((always_)) int32_t
android_atomic_dec(volatile int32_t *addr) {
  return android_atomic_add(-1, addr);
}


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

x86 assembly (clang, -O2):
<android_atomic_dec>:
mov    %rdi,%rsi
mov    $0xffffffff,%edi
jmp    1030 <android_atomic_add@plt>

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

LLVM IR (-O2):
define i32 @android_atomic_dec(i32* %0) {
%2 = tail call i32 @android_atomic_add(i32 -1, i32* %0)
ret i32 %2
}
/* Variables and functions */
scalar_t__ is_screensaver_active();
int /*<<< orphan*/ screensaver_off();
void key6_event() {
  if (is_screensaver_active()) {
    screensaver_off();
    return;
  }
  screensaver_off();
}


x86 assembly (clang, -O0):
<key6_event>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <is_screensaver_active@plt>
cmp    $0x0,%rax
je     1141 <key6_event+0x21>
mov    $0x0,%al
call   1040 <screensaver_off@plt>
jmp    1148 <key6_event+0x28>
mov    $0x0,%al
call   1040 <screensaver_off@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<key6_event>:
push   %rax
xor    %eax,%eax
call   1030 <is_screensaver_active@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <screensaver_off@plt>

LLVM IR (-O0):
define void @key6_event() {
%1 = call i64 (...) @is_screensaver_active()
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 (...) @screensaver_off()
br label %7
5: ; preds = %0
%6 = call i32 (...) @screensaver_off()
br label %7
7: ; preds = %5, %3
ret void
}

LLVM IR (-O2):
define void @key6_event() {
%1 = tail call i64 (...) @is_screensaver_active()
%2 = tail call i32 (...) @screensaver_off()
ret void
}
int int_heap_cmp(const int a, const int b) { return a - b; }


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

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

LLVM IR (-O0):
define i32 @int_heap_cmp(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @int_heap_cmp(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void TIM8_UP_IRQHandler() { default_handler(); }


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

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

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

LLVM IR (-O2):
define weak void @TIM8_UP_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
main() {
  int x[] = {[0 ... 9] = 3, [3] = 2};
  return x[3] + x[2] + x[4];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xed6(%rip),%rsi
mov    $0x28,%edx
call   1030 <memcpy@plt>
mov    -0x24(%rbp),%eax
add    -0x28(%rbp),%eax
add    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.x = [10 x i32] [i32 3, i32 3, i32 3, i32 2, i32 3, i32 3, i32 3, i32 3, i32 3, i32 3]
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 3
%5 = load i32, i32* %4
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 2
%7 = load i32, i32* %6
%8 = add nsw i32 %5, %7
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 4
%10 = load i32, i32* %9
%11 = add nsw i32 %8, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @main() {
ret i32 8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printdiv(int c, int n) {
  while (n-- != 0)
    printf("%c", c);
  printf("\n");
}


x86 assembly (clang, -O0):
<printdiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1148 <printdiv+0x38>
mov    -0x4(%rbp),%esi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    111e <printdiv+0xe>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printdiv>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
je     112c <printdiv+0x1c>
mov    %esi,%ebx
mov    %edi,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <printdiv+0x10>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @printdiv(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %6, %4 ], [ %1, %2 ]
%6 = add nsw i32 %5, -1
%7 = tail call i32 @putchar(i32 %0)
%8 = icmp eq i32 %6, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = tail call i32 @putchar(i32 10)
ret void
}
double f9(double x) {
  double tmp1 = 7.5;
  double tmp2 = __builtin_copysign(2.0, x);
  return tmp1 * tmp2;
}


x86 assembly (clang, -O0):
<f9>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xf0f(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xede(%rip),%xmm1
pand   %xmm1,%xmm0
movaps 0xee3(%rip),%xmm1
por    %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f9>:
andpd  0xef8(%rip),%xmm0
orpd   0xf00(%rip),%xmm0
mulsd  0xf08(%rip),%xmm0
ret

LLVM IR (-O0):
define double @f9(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
store double 7.500000e+00, double* %3
%5 = load double, double* %2
%6 = call double @llvm.copysign.f64(double 2.000000e+00, double %5)
store double %6, double* %4
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fmul double %7, %8
ret double %9
}

LLVM IR (-O2):
define double @f9(double %0) {
%2 = tail call double @llvm.copysign.f64(double 2.000000e+00, double %0)
%3 = fmul double %2, 7.500000e+00
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ mount(char const *);
void mount_command(const char *dev) { mount(dev); }


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

x86 assembly (clang, -O2):
<mount_command>:
jmp    1030 <mount@plt>

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

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