xunge/DecIR huggingface dataset:
int dothat(int b, int c) { return b + c; }


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

x86 assembly (clang, -O2):
<dothat>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @dothat(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ strtod(char const *, char **);
int /*<<< orphan*/ strtof(char const *, char **);
int /*<<< orphan*/ strtold(char const *, char **);
void uninitvar_strtof(void) {
  const char *s;
  char **endp;
  (void)strtof(s, endp);
  (void)strtod(s, endp);
  (void)strtold(s, endp);
}


x86 assembly (clang, -O0):
<uninitvar_strtof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strtof@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strtod@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strtold@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_strtof>:
push   %rax
call   1040 <strtof@plt>
call   1030 <strtod@plt>
pop    %rax
jmp    1050 <strtold@plt>

LLVM IR (-O0):
define void @uninitvar_strtof() {
%1 = alloca i8*
%2 = alloca i8**
%3 = load i8*, i8** %1
%4 = load i8**, i8*** %2
%5 = call i32 @strtof(i8* %3, i8** %4)
%6 = load i8*, i8** %1
%7 = load i8**, i8*** %2
%8 = call i32 @strtod(i8* %6, i8** %7)
%9 = load i8*, i8** %1
%10 = load i8**, i8*** %2
%11 = call i32 @strtold(i8* %9, i8** %10)
ret void
}

LLVM IR (-O2):
define void @uninitvar_strtof() {
%1 = tail call i32 @strtof(i8* undef, i8** undef)
%2 = tail call i32 @strtod(i8* undef, i8** undef)
%3 = tail call i32 @strtold(i8* undef, i8** undef)
ret void
}
/* Variables and functions */
char *oauth_post_data_with_callback(
    const char *u, const char *data, size_t len, const char *customheader,
    void (*callback)(void *, int, size_t, size_t), void *callback_data) {
  return NULL;
}


x86 assembly (clang, -O0):
<oauth_post_data_with_callback>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @oauth_post_data_with_callback(i8* %0, i8* %1, i64 %2, i8* %3, void (i8*, i32, i64, i64)* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8*
%11 = alloca void (i8*, i32, i64, i64)*
%12 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i8* %3, i8** %10
store void (i8*, i32, i64, i64)* %4, void (i8*, i32, i64, i64)** %11
store i8* %5, i8** %12
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @oauth_post_data_with_callback(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2, i8* nocapture readnone %3, void (i8*, i32, i64, i64)* nocapture readnone %4, i8* nocapture readnone %5) {
ret i8* null
}
void testClosureBFBrV(void (*closure)(char, float, char), char a1, float a2,
                      char a3) {
  (*closure)(a1, a2, a3);
}


x86 assembly (clang, -O0):
<testClosureBFBrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
movss  %xmm0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x9(%rbp),%cl
movss  -0x10(%rbp),%xmm0
movsbl %cl,%edi
movsbl -0x11(%rbp),%esi
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureBFBrV>:
mov    %rdi,%rax
mov    %esi,%edi
mov    %edx,%esi
jmp    *%rax

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

LLVM IR (-O2):
define void @testClosureBFBrV(void (i8, float, i8)* nocapture %0, i8 signext %1, float %2, i8 signext %3) {
tail call void %0(i8 signext %1, float %2, i8 signext %3)
ret void
}
int fsemu_option_boolean(const char *name) { return 0x12345678; }


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

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

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

LLVM IR (-O2):
define i32 @fsemu_option_boolean(i8* nocapture readnone %0) {
ret i32 305419896
}
/* Variables and functions */
int /*<<< orphan*/ do_something(int);
main() {
  do_something(2);
  do_something(3);
  do_something(5);
  do_something(70);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <do_something@plt>
mov    $0x3,%edi
call   1030 <do_something@plt>
mov    $0x5,%edi
call   1030 <do_something@plt>
mov    $0x46,%edi
call   1030 <do_something@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1030 <do_something@plt>
mov    $0x3,%edi
call   1030 <do_something@plt>
mov    $0x5,%edi
call   1030 <do_something@plt>
mov    $0x46,%edi
call   1030 <do_something@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @do_something(i32 2)
%2 = call i32 @do_something(i32 3)
%3 = call i32 @do_something(i32 5)
%4 = call i32 @do_something(i32 70)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @do_something(i32 2)
%2 = tail call i32 @do_something(i32 3)
%3 = tail call i32 @do_something(i32 5)
%4 = tail call i32 @do_something(i32 70)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ int_least8_t;

/* Variables and functions */
bool SHAREMIND_MAP_KEY_LESS_int_least8_t(int_least8_t const k1,
                                         int_least8_t const k2) {
  return k1 < k2;
}


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

x86 assembly (clang, -O2):
<SHAREMIND_MAP_KEY_LESS_int_least8_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
setl   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_MAP_KEY_LESS_int_least8_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_MAP_KEY_LESS_int_least8_t(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
int kol_clip_set(int n, char buffer[]) {
  asm volatile("int $0x40" ::"a"(54), "b"(2), "c"(n), "d"(buffer));
}


x86 assembly (clang, -O0):
<kol_clip_set>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%rdx
mov    $0x36,%eax
mov    $0x2,%ebx
int    $0x40
mov    -0xc(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_clip_set>:
push   %rbx
mov    %rsi,%rdx
mov    %edi,%ecx
mov    $0x36,%eax
mov    $0x2,%ebx
int    $0x40
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @kol_clip_set(i32 %0, i8* %1) {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},{dx},~{dirflag},~{fpsr},~{flags}"(i32 54, i32 2, i32 %0, i8* %1)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ ngen(char *, char *, int);
void cgldla(int n) { ngen("%s\t%d(%%ebp),%%eax", "leal", n); }


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

x86 assembly (clang, -O2):
<cgldla>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xef3(%rip),%rsi
jmp    1030 <ngen@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"%s\09%d(%%ebp),%%eax\00"
@.str.1 = [5 x i8] c"leal\00"
define void @cgldla(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @ngen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"%s\09%d(%%ebp),%%eax\00"
@.str.1 = [5 x i8] c"leal\00"
define void @cgldla(i32 %0) {
%2 = tail call i32 @ngen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ rename(char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc <= 2) {
    fprintf(stderr, "%s: opérande manquant\n", argv[0]);
  } else {
    rename(argv[1], argv[2]);
  }
  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)
cmpl   $0x2,-0x8(%rbp)
jg     1161 <main+0x41>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xea9(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1176 <main+0x56>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1040 <rename@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jg     1140 <main+0x20>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xec7(%rip),%rsi
call   1030 <fprintf@plt>
jmp    114d <main+0x2d>
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1040 <rename@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"%s: op\C3\A9rande manquant\0A\00"
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 = icmp sle i32 %6, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %22
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @rename(i8* %17, i8* %20)
br label %22
22: ; preds = %14, %8
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"%s: op\C3\A9rande manquant\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %14
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @rename(i8* %10, i8* %12)
br label %14
14: ; preds = %8, %4
ret i32 0
}
void nbp_vlan_tunnel_info_flush(struct net_bridge_port *port) {}


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

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

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

LLVM IR (-O2):
%struct.net_bridge_port = type opaque
define void @nbp_vlan_tunnel_info_flush(%struct.net_bridge_port* nocapture %0) {
ret void
}
int my_2strlen(char **str) {
  int c;
  c = 0;
  while (str[c])
    c = c + 1;
  return (c);
}


x86 assembly (clang, -O0):
<my_2strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1130 <my_2strlen+0x30>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <my_2strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_2strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <my_2strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @my_2strlen(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ protobuf_c_out_of_memory();
void *system_alloc(void *allocator_data, size_t size) {
  void *rv;
  (void)allocator_data;
  if (size == 0)
    return NULL;
  rv = malloc(size);
  if (rv == NULL)
    protobuf_c_out_of_memory();
  return rv;
}


x86 assembly (clang, -O0):
<system_alloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1148 <system_alloc+0x28>
movq   $0x0,-0x8(%rbp)
jmp    116f <system_alloc+0x4f>
mov    -0x18(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1167 <system_alloc+0x47>
mov    $0x0,%al
call   1040 <protobuf_c_out_of_memory@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<system_alloc>:
push   %rbx
test   %rsi,%rsi
je     1141 <system_alloc+0x21>
mov    %rsi,%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <system_alloc+0x23>
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <protobuf_c_out_of_memory@plt>
jmp    1143 <system_alloc+0x23>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @system_alloc(i8* nocapture readnone %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = tail call i8* @malloc(i64 %1)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 (...) @protobuf_c_out_of_memory()
br label %9
9: ; preds = %4, %7, %2
%10 = phi i8* [ null, %2 ], [ null, %7 ], [ %5, %4 ]
ret i8* %10
}
int findRootOfElement(int forest[], int element) {
  if (element != forest[element]) {
    forest[element] = findRootOfElement(forest, forest[element]);
  }
  return forest[element];
}


x86 assembly (clang, -O0):
<findRootOfElement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     1154 <findRootOfElement+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
call   1030 <findRootOfElement@plt>
mov    %eax,%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findRootOfElement>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%eax
movslq %esi,%rbx
mov    (%rdi,%rbx,4),%esi
cmp    %ebx,%esi
je     112c <findRootOfElement+0x1c>
mov    %rdi,%r14
call   1030 <findRootOfElement@plt>
mov    %eax,(%r14,%rbx,4)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @findRootOfElement(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 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = load i32, i32* %9
%11 = icmp ne i32 %5, %10
br i1 %11, label %12, label %24
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = load i32*, i32** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = call i32 @findRootOfElement(i32* %13, i32 %18)
%20 = load i32*, i32** %3
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
store i32 %19, i32* %23
br label %24
24: ; preds = %12, %2
%25 = load i32*, i32** %3
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
%29 = load i32, i32* %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @findRootOfElement(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, %1
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @findRootOfElement(i32* %0, i32 %5)
store i32 %8, i32* %4
br label %9
9: ; preds = %7, %2
%10 = phi i32 [ %8, %7 ], [ %1, %2 ]
ret i32 %10
}
extern void le16enc(void *buf, unsigned short u) {
  unsigned char *p = (unsigned char *)buf;
  p[0] = u & 0xff;
  p[1] = ((unsigned)u >> 8) & 0xff;
}


x86 assembly (clang, -O0):
<le16enc>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movzwl -0xa(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
movzwl -0xa(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<le16enc>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @le16enc(i8* %0, i16 zeroext %1) {
%3 = alloca i8*
%4 = alloca i16
%5 = alloca i8*
store i8* %0, i8** %3
store i16 %1, i16* %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i16, i16* %4
%8 = zext i16 %7 to i32
%9 = and i32 %8, 255
%10 = trunc i32 %9 to i8
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 0
store i8 %10, i8* %12
%13 = load i16, i16* %4
%14 = zext i16 %13 to i32
%15 = lshr i32 %14, 8
%16 = and i32 %15, 255
%17 = trunc i32 %16 to i8
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i64 1
store i8 %17, i8* %19
ret void
}

LLVM IR (-O2):
define void @le16enc(i8* nocapture writeonly %0, i16 zeroext %1) {
%3 = trunc i16 %1 to i8
store i8 %3, i8* %0
%4 = lshr i16 %1, 8
%5 = trunc i16 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ mmio_writeb(int /*<<< orphan*/, void *);
void mmio_le_writeb(uint8_t val, void *addr) { mmio_writeb((val), addr); }


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

x86 assembly (clang, -O2):
<mmio_le_writeb>:
jmp    1030 <mmio_writeb@plt>

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

LLVM IR (-O2):
define void @mmio_le_writeb(i32 %0, i8* %1) {
%3 = tail call i32 @mmio_writeb(i32 %0, i8* %1)
ret void
}
void amd_iommu_stats_init(void) {}


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

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

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

LLVM IR (-O2):
define void @amd_iommu_stats_init() {
ret void
}
int fun1298() { return 1298; }


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

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

LLVM IR (-O0):
define i32 @fun1298() {
ret i32 1298
}

LLVM IR (-O2):
define i32 @fun1298() {
ret i32 1298
}
void usb_set_address(int adr) {
  (*(volatile unsigned char *)(0x24100000)) = adr | 0x80;
}


x86 assembly (clang, -O0):
<usb_set_address>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x80,%eax
mov    %al,%cl
mov    $0x24100000,%eax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<usb_set_address>:
or     $0x80,%dil
mov    %dil,0x24100000
24
ret

LLVM IR (-O0):
define void @usb_set_address(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = or i32 %3, 128
%5 = trunc i32 %4 to i8
store volatile i8 %5, i8* inttoptr (i64 605028352 to i8*)
ret void
}

LLVM IR (-O2):
define void @usb_set_address(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = or i8 %2, -128
store volatile i8 %3, i8* inttoptr (i64 605028352 to i8*)
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int item_compare(char *key_a, char *key_b) { return strcmp(key_a, key_b); }


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

x86 assembly (clang, -O2):
<item_compare>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @item_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
int open_dev_random(int *fd) {
  if (fd == 0)
    return 0;
  *fd = open("/dev/random", O_RDONLY);
  return (*fd > 0);
}


x86 assembly (clang, -O0):
<open_dev_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <open_dev_random+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1162 <open_dev_random+0x52>
mov    0x2eae(%rip),%rax
mov    (%rax),%esi
lea    0xebd(%rip),%rdi
call   1030 <open@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_dev_random>:
test   %rdi,%rdi
je     113b <open_dev_random+0x2b>
push   %rbx
mov    %rdi,%rbx
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xed7(%rip),%rdi
call   1030 <open@plt>
mov    %eax,%ecx
mov    %eax,(%rbx)
xor    %eax,%eax
test   %ecx,%ecx
setg   %al
pop    %rbx
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"/dev/random\00"
@O_RDONLY = global i32 0
define i32 @open_dev_random(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %15
7: ; preds = %1
%8 = load i32, i32* @O_RDONLY
%9 = call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = icmp sgt i32 %12, 0
%14 = zext i1 %13 to i32
store i32 %14, i32* %2
br label %15
15: ; preds = %7, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [12 x i8] c"/dev/random\00"
@O_RDONLY = global i32 0
define i32 @open_dev_random(i32* writeonly %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i32, i32* @O_RDONLY
%5 = tail call i32 @open(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* %0
%6 = icmp sgt i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %1, %3
%9 = phi i32 [ %7, %3 ], [ 0, %1 ]
ret i32 %9
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char str1[20];
  char str2[20];
  strcpy(str1, "First");
  strcpy(str2, "Second");
  const char *chptr1 = &str1[0];
  char *const chptr2 = &str1[0];
  *chptr2 = 'C';
  chptr1 = &str2[0];
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xecf(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x50(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
movb   $0x43,(%rax)
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2e74(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
lea    0xee5(%rip),%rsi
lea    0x20(%rsp),%rdi
call   1030 <strcpy@plt>
lea    0xeda(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"First\00"
@.str.1 = [7 x i8] c"Second\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [20 x i8]
%7 = alloca [20 x i8]
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
store i8* %14, i8** %8
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
store i8* %15, i8** %9
%16 = load i8*, i8** %9
store i8 67, i8* %16
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
store i8* %17, i8** %8
%18 = load i32, i32* @EXIT_SUCCESS
ret i32 %18
}

LLVM IR (-O2):
@.str = [6 x i8] c"First\00"
@.str.1 = [7 x i8] c"Second\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%7 = call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}
unsigned short bpp24to565(unsigned char r, unsigned char g, unsigned char b) {
  unsigned short result =
      (unsigned short)(((r << 8) & 0xF800) | ((g << 3) & 0x07E0) | (b >> 3));
  return result;
}


x86 assembly (clang, -O0):
<bpp24to565>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
and    $0xf800,%eax
movzbl -0x2(%rbp),%ecx
shl    $0x3,%ecx
and    $0x7e0,%ecx
or     %ecx,%eax
movzbl -0x3(%rbp),%ecx
sar    $0x3,%ecx
or     %ecx,%eax
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bpp24to565>:
shl    $0x8,%edi
and    $0xf800,%edi
and    $0xfffffffc,%esi
lea    (%rdi,%rsi,8),%ecx
shr    $0x3,%dl
movzbl %dl,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i16 @bpp24to565(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i16
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 8
%11 = and i32 %10, 63488
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 3
%15 = and i32 %14, 2016
%16 = or i32 %11, %15
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = ashr i32 %18, 3
%20 = or i32 %16, %19
%21 = trunc i32 %20 to i16
store i16 %21, i16* %7
%22 = load i16, i16* %7
ret i16 %22
}

LLVM IR (-O2):
define zeroext i16 @bpp24to565(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = zext i8 %0 to i16
%5 = shl nuw i16 %4, 8
%6 = and i16 %5, -2048
%7 = zext i8 %1 to i16
%8 = shl nuw nsw i16 %7, 3
%9 = and i16 %8, 2016
%10 = or i16 %9, %6
%11 = lshr i8 %2, 3
%12 = zext i8 %11 to i16
%13 = or i16 %10, %12
ret i16 %13
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ puts(char *);
char *readline();
int /*<<< orphan*/ sscanf(char *, char *, int *);
int getint() {
  int num = 0;
  char *line = readline();
  if (!sscanf(line, "%d", &num)) {
    puts("No numer");
  }
  free(line);
  return num;
}


x86 assembly (clang, -O0):
<getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <readline@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%eax
jne    1183 <getint+0x43>
lea    0xe85(%rip),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getint>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
call   1050 <readline@plt>
mov    %rax,%rbx
lea    0xea2(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
call   1060 <sscanf@plt>
test   %eax,%eax
jne    117b <getint+0x3b>
lea    0xe8d(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"No numer\00"
define i32 @getint() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* (...) @readline()
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = icmp ne i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = load i8*, i8** %2
%11 = call i32 @free(i8* %10)
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"No numer\00"
define i32 @getint() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i8* (...) @readline()
%4 = call i32 @sscanf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = call i32 @free(i8* %3)
%10 = load i32, i32* %1
ret i32 %10
}
unsigned short int
unsignedshortint_ignoring_signedshortint(unsigned short int x,
                                         signed short int y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedshortint_ignoring_signedshortint>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i16 @unsignedshortint_ignoring_signedshortint(i16 returned zeroext %0, i16 signext %1) {
ret i16 %0
}
/* Variables and functions */
long long cos(long long);
long long internal_cos_l(long long value) { return cos(value); }


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

x86 assembly (clang, -O2):
<internal_cos_l>:
jmp    1030 <cos@plt>

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

LLVM IR (-O2):
define i64 @internal_cos_l(i64 %0) {
%2 = tail call i64 @cos(i64 %0)
ret i64 %2
}
int test_imm_74int64_highword_reg(long long val) {
  return ((val >> 32) & (0x74 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_74int64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x20,%rdx
and    $0x74,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_74int64_highword_reg>:
movabs $0x7400000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_74int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 116
%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_74int64_highword_reg(i64 %0) {
%2 = and i64 %0, 498216206336
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ yylex();
int main(int argc, char *argv[]) {
  (void)argc;
  (void)argv;
  while (yylex() != 0)
    ;
  exit(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    $0x0,%al
call   1030 <yylex@plt>
cmp    $0x0,%rax
je     114c <main+0x2c>
jmp    1136 <main+0x16>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <yylex@plt>
test   %rax,%rax
jne    1130 <main+0x10>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
br label %8
8: ; preds = %11, %2
%9 = call i64 (...) @yylex()
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8
br label %8
12: ; preds = %8
%13 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i64 (...) @yylex()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %3
6: ; preds = %3
%7 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int ewf_uncompress(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/ *, int /*<<< orphan*/);
int ewf_sectors_chunk_uncompress(uint8_t *sectors_chunk, uint32_t *size,
                                 uint8_t *compressed_sectors_chunk,
                                 uint32_t compressed_size) {
  return (ewf_uncompress(sectors_chunk, size, compressed_sectors_chunk,
                         compressed_size));
}


x86 assembly (clang, -O0):
<ewf_sectors_chunk_uncompress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <ewf_uncompress@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ewf_sectors_chunk_uncompress>:
jmp    1030 <ewf_uncompress@plt>

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

LLVM IR (-O2):
define i32 @ewf_sectors_chunk_uncompress(i32* %0, i32* %1, i32* %2, i32 %3) {
%5 = tail call i32 @ewf_uncompress(i32* %0, i32* %1, i32* %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void do_mode(char *start, int lineno) {
  if (*start == '\0') {
    printf("Error: invalid line %d\n", lineno);
    exit(1);
  }
  printf("\n\tmode = %s;\n", start);
}


x86 assembly (clang, -O0):
<do_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    115a <do_mode+0x3a>
mov    -0xc(%rbp),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_mode>:
push   %rax
cmpb   $0x0,(%rdi)
je     113b <do_mode+0x1b>
mov    %rdi,%rax
lea    0xee8(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Error: invalid line %d\0A\00"
@.str.1 = [14 x i8] c"\0A\09mode = %s;\0A\00"
define void @do_mode(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = load i8*, i8** %3
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %14)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"Error: invalid line %d\0A\00"
@.str.1 = [14 x i8] c"\0A\09mode = %s;\0A\00"
define void @do_mode(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %1)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
struct thread_data {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ common_unauthorized(struct thread_data *, int);
void sys_unauthorized(struct thread_data *td) { common_unauthorized(td, 401); }


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

x86 assembly (clang, -O2):
<sys_unauthorized>:
mov    $0x191,%esi
jmp    1030 <common_unauthorized@plt>

LLVM IR (-O0):
%struct.thread_data = type { i32 }
define void @sys_unauthorized(%struct.thread_data* %0) {
%2 = alloca %struct.thread_data*
store %struct.thread_data* %0, %struct.thread_data** %2
%3 = load %struct.thread_data*, %struct.thread_data** %2
%4 = call i32 @common_unauthorized(%struct.thread_data* %3, i32 401)
ret void
}

LLVM IR (-O2):
%struct.thread_data = type { i32 }
define void @sys_unauthorized(%struct.thread_data* %0) {
%2 = tail call i32 @common_unauthorized(%struct.thread_data* %0, i32 401)
ret void
}
/* Variables and functions */
scalar_t__ cuserid(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char str[32];
  if (cuserid(str) != 0) {
    printf("%s\n", str);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
call   1040 <cuserid@plt>
cmp    $0x0,%rax
je     1152 <main+0x32>
lea    -0x30(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    %rsp,%rdi
call   1040 <cuserid@plt>
test   %rax,%rax
je     1140 <main+0x20>
lea    0xec8(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = call i64 @cuserid(i8* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %7
7: ; preds = %5, %0
ret i32 0
}
/* Variables and functions */
int *malloc(int);
int main(int argc, char *argv[]) {
  int *pointer = malloc(sizeof(int));
  pointer = (void *)0;
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@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**
%6 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32* @malloc(i32 4)
store i32* %7, i32** %6
store i32* null, i32** %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @malloc(i32 4)
ret i32 0
}
int build_int(char *buffer) {
  int data;
  data = ((*(buffer + 0)) & 0xff);
  data += ((*(buffer + 1) << 8) & 0xff00);
  data += ((*(buffer + 2) << 16) & 0xff0000);
  data += ((*(buffer + 3) << 24) & 0xff000000);
  return data;
}


x86 assembly (clang, -O0):
<build_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
shl    $0x8,%eax
and    $0xff00,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x2(%rax),%eax
shl    $0x10,%eax
and    $0xff0000,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%eax
shl    $0x18,%eax
and    $0xff000000,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_int>:
movzbl (%rdi),%eax
movzbl 0x1(%rdi),%ecx
shl    $0x8,%ecx
movzwl %cx,%ecx
or     %eax,%ecx
movzbl 0x2(%rdi),%eax
movzbl %al,%edx
shl    $0x10,%edx
or     %ecx,%edx
movzbl 0x3(%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @build_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = and i32 %7, 255
store i32 %8, i32* %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = and i32 %13, 65280
%15 = load i32, i32* %3
%16 = add nsw i32 %15, %14
store i32 %16, i32* %3
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i64 2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = shl i32 %20, 16
%22 = and i32 %21, 16711680
%23 = load i32, i32* %3
%24 = add nsw i32 %23, %22
store i32 %24, i32* %3
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i64 3
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = shl i32 %28, 24
%30 = and i32 %29, -16777216
%31 = load i32, i32* %3
%32 = add i32 %31, %30
store i32 %32, i32* %3
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @build_int(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = shl nsw i32 %6, 8
%8 = and i32 %7, 65280
%9 = or i32 %8, %3
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = shl nsw i32 %12, 16
%14 = and i32 %13, 16711680
%15 = or i32 %9, %14
%16 = getelementptr inbounds i8, i8* %0, i64 3
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = shl nuw i32 %18, 24
%20 = or i32 %15, %19
ret i32 %20
}