xunge/DecIR huggingface dataset:
void cli_none(struct state *context, struct debug_state *dbg_state,
              char **args) {}


x86 assembly (clang, -O0):
<cli_none>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.state = type opaque
%struct.debug_state = type opaque
define void @cli_none(%struct.state* %0, %struct.debug_state* %1, i8** %2) {
%4 = alloca %struct.state*
%5 = alloca %struct.debug_state*
%6 = alloca i8**
store %struct.state* %0, %struct.state** %4
store %struct.debug_state* %1, %struct.debug_state** %5
store i8** %2, i8*** %6
ret void
}

LLVM IR (-O2):
%struct.state = type opaque
%struct.debug_state = type opaque
define void @cli_none(%struct.state* nocapture %0, %struct.debug_state* nocapture %1, i8** nocapture %2) {
ret void
}
void lidt(void *p) { __asm volatile("lidt (%0)" : : "r"(p) : "memory"); }


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

x86 assembly (clang, -O2):
<lidt>:
lidt   (%rdi)
ret

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

LLVM IR (-O2):
define void @lidt(i8* %0) {
tail call void asm sideeffect "lidt ($0)", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void _close_safe(int fd) { close(fd); }


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

x86 assembly (clang, -O2):
<_close_safe>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @_close_safe(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Type definitions */
struct codec {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
ssize_t pcm_delay(struct codec *c) { return 0; }


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

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

LLVM IR (-O0):
%struct.codec = type { i32 }
define i32 @pcm_delay(%struct.codec* %0) {
%2 = alloca %struct.codec*
store %struct.codec* %0, %struct.codec** %2
ret i32 0
}

LLVM IR (-O2):
%struct.codec = type { i32 }
define i32 @pcm_delay(%struct.codec* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ LOG_NOTICE;
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ shut_down();
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, int);
void handle_term(int sig) {
  shut_down();
  syslog(LOG_NOTICE, "exiting due to signal %d", sig);
  closelog();
  exit(1);
}


x86 assembly (clang, -O0):
<handle_term>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1060 <shut_down@plt>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe9b(%rip),%rsi
call   1040 <syslog@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<handle_term>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1060 <shut_down@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
mov    %ebx,%edx
call   1040 <syslog@plt>
xor    %eax,%eax
call   1030 <closelog@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@LOG_NOTICE = global i32 0
@.str = [25 x i8] c"exiting due to signal %d\00"
define void @handle_term(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @shut_down()
%4 = load i32, i32* @LOG_NOTICE
%5 = load i32, i32* %2
%6 = call i32 @syslog(i32 %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (...) @closelog()
%8 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@LOG_NOTICE = global i32 0
@.str = [25 x i8] c"exiting due to signal %d\00"
define void @handle_term(i32 %0) {
%2 = tail call i32 (...) @shut_down()
%3 = load i32, i32* @LOG_NOTICE
%4 = tail call i32 @syslog(i32 %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = tail call i32 (...) @closelog()
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct symbol {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
struct symbol *symbol_table_lookup(char *);
struct symbol *symbol_table_lookup_user(char *name) {
  char user_symbol[32];
  snprintf(user_symbol, 32, "_%s", name);
  return symbol_table_lookup(user_symbol);
}


x86 assembly (clang, -O0):
<symbol_table_lookup_user>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x20,%esi
lea    0xec0(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <symbol_table_lookup@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<symbol_table_lookup_user>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rcx
lea    0xed1(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1040 <symbol_table_lookup@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.symbol = type { i32 }
@.str = [4 x i8] c"_%s\00"
define %struct.symbol* @symbol_table_lookup_user(i8* %0) {
%2 = alloca i8*
%3 = alloca [32 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @snprintf(i8* %4, i32 32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%8 = call %struct.symbol* @symbol_table_lookup(i8* %7)
ret %struct.symbol* %8
}

LLVM IR (-O2):
%struct.symbol = type { i32 }
@.str = [4 x i8] c"_%s\00"
define %struct.symbol* @symbol_table_lookup_user(i8* %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call %struct.symbol* @symbol_table_lookup(i8* %3)
ret %struct.symbol* %5
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, void *, size_t);
int fmt_packet(void *packet, char *buff, size_t n) {
  memcpy(buff, packet, n);
  return 0;
}


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

x86 assembly (clang, -O2):
<fmt_packet>:
push   %rax
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <memcpy@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @fmt_packet(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %4
%9 = load i64, i64* %6
%10 = call i32 @memcpy(i8* %7, i8* %8, i64 %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @fmt_packet(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 @memcpy(i8* %1, i8* %0, i64 %2)
ret i32 0
}
int alpha_(char a) {
  return (a >= 'a' && a <= 'z') || (a >= 'A' && a <= 'A') || (a == '_');
}


x86 assembly (clang, -O0):
<alpha_>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1129 <alpha_+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x7a,%ecx
mov    %al,-0x2(%rbp)
jle    1155 <alpha_+0x55>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1148 <alpha_+0x48>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x41,%ecx
mov    %al,-0x2(%rbp)
jle    1155 <alpha_+0x55>
movsbl -0x1(%rbp),%eax
cmp    $0x5f,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<alpha_>:
lea    -0x61(%rdi),%eax
cmp    $0x1a,%al
setb   %al
cmp    $0x41,%dil
sete   %cl
cmp    $0x5f,%dil
sete   %dl
or     %cl,%dl
or     %al,%dl
movzbl %dl,%eax
ret

LLVM IR (-O0):
define i32 @alpha_(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 97
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 122
br i1 %9, label %22, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 65
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 65
br i1 %17, label %22, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 95
br label %22
22: ; preds = %18, %14, %6
%23 = phi i1 [ true, %14 ], [ true, %6 ], [ %21, %18 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
define i32 @alpha_(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = icmp eq i8 %0, 65
%5 = or i1 %4, %3
%6 = icmp eq i8 %0, 95
%7 = or i1 %6, %5
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ mock_system_reset();
void system_reset(void) { mock_system_reset(); }


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

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

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

LLVM IR (-O2):
define void @system_reset() {
%1 = tail call i32 (...) @mock_system_reset()
ret void
}
/* Variables and functions */
bool qstrtest(int (*testfunc)(int), const char *str) {
  for (; *str; str++) {
    if (testfunc(*str) == 0)
      return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<qstrtest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1155 <qstrtest+0x55>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%edi
call   *%rax
cmp    $0x0,%eax
jne    113f <qstrtest+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    115c <qstrtest+0x5c>
jmp    1144 <qstrtest+0x44>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <qstrtest+0x10>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qstrtest>:
push   %rbp
push   %r14
push   %rbx
mov    (%rsi),%al
mov    $0x1,%r14d
test   %al,%al
je     1139 <qstrtest+0x39>
mov    %rsi,%rbx
mov    %rdi,%rbp
add    $0x1,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   *%rbp
test   %eax,%eax
je     1136 <qstrtest+0x36>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <qstrtest+0x20>
jmp    1139 <qstrtest+0x39>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @qstrtest(i32 (i32)* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %8
5: ; preds = %8
%6 = load i8, i8* %14
%7 = icmp eq i8 %6, 0
br i1 %7, label %15, label %8
8: ; preds = %2, %5
%9 = phi i8 [ %6, %5 ], [ %3, %2 ]
%10 = phi i8* [ %14, %5 ], [ %1, %2 ]
%11 = sext i8 %9 to i32
%12 = tail call i32 %0(i32 %11)
%13 = icmp eq i32 %12, 0
%14 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %13, label %15, label %5
15: ; preds = %8, %5, %2
%16 = phi i32 [ 1, %2 ], [ 1, %5 ], [ 0, %8 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ save_super();
void umount() { save_super(); }


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

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

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

LLVM IR (-O2):
define void @umount() {
%1 = tail call i32 (...) @save_super()
ret void
}
void intel_th_debug_done(void) {}


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

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

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

LLVM IR (-O2):
define void @intel_th_debug_done() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void onStopHandler(void) { puts("Server stopped"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Server stopped\00"
define void @onStopHandler() {
%1 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Server stopped\00"
define void @onStopHandler() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned int get_u32(void *addr) {
  unsigned char *b = addr;
  return (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3]);
}


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

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

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

LLVM IR (-O2):
define i32 @get_u32(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw i32 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 16
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = or i32 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %14, %17
ret i32 %18
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool power_of_two(uint32_t x) { return (x != 0) && ((x & (x - 1)) == 0); }


x86 assembly (clang, -O0):
<power_of_two>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112a <power_of_two+0x2a>
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<power_of_two>:
test   %edi,%edi
je     110f <power_of_two+0xf>
lea    -0x1(%rdi),%ecx
xor    %eax,%eax
test   %ecx,%edi
sete   %al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @power_of_two(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.ctpop.i32(i32 %0)
%5 = icmp ult i32 %4, 2
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
void foo_2_2_1_1_2_1_2_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_1_1_2_1_2_2_1() {
ret void
}
void head_capital(char *str) {
  if (str) {
    char *head = str;
    if (*head >= 'a' && *head <= 'z') {
      *head &= 0xDF;
    }
  }
}


x86 assembly (clang, -O0):
<head_capital>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114f <head_capital+0x4f>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     114a <head_capital+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     114a <head_capital+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
and    $0xdf,%ecx
mov    %cl,(%rax)
jmp    114f <head_capital+0x4f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<head_capital>:
test   %rdi,%rdi
je     1113 <head_capital+0x13>
mov    (%rdi),%al
lea    -0x61(%rax),%ecx
cmp    $0x19,%cl
ja     1113 <head_capital+0x13>
and    $0xdf,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @head_capital(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %24
6: ; preds = %1
%7 = load i8*, i8** %2
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp sge i32 %10, 97
br i1 %11, label %12, label %23
12: ; preds = %6
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sle i32 %15, 122
br i1 %16, label %17, label %23
17: ; preds = %12
%18 = load i8*, i8** %3
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = and i32 %20, 223
%22 = trunc i32 %21 to i8
store i8 %22, i8* %18
br label %23
23: ; preds = %17, %12, %6
br label %24
24: ; preds = %23, %1
ret void
}

LLVM IR (-O2):
define void @head_capital(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = add i8 %4, -97
%6 = icmp ult i8 %5, 26
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = and i8 %4, -33
store i8 %8, i8* %0
br label %9
9: ; preds = %3, %7, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
void report_background_job(int job_id, int process_id) {
  fprintf(stderr, "[%d] %d\n", job_id, process_id);
}


x86 assembly (clang, -O0):
<report_background_job>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_background_job>:
mov    %esi,%ecx
mov    %edi,%edx
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [9 x i8] c"[%d] %d\0A\00"
define void @report_background_job(i32 %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void SPI4_IRQHandler() { default_handler(); }


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

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

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

LLVM IR (-O2):
define weak void @SPI4_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Type definitions */
typedef int mode_t;

/* Variables and functions */
#define S_IFBLK 134
#define S_IFCHR 133
#define S_IFDIR 132
#define S_IFIFO 131
#define S_IFLNK 130
int const S_IFMT;
#define S_IFREG 129
#define S_IFSOCK 128
char nodtype(const mode_t mode) {
  switch (mode & S_IFMT) {
  case S_IFREG:
    return 'f';
  case S_IFDIR:
    return 'd';
  case S_IFLNK:
    return 'l';
  case S_IFCHR:
    return 'c';
  case S_IFBLK:
    return 'b';
  case S_IFSOCK:
    return 's';
  case S_IFIFO:
    return 'p';
  default:
    return '?';
  }
}


x86 assembly (clang, -O0):
<nodtype>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ecf(%rip),%rcx
mov    (%rcx),%ecx
and    %ecx,%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x6,%eax
ja     117a <nodtype+0x7a>
mov    -0x10(%rbp),%rax
lea    0xece(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x66,-0x1(%rbp)
jmp    117e <nodtype+0x7e>
movb   $0x64,-0x1(%rbp)
jmp    117e <nodtype+0x7e>
movb   $0x6c,-0x1(%rbp)
jmp    117e <nodtype+0x7e>
movb   $0x63,-0x1(%rbp)
jmp    117e <nodtype+0x7e>
movb   $0x62,-0x1(%rbp)
jmp    117e <nodtype+0x7e>
movb   $0x73,-0x1(%rbp)
jmp    117e <nodtype+0x7e>
movb   $0x70,-0x1(%rbp)
jmp    117e <nodtype+0x7e>
movb   $0x3f,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nodtype>:
mov    $0x3f,%al
ret

LLVM IR (-O0):
@S_IFMT = constant i32 0
define signext i8 @nodtype(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @S_IFMT
%6 = and i32 %4, %5
switch i32 %6, label %14 [
i32 129, label %7
i32 132, label %8
i32 130, label %9
i32 133, label %10
i32 134, label %11
i32 128, label %12
i32 131, label %13
]
7: ; preds = %1
store i8 102, i8* %2
br label %15
8: ; preds = %1
store i8 100, i8* %2
br label %15
9: ; preds = %1
store i8 108, i8* %2
br label %15
10: ; preds = %1
store i8 99, i8* %2
br label %15
11: ; preds = %1
store i8 98, i8* %2
br label %15
12: ; preds = %1
store i8 115, i8* %2
br label %15
13: ; preds = %1
store i8 112, i8* %2
br label %15
14: ; preds = %1
store i8 63, i8* %2
br label %15
15: ; preds = %14, %13, %12, %11, %10, %9, %8, %7
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
@S_IFMT = constant i32 0
define signext i8 @nodtype(i32 %0) {
ret i8 63
}
/* Variables and functions */
char *__streadd(char *, char const *, char const *, char *);
char *streadd(char *output, const char *input, const char *exceptions) {
  return __streadd(output, input, exceptions, "\\");
}


x86 assembly (clang, -O0):
<streadd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xec9(%rip),%rcx
call   1030 <__streadd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<streadd>:
lea    0xee9(%rip),%rcx
jmp    1030 <__streadd@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\\\00"
define i8* @streadd(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i8* @__streadd(i8* %7, i8* %8, i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i8* %10
}

LLVM IR (-O2):
@.str = [2 x i8] c"\\\00"
define i8* @streadd(i8* %0, i8* %1, i8* %2) {
%4 = tail call i8* @__streadd(i8* %0, i8* %1, i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t get_walk_size(uint32_t entry_len) { return (entry_len + 3) & ~0x03; }


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

x86 assembly (clang, -O2):
<get_walk_size>:
lea    0x3(%rdi),%eax
and    $0xfffffffc,%eax
ret

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

LLVM IR (-O2):
define i32 @get_walk_size(i32 %0) {
%2 = add nsw i32 %0, 3
%3 = and i32 %2, -4
ret i32 %3
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int _gettimeofday(struct timeval *tv) {
  assert(0);
  tv->tv_sec = 0;
  tv->tv_usec = 0;
  return 0;
}


x86 assembly (clang, -O0):
<_gettimeofday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gettimeofday>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
call   1030 <assert@plt>
xorps  %xmm0,%xmm0
movups %xmm0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i32 @_gettimeofday(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = call i32 @assert(i32 0)
%4 = load %struct.timeval*, %struct.timeval** %2
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 1
store i64 0, i64* %5
%6 = load %struct.timeval*, %struct.timeval** %2
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
store i64 0, i64* %7
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i32 @_gettimeofday(%struct.timeval* nocapture writeonly %0) {
%2 = tail call i32 @assert(i32 0)
%3 = bitcast %struct.timeval* %0 to i8*
ret i32 0
}
void fsck(struct CMD *c) {
  extern void fs_fsck(void);
  fs_fsck();
}


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

x86 assembly (clang, -O2):
<fsck>:
jmp    1030 <fs_fsck@plt>

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

LLVM IR (-O2):
%struct.CMD = type opaque
define void @fsck(%struct.CMD* nocapture readnone %0) {
tail call void @fs_fsck()
ret void
}
/* Type definitions */
struct rlimit {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int setrlimit(int resource, const struct rlimit *rlim) {
  ;
  errno = ENOSYS;
  return -1;
  ;
}


x86 assembly (clang, -O0):
<setrlimit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebd(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setrlimit>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.rlimit = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @setrlimit(i32 %0, %struct.rlimit* %1) {
%3 = alloca i32
%4 = alloca %struct.rlimit*
store i32 %0, i32* %3
store %struct.rlimit* %1, %struct.rlimit** %4
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.rlimit = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @setrlimit(i32 %0, %struct.rlimit* nocapture readnone %1) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ showUsage(char *);
int /*<<< orphan*/ stderr;
void noArgument(char *applet) {
  fprintf(stderr, "Error: no argument !\n");
  showUsage(applet);
  exit(1);
}


x86 assembly (clang, -O0):
<noArgument>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <showUsage@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<noArgument>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <showUsage@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Error: no argument !\0A\00"
define void @noArgument(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32 @showUsage(i8* %5)
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Error: no argument !\0A\00"
define void @noArgument(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @showUsage(i8* %0)
%5 = tail call i32 @exit(i32 1)
unreachable
}
void WIFI_GET_RX_DETAIL_REPORT(int *totalPkt, int *goodPkt, int *badPkt) {}


x86 assembly (clang, -O0):
<WIFI_GET_RX_DETAIL_REPORT>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @WIFI_GET_RX_DETAIL_REPORT(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
ret void
}

LLVM IR (-O2):
define void @WIFI_GET_RX_DETAIL_REPORT(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
ret void
}
void XDisplayOfIM() {}


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

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

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

LLVM IR (-O2):
define void @XDisplayOfIM() {
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
size_t id3_v2_2_get_size(uint8_t *data) {
  int i;
  int size = 0;
  for (i = 0; i < 3; ++i) {
    size *= 128;
    size += data[i];
  }
  return size;
}


x86 assembly (clang, -O0):
<id3_v2_2_get_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    114d <id3_v2_2_get_size+0x4d>
mov    -0x10(%rbp),%eax
shl    $0x7,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
movslq -0x10(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <id3_v2_2_get_size+0x16>
movslq -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<id3_v2_2_get_size>:
mov    (%rdi),%eax
shl    $0x7,%eax
add    0x8(%rdi),%eax
shl    $0x7,%eax
add    0x10(%rdi),%eax
cltq
ret

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

LLVM IR (-O2):
define i64 @id3_v2_2_get_size(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = shl nsw i32 %3, 7
%5 = getelementptr inbounds i64, i64* %0, i64 1
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = add i32 %4, %7
%9 = shl nsw i32 %8, 7
%10 = getelementptr inbounds i64, i64* %0, i64 2
%11 = load i64, i64* %10
%12 = trunc i64 %11 to i32
%13 = add i32 %9, %12
%14 = sext i32 %13 to i64
ret i64 %14
}
int pinmux_map_to_setting(const struct pinctrl_map *map,
                          struct pinctrl_setting *setting) {
  return 0;
}


x86 assembly (clang, -O0):
<pinmux_map_to_setting>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.pinctrl_map = type opaque
%struct.pinctrl_setting = type opaque
define i32 @pinmux_map_to_setting(%struct.pinctrl_map* %0, %struct.pinctrl_setting* %1) {
%3 = alloca %struct.pinctrl_map*
%4 = alloca %struct.pinctrl_setting*
store %struct.pinctrl_map* %0, %struct.pinctrl_map** %3
store %struct.pinctrl_setting* %1, %struct.pinctrl_setting** %4
ret i32 0
}

LLVM IR (-O2):
%struct.pinctrl_map = type opaque
%struct.pinctrl_setting = type opaque
define i32 @pinmux_map_to_setting(%struct.pinctrl_map* nocapture readnone %0, %struct.pinctrl_setting* nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef long long int64_t;

/* Variables and functions */
int64_t return_int64_7() { return 4611686018427387904LL; }


x86 assembly (clang, -O0):
<return_int64_7>:
push   %rbp
mov    %rsp,%rbp
movabs $0x4000000000000000,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_int64_7>:
movabs $0x4000000000000000,%rax
ret

LLVM IR (-O0):
define i64 @return_int64_7() {
ret i64 4611686018427387904
}

LLVM IR (-O2):
define i64 @return_int64_7() {
ret i64 4611686018427387904
}
/* Type definitions */
struct Session {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ destroySession(struct Session *);
int /*<<< orphan*/ free(struct Session *);
void deleteSession(struct Session *session) {
  destroySession(session);
  free(session);
}


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

x86 assembly (clang, -O2):
<deleteSession>:
push   %rbx
mov    %rdi,%rbx
call   1040 <destroySession@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.Session = type { i32 }
define void @deleteSession(%struct.Session* %0) {
%2 = alloca %struct.Session*
store %struct.Session* %0, %struct.Session** %2
%3 = load %struct.Session*, %struct.Session** %2
%4 = call i32 @destroySession(%struct.Session* %3)
%5 = load %struct.Session*, %struct.Session** %2
%6 = call i32 @free(%struct.Session* %5)
ret void
}

LLVM IR (-O2):
%struct.Session = type { i32 }
define void @deleteSession(%struct.Session* %0) {
%2 = tail call i32 @destroySession(%struct.Session* %0)
%3 = tail call i32 @free(%struct.Session* %0)
ret void
}
int is_in_bound(int *arr, int size, int *ptr) {
  int i;
  for (i = 0; i < size; i++) {
    if (&arr[i] == ptr) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_in_bound>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115a <is_in_bound+0x5a>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
cmp    -0x20(%rbp),%rax
jne    1147 <is_in_bound+0x47>
movl   $0x1,-0x4(%rbp)
jmp    1161 <is_in_bound+0x61>
jmp    114c <is_in_bound+0x4c>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1116 <is_in_bound+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_bound>:
xor    %eax,%eax
test   %esi,%esi
jle    111f <is_in_bound+0x1f>
mov    %esi,%ecx
add    $0xfffffffffffffffc,%rdi
nopl   0x0(%rax)
add    $0x4,%rdi
cmp    %rdx,%rdi
je     1120 <is_in_bound+0x20>
add    $0xffffffffffffffff,%rcx
jne    1110 <is_in_bound+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_in_bound(i32* readnone %0, i32 %1, i32* readnone %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %13, %6
br i1 %8, label %14, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %13, %7 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = icmp eq i32* %11, %2
%13 = add nuw nsw i64 %10, 1
br i1 %12, label %14, label %7
14: ; preds = %9, %7, %3
%15 = phi i32 [ 0, %3 ], [ 0, %7 ], [ 1, %9 ]
ret i32 %15
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int uint16_t;

/* Variables and functions */
void dac7568_setup_cmd(uint32_t *cmd, uint8_t ch, uint16_t data) {
  uint8_t *cmd_ptr = (uint8_t *)cmd;
  if (cmd == NULL)
    return;
  cmd_ptr[2] = ((ch << 4) & 0xff) + ((data >> 8) & 0xf);
  cmd_ptr[1] = 0xff & data;
  return;
}


x86 assembly (clang, -O0):
<dac7568_setup_cmd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1126 <dac7568_setup_cmd+0x26>
jmp    1154 <dac7568_setup_cmd+0x54>
mov    -0xc(%rbp),%ecx
shl    $0x4,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%eax
sar    $0x8,%eax
and    $0xf,%eax
add    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dac7568_setup_cmd>:
test   %rdi,%rdi
je     111f <dac7568_setup_cmd+0x1f>
shl    $0x4,%esi
movzbl %sil,%eax
mov    %edx,%ecx
shr    $0x8,%ecx
and    $0xf,%ecx
or     %eax,%ecx
mov    %ecx,0x8(%rdi)
movzbl %dl,%eax
mov    %eax,0x4(%rdi)
ret

LLVM IR (-O0):
define void @dac7568_setup_cmd(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
store i32* %8, i32** %7
%9 = load i32*, i32** %4
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %12
11: ; preds = %3
br label %26
12: ; preds = %3
%13 = load i32, i32* %5
%14 = shl i32 %13, 4
%15 = and i32 %14, 255
%16 = load i32, i32* %6
%17 = ashr i32 %16, 8
%18 = and i32 %17, 15
%19 = add nsw i32 %15, %18
%20 = load i32*, i32** %7
%21 = getelementptr inbounds i32, i32* %20, i64 2
store i32 %19, i32* %21
%22 = load i32, i32* %6
%23 = and i32 255, %22
%24 = load i32*, i32** %7
%25 = getelementptr inbounds i32, i32* %24, i64 1
store i32 %23, i32* %25
br label %26
26: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @dac7568_setup_cmd(i32* writeonly %0, i32 %1, i32 %2) {
%4 = icmp eq i32* %0, null
br i1 %4, label %14, label %5
5: ; preds = %3
%6 = shl i32 %1, 4
%7 = and i32 %6, 240
%8 = lshr i32 %2, 8
%9 = and i32 %8, 15
%10 = or i32 %9, %7
%11 = getelementptr inbounds i32, i32* %0, i64 2
store i32 %10, i32* %11
%12 = and i32 %2, 255
%13 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %12, i32* %13
br label %14
14: ; preds = %3, %5
ret void
}
void HandleSIGPIPE() { return; }


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

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

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

LLVM IR (-O2):
define void @HandleSIGPIPE() {
ret void
}
/* Variables and functions */
char *get_dedication();
int /*<<< orphan*/ printf(char *, char const *);
int main(int argc, const char *argv[]) {
  const char *dedication;
  if (argc > 1) {
    dedication = argv[1];
  } else {
    dedication = get_dedication();
  }
  printf("Hello, %s!\n", dedication);
  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)
cmpl   $0x1,-0x8(%rbp)
jle    1151 <main+0x31>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    115c <main+0x3c>
mov    $0x0,%al
call   1030 <get_dedication@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jl     112c <main+0xc>
mov    0x8(%rsi),%rsi
jmp    1136 <main+0x16>
xor    %eax,%eax
call   1030 <get_dedication@plt>
mov    %rax,%rsi
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello, %s!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
store i8* %12, i8** %6
br label %15
13: ; preds = %2
%14 = call i8* (...) @get_dedication()
store i8* %14, i8** %6
br label %15
15: ; preds = %13, %9
%16 = load i8*, i8** %6
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello, %s!\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
br label %9
7: ; preds = %2
%8 = tail call i8* (...) @get_dedication()
br label %9
9: ; preds = %7, %4
%10 = phi i8* [ %6, %4 ], [ %8, %7 ]
%11 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %10)
ret i32 0
}
int legacy() { return 4; }


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

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

LLVM IR (-O0):
define i32 @legacy() {
ret i32 4
}

LLVM IR (-O2):
define i32 @legacy() {
ret i32 4
}
int test1(int x, int y, int z, int weight) {
  int tmp1 = x * weight;
  int tmp2 = y * weight;
  int tmp3 = (x - y) * weight;
  return tmp1 + (tmp2 + tmp3);
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    -0x1c(%rbp),%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
imul   %ecx,%edi
lea    (%rdi,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @test1(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i32, i32* %5
%13 = load i32, i32* %8
%14 = mul nsw i32 %12, %13
store i32 %14, i32* %9
%15 = load i32, i32* %6
%16 = load i32, i32* %8
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %10
%18 = load i32, i32* %5
%19 = load i32, i32* %6
%20 = sub nsw i32 %18, %19
%21 = load i32, i32* %8
%22 = mul nsw i32 %20, %21
store i32 %22, i32* %11
%23 = load i32, i32* %9
%24 = load i32, i32* %10
%25 = load i32, i32* %11
%26 = add nsw i32 %24, %25
%27 = add nsw i32 %23, %26
ret i32 %27
}

LLVM IR (-O2):
define i32 @test1(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %0, 1
%6 = mul i32 %5, %3
ret i32 %6
}
/* Variables and functions */
scalar_t__ malloc(int);
int *test(int **a2, int **b2) {
  int *temp = *a2;
  int *temp1 = *b2;
  if (*temp1 < *temp) {
    return *b2;
  } else {
    int *temp2 = (int *)malloc(sizeof(int));
    a2 = &temp2;
  }
  return *a2;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    1158 <test+0x48>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    1179 <test+0x69>
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x30(%rbp)
lea    -0x30(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    (%rdi),%rcx
mov    (%rsi),%rax
mov    (%rax),%edx
cmp    (%rcx),%edx
jl     1127 <test+0x17>
mov    $0x4,%edi
call   1030 <malloc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32* @test(i32** %0, i32** %1) {
%3 = alloca i32*
%4 = alloca i32**
%5 = alloca i32**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32** %0, i32*** %4
store i32** %1, i32*** %5
%9 = load i32**, i32*** %4
%10 = load i32*, i32** %9
store i32* %10, i32** %6
%11 = load i32**, i32*** %5
%12 = load i32*, i32** %11
store i32* %12, i32** %7
%13 = load i32*, i32** %7
%14 = load i32, i32* %13
%15 = load i32*, i32** %6
%16 = load i32, i32* %15
%17 = icmp slt i32 %14, %16
br i1 %17, label %18, label %21
18: ; preds = %2
%19 = load i32**, i32*** %5
%20 = load i32*, i32** %19
store i32* %20, i32** %3
br label %27
21: ; preds = %2
%22 = call i64 @malloc(i32 4)
%23 = inttoptr i64 %22 to i32*
store i32* %23, i32** %8
store i32** %8, i32*** %4
br label %24
24: ; preds = %21
%25 = load i32**, i32*** %4
%26 = load i32*, i32** %25
store i32* %26, i32** %3
br label %27
27: ; preds = %24, %18
%28 = load i32*, i32** %3
ret i32* %28
}

LLVM IR (-O2):
define i32* @test(i32** nocapture %0, i32** nocapture %1) {
%3 = load i32*, i32** %0
%4 = load i32*, i32** %1
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = icmp slt i32 %5, %6
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = tail call i64 @malloc(i32 4)
%10 = inttoptr i64 %9 to i32*
br label %11
11: ; preds = %2, %8
%12 = phi i32* [ %10, %8 ], [ %4, %2 ]
ret i32* %12
}