xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ malloc(int const);
int math_min(int const, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char *, int const);
int /*<<< orphan*/ strlen(char *);
char *string_malloc(char *source, const int max_size) {
  const int destination_size = math_min(max_size, strlen(source));
  char *destination = (char *)malloc(destination_size + 1);
  memcpy(destination, source, destination_size);
  destination[destination_size] = '\0';
  return destination;
}


x86 assembly (clang, -O0):
<string_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1050 <math_min@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
add    $0x1,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_malloc>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <math_min@plt>
mov    %eax,%ebp
lea    0x1(%rbp),%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
movslq %ebp,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @string_malloc(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @math_min(i32 %7, i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = add nsw i32 %11, 1
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %6
%15 = load i8*, i8** %6
%16 = load i8*, i8** %3
%17 = load i32, i32* %5
%18 = call i32 @memcpy(i8* %15, i8* %16, i32 %17)
%19 = load i8*, i8** %6
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 0, i8* %22
%23 = load i8*, i8** %6
ret i8* %23
}

LLVM IR (-O2):
define i8* @string_malloc(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @math_min(i32 %1, i32 %3)
%5 = add nsw i32 %4, 1
%6 = tail call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @memcpy(i8* %7, i8* %0, i32 %4)
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
store i8 0, i8* %10
ret i8* %7
}
void pinmux_generic_free_functions(struct pinctrl_dev *pctldev) {}


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

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

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

LLVM IR (-O2):
%struct.pinctrl_dev = type opaque
define void @pinmux_generic_free_functions(%struct.pinctrl_dev* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void T1() {
  printf("F\n");
  printf("A\n");
}


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

x86 assembly (clang, -O2):
<T1>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xede(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"F\0A\00"
@.str.1 = [3 x i8] c"A\0A\00"
define void @T1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [2 x i8] c"F\00"
@str.2 = [2 x i8] c"A\00"
define void @T1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void s_free(void *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<s_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @s_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
unsigned epx_generic_output_fmts(unsigned input_fmts) { return input_fmts; }


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

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

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

LLVM IR (-O2):
define i32 @epx_generic_output_fmts(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int uint8_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint8_t mem_addr_range_match(uint32_t addr, uint32_t start, uint32_t len) {
  if (addr < start)
    return 0;
  else if (addr >= (start + len))
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<mem_addr_range_match>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    112a <mem_addr_range_match+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1152 <mem_addr_range_match+0x52>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
add    -0x20(%rbp),%rcx
cmp    %rcx,%rax
jl     114b <mem_addr_range_match+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    1152 <mem_addr_range_match+0x52>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_addr_range_match>:
cmp    %rsi,%rdi
setge  %al
add    %rsi,%rdx
cmp    %rdi,%rdx
setg   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @mem_addr_range_match(i64 %0, i64 %1, i64 %2) {
%4 = icmp sge i64 %0, %1
%5 = add nsw i64 %2, %1
%6 = icmp sgt i64 %5, %0
%7 = select i1 %4, i1 %6, i1 false
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;

/* Variables and functions */
void bar_write8(uint32_t bar, uint32_t offset, uint8_t value) {
  volatile uint8_t *preg = (volatile uint8_t *)(bar | (offset & 0xFF));
  *preg = value;
}


x86 assembly (clang, -O0):
<bar_write8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
and    $0xff,%ecx
or     %ecx,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar_write8>:
movzbl %sil,%eax
or     %edi,%eax
cltq
mov    %edx,(%rax)
ret

LLVM IR (-O0):
define void @bar_write8(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
%9 = load i32, i32* %5
%10 = and i32 %9, 255
%11 = or i32 %8, %10
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %7
%14 = load i32, i32* %6
%15 = load i32*, i32** %7
store volatile i32 %14, i32* %15
ret void
}

LLVM IR (-O2):
define void @bar_write8(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %1, 255
%5 = or i32 %4, %0
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
store volatile i32 %2, i32* %7
ret void
}
int main() {
  int global[10];
  global[0] = 0;
  int i;
  i = 0;
  while (i < 10) {
    global[i] = i;
    i = i + 1;
  }
  return i + 12;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    113c <main+0x3c>
mov    -0x34(%rbp),%ecx
movslq -0x34(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1119 <main+0x19>
mov    -0x34(%rbp),%eax
add    $0xc,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 22
}
/* Variables and functions */
void stub1(int, int);
void testClosureIIrV(void (*closure)(int, int), int a1, int a2) {
  if (closure != NULL)
    (*closure)(a1, a2);
}


x86 assembly (clang, -O0):
<testClosureIIrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1129 <testClosureIIrV+0x29>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureIIrV>:
test   %rdi,%rdi
je     110e <testClosureIIrV+0xe>
mov    %rdi,%rax
mov    %esi,%edi
mov    %edx,%esi
jmp    *%rax
ret

LLVM IR (-O0):
define void @testClosureIIrV(void (i32, i32)* %0, i32 %1, i32 %2) {
%4 = alloca void (i32, i32)*
%5 = alloca i32
%6 = alloca i32
store void (i32, i32)* %0, void (i32, i32)** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load void (i32, i32)*, void (i32, i32)** %4
%8 = icmp ne void (i32, i32)* %7, null
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load void (i32, i32)*, void (i32, i32)** %4
%11 = load i32, i32* %5
%12 = load i32, i32* %6
br label %13
13: ; preds = %9, %3
ret void
}

LLVM IR (-O2):
define void @testClosureIIrV(void (i32, i32)* %0, i32 %1, i32 %2) {
%4 = icmp eq void (i32, i32)* %0, null
br i1 %4, label %6, label %5
5: ; preds = %3
tail call void %0(i32 %1, i32 %2)
br label %6
6: ; preds = %5, %3
ret void
}
/* Type definitions */
struct KeywordExtractor {
  int dummy;
};

/* Variables and functions */
struct KeywordExtractor *NewKeywordExtractor(char const *, char const *,
                                             char const *, char const *);
struct KeywordExtractor *key_engine(const char *dict_path, const char *hmm_path,
                                    const char *idf_path,
                                    const char *stop_path) {
  return NewKeywordExtractor(dict_path, hmm_path, idf_path, stop_path);
}


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

x86 assembly (clang, -O2):
<key_engine>:
jmp    1030 <NewKeywordExtractor@plt>

LLVM IR (-O0):
%struct.KeywordExtractor = type { i32 }
define %struct.KeywordExtractor* @key_engine(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
%13 = call %struct.KeywordExtractor* @NewKeywordExtractor(i8* %9, i8* %10, i8* %11, i8* %12)
ret %struct.KeywordExtractor* %13
}

LLVM IR (-O2):
%struct.KeywordExtractor = type { i32 }
define %struct.KeywordExtractor* @key_engine(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call %struct.KeywordExtractor* @NewKeywordExtractor(i8* %0, i8* %1, i8* %2, i8* %3)
ret %struct.KeywordExtractor* %5
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ rax;

/* Variables and functions */
int /*<<< orphan*/ cpuid(int, int *, int *, int *, int *);
bool cpuid_perf_global_ctrl_EN_FIXED_CTRnum() {
  uint64_t rax, rbx, rcx, rdx;
  int leaf = 10;
  cpuid(leaf, &rax, &rbx, &rcx, &rdx);
  if ((((uint64_t)(rax) &
        ((((uint64_t)1 << (((7)) - ((0)) + 1)) - 1) << ((0)))) >>
       (0)) > 1) {
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<cpuid_perf_global_ctrl_EN_FIXED_CTRnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0xa,-0x18(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <cpuid@plt>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
sar    $0x0,%eax
cmp    $0x1,%eax
jle    1157 <cpuid_perf_global_ctrl_EN_FIXED_CTRnum+0x47>
movl   $0x1,-0x4(%rbp)
jmp    115e <cpuid_perf_global_ctrl_EN_FIXED_CTRnum+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_perf_global_ctrl_EN_FIXED_CTRnum>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    $0xa,%edi
call   1030 <cpuid@plt>
xor    %eax,%eax
testb  $0xfe,0x8(%rsp)
setne  %al
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @cpuid_perf_global_ctrl_EN_FIXED_CTRnum() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 10, i32* %6
%7 = load i32, i32* %6
%8 = call i32 @cpuid(i32 %7, i32* %2, i32* %3, i32* %4, i32* %5)
%9 = load i32, i32* %2
%10 = and i32 %9, 255
%11 = ashr i32 %10, 0
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %0
store i32 1, i32* %1
br label %15
14: ; preds = %0
store i32 0, i32* %1
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
define i32 @cpuid_perf_global_ctrl_EN_FIXED_CTRnum() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @cpuid(i32 10, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %1
%11 = and i32 %10, 254
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ target_set_closest(int);
void do_cmd_target_closest(void) { target_set_closest(0x01); }


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

x86 assembly (clang, -O2):
<do_cmd_target_closest>:
mov    $0x1,%edi
jmp    1030 <target_set_closest@plt>

LLVM IR (-O0):
define void @do_cmd_target_closest() {
%1 = call i32 @target_set_closest(i32 1)
ret void
}

LLVM IR (-O2):
define void @do_cmd_target_closest() {
%1 = tail call i32 @target_set_closest(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __builtin_arm_wsr64(char *, unsigned long);
void wsr64_3(unsigned long v) { __builtin_arm_wsr64("0:1:2", v); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"0:1:2\00"
define void @wsr64_3(i64 %0) {
%2 = tail call i32 @__builtin_arm_wsr64(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %0)
ret void
}
int getsrvaddress(char *host, int *port, char *srv, int proto,
                  struct addrinfo *res) {
  return 0;
}


x86 assembly (clang, -O0):
<getsrvaddress>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.addrinfo = type opaque
define i32 @getsrvaddress(i8* nocapture readnone %0, i32* nocapture readnone %1, i8* nocapture readnone %2, i32 %3, %struct.addrinfo* nocapture readnone %4) {
ret i32 0
}
/* Variables and functions */
void *heap_init(size_t size) { return NULL; }


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

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

LLVM IR (-O0):
define i8* @heap_init(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @heap_init(i64 %0) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ MIDI_SetUserChannelVolume(int, int);
void MUSIC_SetMidiChannelVolume(int channel, int volume) {
  MIDI_SetUserChannelVolume(channel, volume);
}


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

x86 assembly (clang, -O2):
<MUSIC_SetMidiChannelVolume>:
jmp    1030 <MIDI_SetUserChannelVolume@plt>

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

LLVM IR (-O2):
define void @MUSIC_SetMidiChannelVolume(i32 %0, i32 %1) {
%3 = tail call i32 @MIDI_SetUserChannelVolume(i32 %0, i32 %1)
ret void
}
int BTSHASP_CalcLinenum(char *ptr) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @BTSHASP_CalcLinenum(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello() { printf("Hello\n"); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"Hello\0A\00"
define void @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"Hello\00"
define void @hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putch3(int /*<<< orphan*/);
void puts0(char *s) {
  while (*s)
    putch3(*s++);
}


x86 assembly (clang, -O0):
<puts0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <puts0+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <putch3@plt>
jmp    111c <puts0+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts0>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <puts0+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putch3@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <puts0+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @puts0(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @putch3(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
unsigned long IsSameString(const char *string1, const char *string2) {
  return (0 == strcmp(string1, string2));
}


x86 assembly (clang, -O0):
<IsSameString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsSameString>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @IsSameString(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i64 @strcmp(i8* %5, i8* %6)
%8 = icmp eq i64 0, %7
%9 = zext i1 %8 to i32
%10 = sext i32 %9 to i64
ret i64 %10
}

LLVM IR (-O2):
define i64 @IsSameString(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i64
ret i64 %5
}
int filho_direita(int n) { return 2 * n + 1; }


x86 assembly (clang, -O0):
<filho_direita>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<filho_direita>:
lea    (%rdi,%rdi,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @filho_direita(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = or i32 %2, 1
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void store_le64_aligned(uint8_t *dst, const uint64_t v) {
  *((uint64_t *)dst) = (v);
}


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

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

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

LLVM IR (-O2):
define void @store_le64_aligned(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
ret void
}
int test_imm_5Fuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x5F << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_5Fuint64_lowword_reg>:
test   $0x5f,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_5Fuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 95
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int test_imm_DCint64_lowword_reg(long long val) {
  return ((val) & (0xDC << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_DCint64_lowword_reg>:
test   $0xdc,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_DCint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 220
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printN2(int n) {
  if (n) {
    printN2(n - 1);
    printf("%d\t", n);
  }
}


x86 assembly (clang, -O0):
<printN2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114f <printN2+0x2f>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <printN2@plt>
mov    -0x4(%rbp),%esi
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printN2>:
test   %edi,%edi
je     113e <printN2+0x1e>
push   %rbx
mov    %edi,%ebx
lea    -0x1(%rbx),%edi
call   1030 <printN2@plt>
lea    0xeca(%rip),%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1040 <printf@plt>
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\09\00"
define void @printN2(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 %10
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 %6, 1
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @printN2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %4
3: ; preds = %1, %4
ret void
4: ; preds = %1
%5 = add nsw i32 %0, -1
tail call void @printN2(i32 %5)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %3
}
char *arp_operation(unsigned char id) {
  switch (id) {
  case 1:
    return ("request");
  case 2:
    return ("reply");
  }
  return ("UNKNOWN");
}


x86 assembly (clang, -O0):
<arp_operation>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     1130 <arp_operation+0x30>
jmp    111f <arp_operation+0x1f>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     1140 <arp_operation+0x40>
jmp    1150 <arp_operation+0x50>
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    115b <arp_operation+0x5b>
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    115b <arp_operation+0x5b>
lea    0xeb7(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<arp_operation>:
cmp    $0x2,%dil
lea    0xefd(%rip),%rax
lea    0xefc(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x1,%dil
lea    0xedf(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"request\00"
@.str.1 = [6 x i8] c"reply\00"
@.str.2 = [8 x i8] c"UNKNOWN\00"
define i8* @arp_operation(i8 zeroext %0) {
%2 = alloca i8*
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
switch i32 %5, label %8 [
i32 1, label %6
i32 2, label %7
]
6: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
7: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7, %6
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [8 x i8] c"request\00"
@.str.1 = [6 x i8] c"reply\00"
@.str.2 = [8 x i8] c"UNKNOWN\00"
define i8* @arp_operation(i8 zeroext %0) {
%2 = icmp eq i8 %0, 2
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%4 = icmp eq i8 %0, 1
%5 = select i1 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
double drandNorm(void) { return ((double)rand() / (double)RAND_MAX); }


x86 assembly (clang, -O0):
<drandNorm>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<drandNorm>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @drandNorm() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @drandNorm() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
void Cyc_SIG_IGN(int ignore) { return; }


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

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

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

LLVM IR (-O2):
define void @Cyc_SIG_IGN(i32 %0) {
ret void
}
/* Variables and functions */
size_t CountBitsInLong(void) {
  size_t count = 0;
  unsigned long bits = (unsigned long)-1;
  while (bits > 0) {
    bits >>= 1;
    ++count;
  }
  return count;
}


x86 assembly (clang, -O0):
<CountBitsInLong>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
movq   $0xffffffffffffffff,-0x10(%rbp)
ff
cmpq   $0x0,-0x10(%rbp)
jbe    113c <CountBitsInLong+0x3c>
mov    -0x10(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <CountBitsInLong+0x14>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @CountBitsInLong() {
%1 = alloca i64
%2 = alloca i64
store i64 0, i64* %1
store i64 -1, i64* %2
br label %3
3: ; preds = %6, %0
%4 = load i64, i64* %2
%5 = icmp ugt i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i64, i64* %2
%8 = lshr i64 %7, 1
store i64 %8, i64* %2
%9 = load i64, i64* %1
%10 = add i64 %9, 1
store i64 %10, i64* %1
br label %3
11: ; preds = %3
%12 = load i64, i64* %1
ret i64 %12
}

LLVM IR (-O2):
define i64 @CountBitsInLong() {
ret i64 64
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void dump(int *arr, int size) {
  int idx;
  for (idx = 0; idx < size; idx++)
    printf("%08d\n", arr[idx]);
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <dump+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <dump+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <dump+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <dump+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%08d\0A\00"
define void @dump(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%08d\0A\00"
define void @dump(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "usage: mkmovie [-d output_dir] [-b output_basename] inputfile\n");
  exit(EXIT_FAILURE);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [63 x i8] c"usage: mkmovie [-d output_dir] [-b output_basename] inputfile\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [63 x i8] c"usage: mkmovie [-d output_dir] [-b output_basename] inputfile\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
void multidim_arr5_Good() {
  int a[1][10];
  a[0][0] = 0;
  a[0][5] = 0;
}


x86 assembly (clang, -O0):
<multidim_arr5_Good>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @multidim_arr5_Good() {
%1 = alloca [1 x [10 x i32]]
%2 = getelementptr inbounds [1 x [10 x i32]], [1 x [10 x i32]]* %1, i64 0, i64 0
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
store i32 0, i32* %3
%4 = getelementptr inbounds [1 x [10 x i32]], [1 x [10 x i32]]* %1, i64 0, i64 0
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %4, i64 0, i64 5
store i32 0, i32* %5
ret void
}

LLVM IR (-O2):
define void @multidim_arr5_Good() {
ret void
}
char *strcpy(char *dest, const char *src) {
  int d0, d1, d2;
  __asm__ __volatile__("cld\n"
                       "1:\tlodsb\n\t"
                       "stosb\n\t"
                       "testb %%al,%%al\n\t"
                       "jne 1b"
                       : "=&S"(d0), "=&D"(d1), "=&a"(d2)
                       : "0"(src), "1"(dest)
                       : "memory");
  return dest;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdi
cld
lods   %ds:(%rsi),%al
stos   %al,%es:(%rdi)
test   %al,%al
jne    1115 <strcpy+0x15>
mov    %esi,%ecx
mov    %ecx,-0x14(%rbp)
mov    %edi,%ecx
mov    %ecx,-0x18(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rcx
cld
lods   %ds:(%rsi),%al
stos   %al,%es:(%rdi)
test   %al,%al
jne    1104 <strcpy+0x4>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i8* @strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %4
%9 = load i8*, i8** %3
%10 = call { i8*, i8*, i32 } asm sideeffect "cld\0A1:\09lodsb\0A\09stosb\0A\09testb %al,%al\0A\09jne 1b", "=&{si},=&{di},=&{ax},0,1,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %8, i8* %9)
%11 = extractvalue { i8*, i8*, i32 } %10, 0
%12 = extractvalue { i8*, i8*, i32 } %10, 1
%13 = extractvalue { i8*, i8*, i32 } %10, 2
%14 = ptrtoint i8* %11 to i64
%15 = trunc i64 %14 to i32
store i32 %15, i32* %5
%16 = ptrtoint i8* %12 to i64
%17 = trunc i64 %16 to i32
store i32 %17, i32* %6
store i32 %13, i32* %7
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @strcpy(i8* returned %0, i8* %1) {
%3 = tail call { i8*, i8*, i32 } asm sideeffect "cld\0A1:\09lodsb\0A\09stosb\0A\09testb %al,%al\0A\09jne 1b", "=&{si},=&{di},=&{ax},0,1,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %1, i8* %0)
ret i8* %0
}
/* Variables and functions */
int sscanf(char *, char *);
int _check_TimeVal(char *string) {
  return ((sscanf(string, "%d") == 1) ? 1 : 0);
}


x86 assembly (clang, -O0):
<_check_TimeVal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <sscanf@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_TimeVal>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <sscanf@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @_check_TimeVal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sscanf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 1, i32 0
ret i32 %7
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @_check_TimeVal(i8* nocapture %0) {
%2 = tail call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int __get_cpuid(unsigned int, unsigned int *, unsigned int *, unsigned int *,
                unsigned int *);
int __attribute__((no))
__get_cpuid_output(unsigned int __level, unsigned int *__eax,
                   unsigned int *__ebx, unsigned int *__ecx,
                   unsigned int *__edx) {
  return __get_cpuid(__level, __eax, __ebx, __ecx, __edx);
}


x86 assembly (clang, -O0):
<__get_cpuid_output>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <__get_cpuid@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__get_cpuid_output>:
jmp    1030 <__get_cpuid@plt>

LLVM IR (-O0):
define i32 @__get_cpuid_output(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = load i32*, i32** %7
%13 = load i32*, i32** %8
%14 = load i32*, i32** %9
%15 = load i32*, i32** %10
%16 = call i32 @__get_cpuid(i32 %11, i32* %12, i32* %13, i32* %14, i32* %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @__get_cpuid_output(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = tail call i32 @__get_cpuid(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4)
ret i32 %6
}
/* Type definitions */
struct ipr_dev {
  int dummy;
};

/* Variables and functions */
int ipr_start_stop(struct ipr_dev *, int, char *);
int ipr_start_stop_stop(struct ipr_dev *dev) {
  return ipr_start_stop(dev, 0x00, "Stop Unit");
}


x86 assembly (clang, -O0):
<ipr_start_stop_stop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
lea    0xed7(%rip),%rdx
call   1030 <ipr_start_stop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipr_start_stop_stop>:
lea    0xee9(%rip),%rdx
xor    %esi,%esi
jmp    1030 <ipr_start_stop@plt>

LLVM IR (-O0):
%struct.ipr_dev = type { i32 }
@.str = [10 x i8] c"Stop Unit\00"
define i32 @ipr_start_stop_stop(%struct.ipr_dev* %0) {
%2 = alloca %struct.ipr_dev*
store %struct.ipr_dev* %0, %struct.ipr_dev** %2
%3 = load %struct.ipr_dev*, %struct.ipr_dev** %2
%4 = call i32 @ipr_start_stop(%struct.ipr_dev* %3, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
%struct.ipr_dev = type { i32 }
@.str = [10 x i8] c"Stop Unit\00"
define i32 @ipr_start_stop_stop(%struct.ipr_dev* %0) {
%2 = tail call i32 @ipr_start_stop(%struct.ipr_dev* %0, i32 0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Variables and functions */
int ioctl(int, unsigned int, long *);
int disk_get_size(int fd, long *size) {
  return ioctl(fd,
               (((0U) << (((0 + 8) + 8) + 14)) | (((0x12)) << (0 + 8)) |
                (((96)) << 0) | ((0) << ((0 + 8) + 8))),
               size);
}


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

x86 assembly (clang, -O2):
<disk_get_size>:
mov    %rsi,%rdx
mov    $0x1260,%esi
jmp    1030 <ioctl@plt>

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

LLVM IR (-O2):
define i32 @disk_get_size(i32 %0, i64* %1) {
%3 = tail call i32 @ioctl(i32 %0, i32 4704, i64* %1)
ret i32 %3
}
/* Variables and functions */
int odd(int);
int even(int x) {
  if (x == 0)
    return 1;
  else
    return odd(x - 1);
}


x86 assembly (clang, -O0):
<even>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <even+0x21>
movl   $0x1,-0x4(%rbp)
jmp    113f <even+0x2f>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <odd@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<even>:
test   %edi,%edi
je     111c <even+0xc>
add    $0xffffffff,%edi
jmp    1030 <odd@plt>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @even(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call i32 @odd(i32 %4)
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 1, %1 ]
ret i32 %7
}
void __attribute__((no)) bar(void) {}


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

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

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

LLVM IR (-O2):
define void @bar() {
ret void
}
/* Type definitions */
struct UPnPService {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
void RNDResponseSink_ContentDirectory_GetSearchCapabilities(
    struct UPnPService *Service, int ErrorCode, void *User, char *SearchCaps) {
  printf("RND Invoke Response: "
         "ContentDirectory/GetSearchCapabilities[ErrorCode:%d](%s)\r\n",
         ErrorCode, SearchCaps);
}


x86 assembly (clang, -O0):
<RNDResponseSink_ContentDirectory_GetSearchCapabilities>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RNDResponseSink_ContentDirectory_GetSearchCapabilities>:
lea    0xee9(%rip),%rdi
mov    %rcx,%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.UPnPService = type { i32 }
@.str = [80 x i8] c"RND Invoke Response: ContentDirectory/GetSearchCapabilities[ErrorCode:%d](%s)\0D\0A\00"
define void @RNDResponseSink_ContentDirectory_GetSearchCapabilities(%struct.UPnPService* %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca %struct.UPnPService*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store %struct.UPnPService* %0, %struct.UPnPService** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* %6
%10 = load i8*, i8** %8
%11 = call i32 @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %10)
ret void
}

LLVM IR (-O2):
%struct.UPnPService = type { i32 }
@.str = [80 x i8] c"RND Invoke Response: ContentDirectory/GetSearchCapabilities[ErrorCode:%d](%s)\0D\0A\00"
define void @RNDResponseSink_ContentDirectory_GetSearchCapabilities(%struct.UPnPService* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i8* %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0), i32 %1, i8* %3)
ret void
}