xunge/DecIR huggingface dataset:
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int strlen(char const *);
char *strdup(const char *str) {
  int len = strlen(str) + 1;
  char *buf = malloc(len);
  if (buf)
    memcpy(buf, str, len);
  return buf;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1172 <strdup+0x42>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%ebp
add    $0x1,%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     115d <strdup+0x2d>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %3)
br label %8
8: ; preds = %6, %1
ret i8* %4
}
void VS_DEBUG_ERROR() {}


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

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

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

LLVM IR (-O2):
define void @VS_DEBUG_ERROR() {
ret void
}
char upperCase(unsigned char c) {
  if ((c > 96) && (c < 123))
    c = c - 32;
  return c;
}


x86 assembly (clang, -O0):
<upperCase>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x60,%eax
jle    112e <upperCase+0x2e>
movzbl -0x1(%rbp),%eax
cmp    $0x7b,%eax
jge    112e <upperCase+0x2e>
movzbl -0x1(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<upperCase>:
lea    -0x61(%rdi),%eax
lea    -0x20(%rdi),%ecx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @upperCase(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp sgt i32 %4, 96
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = icmp slt i32 %8, 123
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
%13 = sub nsw i32 %12, 32
%14 = trunc i32 %13 to i8
store i8 %14, i8* %2
br label %15
15: ; preds = %10, %6, %1
%16 = load i8, i8* %2
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @upperCase(i8 zeroext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, -32
%5 = select i1 %3, i8 %4, i8 %0
ret i8 %5
}
int main(int argc, char const *argv[]) {
  ;
  return 69;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 69
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
void uDMAChannelDisable(unsigned long ulChannelNum) {
  DEBUG_ASSERT((ulChannelNum & 0xffff) < 32);
  (*((volatile unsigned long *)(0x400FF02C))) = 1 << (ulChannelNum & 0x1f);
}


x86 assembly (clang, -O0):
<uDMAChannelDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
cmp    $0x20,%rax
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
and    $0x1f,%rax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq %eax,%rcx
mov    $0x400ff02c,%eax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDMAChannelDisable>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   $0xffe0,%ebx
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
cltq
mov    %rax,0x400ff02c
40
pop    %rbx
ret

LLVM IR (-O0):
define void @uDMAChannelDisable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 65535
%5 = icmp ult i64 %4, 32
%6 = zext i1 %5 to i32
%7 = call i32 @DEBUG_ASSERT(i32 %6)
%8 = load i64, i64* %2
%9 = and i64 %8, 31
%10 = trunc i64 %9 to i32
%11 = shl i32 1, %10
%12 = sext i32 %11 to i64
store volatile i64 %12, i64* inttoptr (i64 1074786348 to i64*)
ret void
}

LLVM IR (-O2):
define void @uDMAChannelDisable(i64 %0) {
%2 = and i64 %0, 65504
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @DEBUG_ASSERT(i32 %4)
%6 = trunc i64 %0 to i32
%7 = and i32 %6, 31
%8 = shl nuw i32 1, %7
%9 = sext i32 %8 to i64
store volatile i64 %9, i64* inttoptr (i64 1074786348 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
void funcB() { printf("In funcB: this section is executed by thread %d\n", 0); }


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

x86 assembly (clang, -O2):
<funcB>:
lea    0xee9(%rip),%rdi
xor    %esi,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"In funcB: this section is executed by thread %d\0A\00"
define void @funcB() {
%1 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [49 x i8] c"In funcB: this section is executed by thread %d\0A\00"
define void @funcB() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 0)
ret void
}
void mdp4_overlay_dsi_video_wait4event(struct msm_fb_data_type *mfd,
                                       int intr_done) {}


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

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

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

LLVM IR (-O2):
%struct.msm_fb_data_type = type opaque
define void @mdp4_overlay_dsi_video_wait4event(%struct.msm_fb_data_type* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
size_t get_scratch_buf_capacity();
size_t get_scratch_buf_used();
size_t get_scratch_buf_avail(void) {
  return get_scratch_buf_capacity() - get_scratch_buf_used();
}


x86 assembly (clang, -O0):
<get_scratch_buf_avail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get_scratch_buf_capacity@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <get_scratch_buf_used@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
sub    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_scratch_buf_avail>:
push   %rbx
xor    %eax,%eax
call   1030 <get_scratch_buf_capacity@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <get_scratch_buf_used@plt>
sub    %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @get_scratch_buf_avail() {
%1 = call i64 (...) @get_scratch_buf_capacity()
%2 = call i64 (...) @get_scratch_buf_used()
%3 = sub i64 %1, %2
ret i64 %3
}

LLVM IR (-O2):
define i64 @get_scratch_buf_avail() {
%1 = tail call i64 (...) @get_scratch_buf_capacity()
%2 = tail call i64 (...) @get_scratch_buf_used()
%3 = sub i64 %1, %2
ret i64 %3
}
void emit_named_value(struct processor_explicatory_state *process_state,
                      struct modern_stream *stream, void *stream_state,
                      struct modern_vfile *vfile, void *vfile_state) {}


x86 assembly (clang, -O0):
<emit_named_value>:
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)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.processor_explicatory_state = type opaque
%struct.modern_stream = type opaque
%struct.modern_vfile = type opaque
define void @emit_named_value(%struct.processor_explicatory_state* %0, %struct.modern_stream* %1, i8* %2, %struct.modern_vfile* %3, i8* %4) {
%6 = alloca %struct.processor_explicatory_state*
%7 = alloca %struct.modern_stream*
%8 = alloca i8*
%9 = alloca %struct.modern_vfile*
%10 = alloca i8*
store %struct.processor_explicatory_state* %0, %struct.processor_explicatory_state** %6
store %struct.modern_stream* %1, %struct.modern_stream** %7
store i8* %2, i8** %8
store %struct.modern_vfile* %3, %struct.modern_vfile** %9
store i8* %4, i8** %10
ret void
}

LLVM IR (-O2):
%struct.processor_explicatory_state = type opaque
%struct.modern_stream = type opaque
%struct.modern_vfile = type opaque
define void @emit_named_value(%struct.processor_explicatory_state* nocapture %0, %struct.modern_stream* nocapture %1, i8* nocapture %2, %struct.modern_vfile* nocapture %3, i8* nocapture %4) {
ret void
}
/* Type definitions */
struct cmdline_args_info {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ clear_args(struct cmdline_args_info *);
int /*<<< orphan*/ clear_given(struct cmdline_args_info *);
int /*<<< orphan*/ init_args_info(struct cmdline_args_info *);
void cmdline_args_init(struct cmdline_args_info *args_info) {
  clear_given(args_info);
  clear_args(args_info);
  init_args_info(args_info);
}


x86 assembly (clang, -O0):
<cmdline_args_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <clear_given@plt>
mov    -0x8(%rbp),%rdi
call   1030 <clear_args@plt>
mov    -0x8(%rbp),%rdi
call   1050 <init_args_info@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdline_args_init>:
push   %rbx
mov    %rdi,%rbx
call   1040 <clear_given@plt>
mov    %rbx,%rdi
call   1030 <clear_args@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <init_args_info@plt>

LLVM IR (-O0):
%struct.cmdline_args_info = type { i32 }
define void @cmdline_args_init(%struct.cmdline_args_info* %0) {
%2 = alloca %struct.cmdline_args_info*
store %struct.cmdline_args_info* %0, %struct.cmdline_args_info** %2
%3 = load %struct.cmdline_args_info*, %struct.cmdline_args_info** %2
%4 = call i32 @clear_given(%struct.cmdline_args_info* %3)
%5 = load %struct.cmdline_args_info*, %struct.cmdline_args_info** %2
%6 = call i32 @clear_args(%struct.cmdline_args_info* %5)
%7 = load %struct.cmdline_args_info*, %struct.cmdline_args_info** %2
%8 = call i32 @init_args_info(%struct.cmdline_args_info* %7)
ret void
}

LLVM IR (-O2):
%struct.cmdline_args_info = type { i32 }
define void @cmdline_args_init(%struct.cmdline_args_info* %0) {
%2 = tail call i32 @clear_given(%struct.cmdline_args_info* %0)
%3 = tail call i32 @clear_args(%struct.cmdline_args_info* %0)
%4 = tail call i32 @init_args_info(%struct.cmdline_args_info* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("Hello, World");
  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)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello, World\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 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello, World\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
float c_log(float, int);
float c_log_2(float a) { return c_log(a, 2); }


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

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

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

LLVM IR (-O2):
define float @c_log_2(float %0) {
%2 = tail call float @c_log(float %0, i32 2)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ wdt87xx_get_string(int);
int /*<<< orphan*/ wdt87xx_i2c_xfer(void (*)(), int);
void wdt87xx_ts_probe_tx_buf() {
  wdt87xx_get_string(34);
  wdt87xx_get_string(8);
  wdt87xx_i2c_xfer(wdt87xx_ts_probe_tx_buf, 2);
}


x86 assembly (clang, -O0):
<wdt87xx_ts_probe_tx_buf>:
push   %rbp
mov    %rsp,%rbp
mov    $0x22,%edi
call   1040 <wdt87xx_get_string@plt>
mov    $0x8,%edi
call   1040 <wdt87xx_get_string@plt>
mov    0x2ea9(%rip),%rdi
mov    $0x2,%esi
call   1030 <wdt87xx_i2c_xfer@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wdt87xx_ts_probe_tx_buf>:
push   %rax
mov    $0x22,%edi
call   1040 <wdt87xx_get_string@plt>
mov    $0x8,%edi
call   1040 <wdt87xx_get_string@plt>
mov    0x2eac(%rip),%rdi
mov    $0x2,%esi
pop    %rax
jmp    1030 <wdt87xx_i2c_xfer@plt>

LLVM IR (-O0):
define void @wdt87xx_ts_probe_tx_buf() {
%1 = call i32 @wdt87xx_get_string(i32 34)
%2 = call i32 @wdt87xx_get_string(i32 8)
%3 = call i32 @wdt87xx_i2c_xfer(void (...)* bitcast (void ()* @wdt87xx_ts_probe_tx_buf to void (...)*), i32 2)
ret void
}

LLVM IR (-O2):
define void @wdt87xx_ts_probe_tx_buf() {
%1 = tail call i32 @wdt87xx_get_string(i32 34)
%2 = tail call i32 @wdt87xx_get_string(i32 8)
%3 = tail call i32 @wdt87xx_i2c_xfer(void (...)* bitcast (void ()* @wdt87xx_ts_probe_tx_buf to void (...)*), i32 2)
ret void
}
char *strcat(char *s1, const char *s2) {
  char *s;
  for (s = s1; *s != '\0'; ++s)
    ;
  for (; (*s = *s2) != '\0'; ++s, ++s2)
    ;
  return (s1);
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     113a <strcat+0x3a>
jmp    1129 <strcat+0x29>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <strcat+0x14>
jmp    113f <strcat+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     1179 <strcat+0x79>
jmp    115c <strcat+0x5c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113f <strcat+0x3f>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <strcat+0x10>
mov    (%rsi),%dl
mov    %dl,-0x1(%rcx)
test   %dl,%dl
je     1142 <strcat+0x42>
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x1(%rsi,%rdx,1),%edi
mov    %dil,(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1130 <strcat+0x30>
ret

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

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %1
store i8 %9, i8* %4
%10 = icmp eq i8 %9, 0
br i1 %10, label %18, label %11
11: ; preds = %8, %11
%12 = phi i8* [ %14, %11 ], [ %4, %8 ]
%13 = phi i8* [ %15, %11 ], [ %1, %8 ]
%14 = getelementptr inbounds i8, i8* %12, i64 1
%15 = getelementptr inbounds i8, i8* %13, i64 1
%16 = load i8, i8* %15
store i8 %16, i8* %14
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %11
18: ; preds = %11, %8
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
int main() {
  int x;
  x = 0x45678912 | (0x01 << 5);
  f(x);
  x = 0x12345678 & ~(0x01 << 3);
  f(x);
  x = 0xAB12ED23 ^ (0x01 << 2);
  f(x);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x45678932,%edi
call   1030 <f@plt>
mov    $0x12345670,%edi
call   1030 <f@plt>
mov    $0xab12ed27,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1164413234, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @f(i32 %3)
store i32 305419888, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @f(i32 %5)
store i32 -1424823001, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @f(i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 1164413234)
%2 = tail call i32 @f(i32 305419888)
%3 = tail call i32 @f(i32 -1424823001)
ret i32 0
}
int bin_coeff_off(int n, int k) {
  int np = n - 3;
  return ((np * np) / 4) + (k - 2);
}


x86 assembly (clang, -O0):
<bin_coeff_off>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_coeff_off>:
add    $0xfffffffd,%edi
imul   %edi,%edi
shr    $0x2,%edi
lea    (%rsi,%rdi,1),%eax
add    $0xfffffffe,%eax
ret

LLVM IR (-O0):
define i32 @bin_coeff_off(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = sub nsw i32 %6, 3
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = load i32, i32* %5
%10 = mul nsw i32 %8, %9
%11 = sdiv i32 %10, 4
%12 = load i32, i32* %4
%13 = sub nsw i32 %12, 2
%14 = add nsw i32 %11, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @bin_coeff_off(i32 %0, i32 %1) {
%3 = add nsw i32 %0, -3
%4 = mul nsw i32 %3, %3
%5 = lshr i32 %4, 2
%6 = add nsw i32 %1, -2
%7 = add nsw i32 %6, %5
ret i32 %7
}
void test_libsym2_1(void) {}


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

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

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

LLVM IR (-O2):
define void @test_libsym2_1() {
ret void
}
void free_buffer(unsigned long *restrict *restrict buffer, unsigned long n) {
  unsigned long i;
  for (i = 0; i < n; i++)
    free(buffer[i]);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-qual"
  free((unsigned long **)buffer);
#pragma GCC diagnostic pop
}


x86 assembly (clang, -O0):
<free_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1158 <free_buffer+0x48>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <free_buffer+0x18>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @free_buffer(i64** noalias %0, i64 %1) {
%3 = alloca i64**
%4 = alloca i64
%5 = alloca i64
store i64** %0, i64*** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %16, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %19
10: ; preds = %6
%11 = load i64**, i64*** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds i64*, i64** %11, i64 %12
%14 = load i64*, i64** %13
%15 = bitcast i64* %14 to i8*
br label %16
16: ; preds = %10
%17 = load i64, i64* %5
%18 = add i64 %17, 1
store i64 %18, i64* %5
br label %6
19: ; preds = %6
%20 = load i64**, i64*** %3
%21 = bitcast i64** %20 to i8*
ret void
}

LLVM IR (-O2):
define void @free_buffer(i64** noalias nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %11, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %9, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i64*, i64** %0, i64 %5
%7 = bitcast i64** %6 to i8**
%8 = load i8*, i8** %7
tail call void @free(i8* %8)
%9 = add nuw i64 %5, 1
%10 = icmp eq i64 %9, %1
br i1 %10, label %11, label %4
11: ; preds = %4, %2
%12 = bitcast i64** %0 to i8*
tail call void @free(i8* %12)
ret void
}
int DMA_Wait(unsigned int Channel) {
  if (Channel > 14)
    return 1;
  while ((*(volatile int *)((volatile void *)(0x20007000) + (Channel)*0x100 +
                            0x00) &
          (1 << 2 | 1 << 8)) == 0)
    ;
  if (*(volatile int *)((volatile void *)(0x20007000) + (Channel)*0x100 +
                        0x00) &
      1 << 8)
    return 2;
}


x86 assembly (clang, -O0):
<DMA_Wait>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xe,-0x8(%rbp)
jbe    111d <DMA_Wait+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    116e <DMA_Wait+0x6e>
jmp    1122 <DMA_Wait+0x22>
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x20007000,%eax
mov    (%rax,%rcx,1),%eax
and    $0x104,%eax
cmp    $0x0,%eax
jne    1147 <DMA_Wait+0x47>
jmp    1122 <DMA_Wait+0x22>
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x20007000,%eax
mov    (%rax,%rcx,1),%eax
and    $0x100,%eax
cmp    $0x0,%eax
je     116e <DMA_Wait+0x6e>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DMA_Wait>:
mov    $0x1,%eax
cmp    $0xe,%edi
ja     1127 <DMA_Wait+0x27>
mov    %edi,%eax
shl    $0x8,%rax
testl  $0x104,0x20007000(%rax)
je     1110 <DMA_Wait+0x10>
mov    0x20007000(%rax),%eax
mov    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @DMA_Wait(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ugt i32 %4, 14
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %30
7: ; preds = %1
br label %8
8: ; preds = %18, %7
%9 = load i32, i32* %3
%10 = mul i32 %9, 256
%11 = zext i32 %10 to i64
%12 = getelementptr i8, i8* inttoptr (i64 536899584 to i8*), i64 %11
%13 = getelementptr i8, i8* %12, i64 0
%14 = bitcast i8* %13 to i32*
%15 = load volatile i32, i32* %14
%16 = and i32 %15, 260
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %8
br label %8
19: ; preds = %8
%20 = load i32, i32* %3
%21 = mul i32 %20, 256
%22 = zext i32 %21 to i64
%23 = getelementptr i8, i8* inttoptr (i64 536899584 to i8*), i64 %22
%24 = getelementptr i8, i8* %23, i64 0
%25 = bitcast i8* %24 to i32*
%26 = load volatile i32, i32* %25
%27 = and i32 %26, 256
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %19
store i32 2, i32* %2
br label %30
30: ; preds = %6, %29, %19
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @DMA_Wait(i32 %0) {
%2 = icmp ugt i32 %0, 14
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl nuw nsw i32 %0, 8
%5 = zext i32 %4 to i64
%6 = getelementptr i8, i8* inttoptr (i64 536899584 to i8*), i64 %5
%7 = bitcast i8* %6 to i32*
br label %8
8: ; preds = %3, %8
%9 = load volatile i32, i32* %7
%10 = and i32 %9, 260
%11 = icmp eq i32 %10, 0
br i1 %11, label %8, label %12
12: ; preds = %8
%13 = load volatile i32, i32* %7
br label %14
14: ; preds = %12, %1
%15 = phi i32 [ 1, %1 ], [ 2, %12 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ TEMP_main(int, char **);
int main(int argc, char *argv[]) {
  TEMP_main(argc, argv);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @TEMP_main(i32 %0, i8** %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ pdump(int);
int /*<<< orphan*/ printf(char *);
extern void policy_URL(int len) {
  printf("\t\tURL - ");
  pdump(len);
  printf("\n");
}


x86 assembly (clang, -O0):
<policy_URL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <pdump@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<policy_URL>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
mov    %ebx,%edi
call   1050 <pdump@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"\09\09URL - \00"
define void @policy_URL(i32 %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @pdump(i32 %0)
%4 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int bar_1();
__attribute__((no)) int bar(void) { return bar_1(); }


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

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

LLVM IR (-O0):
define i32 @bar() {
%1 = call i32 (...) @bar_1()
ret i32 %1
}

LLVM IR (-O2):
define i32 @bar() {
%1 = tail call i32 (...) @bar_1()
ret i32 %1
}
void fe_svc(void) {}


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

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

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

LLVM IR (-O2):
define void @fe_svc() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int shutdown(int fd, int how) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<shutdown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shutdown>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @shutdown(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @shutdown(i32 %0, i32 %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
char *hash_plugin_detailed(void) {
  return ("null - A NULL\n"
          "------------------------\n"
          "This plugin does nothing. It can be used fo performance tests"
          "\nAuthor: Milen Rangelov <gat3way@gat3way.eu>\n");
}


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

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

LLVM IR (-O0):
@.str = [146 x i8] c"null - A NULL\0A------------------------\0AThis plugin does nothing. It can be used fo performance tests\0AAuthor: Milen Rangelov <gat3way@gat3way.eu>\0A\00"
define i8* @hash_plugin_detailed() {
ret i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [146 x i8] c"null - A NULL\0A------------------------\0AThis plugin does nothing. It can be used fo performance tests\0AAuthor: Milen Rangelov <gat3way@gat3way.eu>\0A\00"
define i8* @hash_plugin_detailed() {
ret i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str, i64 0, i64 0)
}
int EVAL_game_progress(short material[2]) {
  const int m_hi = 2 * (195 + 2 * 100 + 65);
  const int m_lo = 2 * (2 * 65);
  const int sum_material = material[0] + material[1];
  if (sum_material > m_hi) {
    return 256;
  } else if (sum_material < m_lo) {
    return 0;
  } else {
    return 256 * (sum_material - m_lo) / (m_hi - m_lo);
  }
}


x86 assembly (clang, -O0):
<EVAL_game_progress>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x398,-0x14(%rbp)
movl   $0x104,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movswl (%rax),%eax
mov    -0x10(%rbp),%rcx
movswl 0x2(%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x398,-0x1c(%rbp)
jle    1143 <EVAL_game_progress+0x43>
movl   $0x100,-0x4(%rbp)
jmp    1172 <EVAL_game_progress+0x72>
cmpl   $0x104,-0x1c(%rbp)
jge    115c <EVAL_game_progress+0x5c>
movl   $0x0,-0x4(%rbp)
jmp    1172 <EVAL_game_progress+0x72>
mov    -0x1c(%rbp),%eax
sub    $0x104,%eax
shl    $0x8,%eax
mov    $0x294,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<EVAL_game_progress>:
movswl (%rdi),%eax
movswl 0x2(%rdi),%ecx
add    %eax,%ecx
mov    $0x100,%eax
cmp    $0x398,%ecx
jg     1134 <EVAL_game_progress+0x34>
xor    %eax,%eax
cmp    $0x104,%ecx
jl     1134 <EVAL_game_progress+0x34>
shl    $0x8,%ecx
add    $0xfffefc00,%ecx
imul   $0x634c0635,%rcx,%rax
shr    $0x28,%rax
ret

LLVM IR (-O0):
define i32 @EVAL_game_progress(i16* %0) {
%2 = alloca i32
%3 = alloca i16*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i16* %0, i16** %3
store i32 920, i32* %4
store i32 260, i32* %5
%7 = load i16*, i16** %3
%8 = getelementptr inbounds i16, i16* %7, i64 0
%9 = load i16, i16* %8
%10 = sext i16 %9 to i32
%11 = load i16*, i16** %3
%12 = getelementptr inbounds i16, i16* %11, i64 1
%13 = load i16, i16* %12
%14 = sext i16 %13 to i32
%15 = add nsw i32 %10, %14
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 920
br i1 %17, label %18, label %19
18: ; preds = %1
store i32 256, i32* %2
br label %28
19: ; preds = %1
%20 = load i32, i32* %6
%21 = icmp slt i32 %20, 260
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 0, i32* %2
br label %28
23: ; preds = %19
%24 = load i32, i32* %6
%25 = sub nsw i32 %24, 260
%26 = mul nsw i32 256, %25
%27 = sdiv i32 %26, 660
store i32 %27, i32* %2
br label %28
28: ; preds = %23, %22, %18
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @EVAL_game_progress(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = sext i16 %2 to i32
%4 = getelementptr inbounds i16, i16* %0, i64 1
%5 = load i16, i16* %4
%6 = sext i16 %5 to i32
%7 = add nsw i32 %6, %3
%8 = icmp sgt i32 %7, 920
br i1 %8, label %15, label %9
9: ; preds = %1
%10 = icmp slt i32 %7, 260
br i1 %10, label %15, label %11
11: ; preds = %9
%12 = shl nuw nsw i32 %7, 8
%13 = add nsw i32 %12, -66560
%14 = udiv i32 %13, 660
br label %15
15: ; preds = %9, %1, %11
%16 = phi i32 [ %14, %11 ], [ 256, %1 ], [ 0, %9 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello, C World! ");
  foo();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Hello, C World! \00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @foo()
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Hello, C World! \00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @foo()
ret i32 0
}
double topocentric_right_ascension(double alpha_deg, double delta_alpha) {
  return alpha_deg + delta_alpha;
}


x86 assembly (clang, -O0):
<topocentric_right_ascension>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<topocentric_right_ascension>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @topocentric_right_ascension(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @topocentric_right_ascension(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ adc16(int /*<<< orphan*/);
int /*<<< orphan*/ indirectly();
int /*<<< orphan*/ readmemw65816(int /*<<< orphan*/);
void adcIndirectLongy16(void) { adc16(readmemw65816(indirectly())); }


x86 assembly (clang, -O0):
<adcIndirectLongy16>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <indirectly@plt>
mov    %eax,%edi
call   1030 <readmemw65816@plt>
mov    %eax,%edi
call   1050 <adc16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<adcIndirectLongy16>:
push   %rax
xor    %eax,%eax
call   1040 <indirectly@plt>
mov    %eax,%edi
call   1030 <readmemw65816@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <adc16@plt>

LLVM IR (-O0):
define void @adcIndirectLongy16() {
%1 = call i32 (...) @indirectly()
%2 = call i32 @readmemw65816(i32 %1)
%3 = call i32 @adc16(i32 %2)
ret void
}

LLVM IR (-O2):
define void @adcIndirectLongy16() {
%1 = tail call i32 (...) @indirectly()
%2 = tail call i32 @readmemw65816(i32 %1)
%3 = tail call i32 @adc16(i32 %2)
ret void
}
/* Variables and functions */
double avg(double, double);
double pcnt(double a, double b) { return avg(100.0 * a, b); }


x86 assembly (clang, -O0):
<pcnt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xed6(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <avg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcnt>:
mulsd  0xee8(%rip),%xmm0
jmp    1030 <avg@plt>

LLVM IR (-O0):
define double @pcnt(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fmul double 1.000000e+02, %5
%7 = load double, double* %4
%8 = call double @avg(double %6, double %7)
ret double %8
}

LLVM IR (-O2):
define double @pcnt(double %0, double %1) {
%3 = fmul double %0, 1.000000e+02
%4 = tail call double @avg(double %3, double %1)
ret double %4
}
main() {
  int i;
  i = 3;
  _Alignof(int);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int strcmp(char const *s1, char const *s2) {
  while (*s1 && *s1 == *s2)
    s1++, s2++;
  return *s1 - *s2;
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1137 <strcmp+0x37>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1147 <strcmp+0x47>
jmp    1164 <strcmp+0x64>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <strcmp+0xc>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
mov    (%rdi),%al
test   %al,%al
je     1123 <strcmp+0x23>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
cmp    (%rsi),%al
jne    1125 <strcmp+0x25>
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <strcmp+0x10>
xor    %eax,%eax
movsbl %al,%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %7
%10 = icmp eq i8 %6, %9
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %11, %2
%17 = phi i8* [ %1, %2 ], [ %13, %11 ], [ %7, %5 ]
%18 = phi i8 [ 0, %2 ], [ 0, %11 ], [ %6, %5 ]
%19 = sext i8 %18 to i32
%20 = load i8, i8* %17
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %19, %21
ret i32 %22
}
/* Type definitions */
struct testbench_time_unit {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprint_testbench_values(int /*<<< orphan*/, char const *,
                                           struct testbench_time_unit const *);
int /*<<< orphan*/ stdout;
void print_testbench_values(const char *title,
                            const struct testbench_time_unit *unit) {
  fprint_testbench_values(stdout, title, unit);
}


x86 assembly (clang, -O0):
<print_testbench_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <fprint_testbench_values@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_testbench_values>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fprint_testbench_values@plt>

LLVM IR (-O0):
%struct.testbench_time_unit = type { i32 }
@stdout = global i32 0
define void @print_testbench_values(i8* %0, %struct.testbench_time_unit* %1) {
%3 = alloca i8*
%4 = alloca %struct.testbench_time_unit*
store i8* %0, i8** %3
store %struct.testbench_time_unit* %1, %struct.testbench_time_unit** %4
%5 = load i32, i32* @stdout
%6 = load i8*, i8** %3
%7 = load %struct.testbench_time_unit*, %struct.testbench_time_unit** %4
%8 = call i32 @fprint_testbench_values(i32 %5, i8* %6, %struct.testbench_time_unit* %7)
ret void
}

LLVM IR (-O2):
%struct.testbench_time_unit = type { i32 }
@stdout = global i32 0
define void @print_testbench_values(i8* %0, %struct.testbench_time_unit* %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprint_testbench_values(i32 %3, i8* %0, %struct.testbench_time_unit* %1)
ret void
}
/* Variables and functions */
scalar_t__ bar();
scalar_t__ foo1();
scalar_t__ foo2();
int /*<<< orphan*/ printf(char *);
int main() {
  if (bar() == 0 && foo1() == 0 && foo2() == 0)
    printf("PASS\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bar@plt>
cmp    $0x0,%rax
jne    118e <main+0x4e>
mov    $0x0,%al
call   1060 <foo1@plt>
cmp    $0x0,%rax
jne    118e <main+0x4e>
mov    $0x0,%al
call   1050 <foo2@plt>
cmp    $0x0,%rax
jne    118e <main+0x4e>
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <bar@plt>
test   %rax,%rax
jne    1171 <main+0x31>
xor    %eax,%eax
call   1060 <foo1@plt>
test   %rax,%rax
jne    1171 <main+0x31>
xor    %eax,%eax
call   1050 <foo2@plt>
test   %rax,%rax
jne    1171 <main+0x31>
lea    0xe94(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [5 x i8] c"PASS\00"
define i32 @main() {
%1 = tail call i64 (...) @bar()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %11
3: ; preds = %0
%4 = tail call i64 (...) @foo1()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = tail call i64 (...) @foo2()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %6, %3, %0
ret i32 0
}
/* Variables and functions */
scalar_t__ strchr(char const *const, char);
int is_whitespace(char c) {
  static const char *const whitespace_chars = " \t\n\r\f";
  return strchr(whitespace_chars, c) ? 1 : 0;
}


x86 assembly (clang, -O0):
<is_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_whitespace>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <strchr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@is_whitespace.whitespace_chars = internal constant i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0)
@.str = [6 x i8] c" \09\0A\0D\0C\00"
define i32 @is_whitespace(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8 signext %3)
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 1, i32 0
ret i32 %7
}

LLVM IR (-O2):
@.str = [6 x i8] c" \09\0A\0D\0C\00"
define i32 @is_whitespace(i8 signext %0) {
%2 = tail call i64 @strchr(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ fread(int /*<<< orphan*/ *, int, int, int /*<<< orphan*/ *);
int32_t get32(FILE *in, int32_t *p) {
  if (fread(p, sizeof(*p), 1, in))
    ;
  return *p;
}


x86 assembly (clang, -O0):
<get32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
cmp    $0x0,%rax
je     1146 <get32+0x36>
jmp    1146 <get32+0x36>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get32>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rcx
mov    %rsi,%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1030 <fread@plt>
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get32(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 = call i64 @fread(i32* %5, i32 4, i32 1, i32* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
br label %10
10: ; preds = %9, %2
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @get32(i32* nocapture %0, i32* nocapture %1) {
%3 = tail call i64 @fread(i32* %1, i32 4, i32 1, i32* %0)
%4 = load i32, i32* %1
ret i32 %4
}