xunge/DecIR huggingface dataset:
unsigned int calc_hash(const char *str) {
  unsigned int hash = (int)*str;
  if (hash != 0)
    for (str += 1; str[0] != 0; str++)
      hash = (hash << 5) - hash + str[0];
  return hash;
}


x86 assembly (clang, -O0):
<calc_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1163 <calc_hash+0x63>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115e <calc_hash+0x5e>
mov    -0xc(%rbp),%eax
shl    $0x5,%eax
sub    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1128 <calc_hash+0x28>
jmp    1163 <calc_hash+0x63>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_hash>:
movsbl (%rdi),%ecx
test   %ecx,%ecx
je     1138 <calc_hash+0x38>
mov    0x1(%rdi),%dl
test   %dl,%dl
je     113b <calc_hash+0x3b>
add    $0x2,%rdi
mov    %ecx,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %dl,%edx
shl    $0x5,%eax
sub    %ecx,%eax
add    %edx,%eax
movzbl (%rdi),%edx
add    $0x1,%rdi
mov    %eax,%ecx
test   %dl,%dl
jne    1120 <calc_hash+0x20>
ret
xor    %eax,%eax
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @calc_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1
%5 = sext i8 %2 to i32
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %19, label %9
9: ; preds = %4, %9
%10 = phi i8 [ %17, %9 ], [ %7, %4 ]
%11 = phi i8* [ %16, %9 ], [ %6, %4 ]
%12 = phi i32 [ %15, %9 ], [ %5, %4 ]
%13 = sext i8 %10 to i32
%14 = mul i32 %12, 31
%15 = add i32 %14, %13
%16 = getelementptr inbounds i8, i8* %11, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %9
19: ; preds = %9, %4, %1
%20 = phi i32 [ 0, %1 ], [ %5, %4 ], [ %15, %9 ]
ret i32 %20
}
int inc_int(char *opt, char *optarg, void *arg) {
  (*((int *)arg))++;
  return 0;
}


x86 assembly (clang, -O0):
<inc_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc_int>:
addl   $0x1,(%rdx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @inc_int(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = bitcast i8* %7 to i32*
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @inc_int(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture %2) {
%4 = bitcast i8* %2 to i32*
%5 = load i32, i32* %4
%6 = add nsw i32 %5, 1
store i32 %6, i32* %4
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ RTC_DriverIRQHandler();
__attribute__((weak)) void RTC_IRQHandler(void) { RTC_DriverIRQHandler(); }


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

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

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

LLVM IR (-O2):
define weak void @RTC_IRQHandler() {
%1 = tail call i32 (...) @RTC_DriverIRQHandler()
ret void
}
void g_strstr_len() {}


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

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

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

LLVM IR (-O2):
define void @g_strstr_len() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ send_command_noack(int);
void target_run(void) { send_command_noack(0x25); }


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

x86 assembly (clang, -O2):
<target_run>:
mov    $0x25,%edi
jmp    1030 <send_command_noack@plt>

LLVM IR (-O0):
define void @target_run() {
%1 = call i32 @send_command_noack(i32 37)
ret void
}

LLVM IR (-O2):
define void @target_run() {
%1 = tail call i32 @send_command_noack(i32 37)
ret void
}
/* Variables and functions */
char *entitize(char const *, int);
char *html_entitize(const char *str) { return entitize(str, 1); }


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

x86 assembly (clang, -O2):
<html_entitize>:
mov    $0x1,%esi
jmp    1030 <entitize@plt>

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

LLVM IR (-O2):
define i8* @html_entitize(i8* %0) {
%2 = tail call i8* @entitize(i8* %0, i32 1)
ret i8* %2
}
/* Variables and functions */
int euler_problem_3();
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", euler_problem_3());
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @euler_problem_3()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
void _Locale_numeric_destroy(struct _Locale_numeric *lnum
                             __attribute__((__unused__))) {}


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

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

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

LLVM IR (-O2):
%struct._Locale_numeric = type opaque
define void @_Locale_numeric_destroy(%struct._Locale_numeric* nocapture %0) {
ret void
}
/* Variables and functions */
long long udivmoddi4(long long, long long, int);
long long __moddi3(long long a, long long b) {
  int neg = 0;
  long long res;
  if (a < 0) {
    a = -a;
    neg = 1;
  }
  if (b < 0)
    b = -b;
  res = udivmoddi4(a, b, 1);
  if (neg)
    res = -res;
  return res;
}


x86 assembly (clang, -O0):
<__moddi3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1143 <__moddi3+0x33>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1158 <__moddi3+0x48>
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <udivmoddi4@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1182 <__moddi3+0x72>
xor    %eax,%eax
sub    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__moddi3>:
push   %rbx
mov    %rdi,%rbx
neg    %rdi
cmovs  %rbx,%rdi
mov    %rsi,%rax
neg    %rax
cmovns %rax,%rsi
mov    $0x1,%edx
call   1030 <udivmoddi4@plt>
mov    %rax,%rcx
neg    %rcx
test   %rbx,%rbx
cmovs  %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @__moddi3(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, 0
%4 = sub nsw i64 0, %0
%5 = select i1 %3, i64 %4, i64 %0
%6 = tail call i64 @llvm.abs.i64(i64 %1, i1 true)
%7 = tail call i64 @udivmoddi4(i64 %5, i64 %6, i32 1)
%8 = sub nsw i64 0, %7
%9 = select i1 %3, i64 %8, i64 %7
ret i64 %9
}
/* Variables and functions */
int /*<<< orphan*/ eepromWrite(int /*<<< orphan*/, int /*<<< orphan*/,
                               unsigned char);
void eepromWriteMulti(int deviceAddress, unsigned int memAddress,
                      unsigned char *values, unsigned int size) {
  while (size--)
    eepromWrite(0, memAddress++, *values);
}


x86 assembly (clang, -O0):
<eepromWriteMulti>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     1157 <eepromWriteMulti+0x47>
mov    -0x8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
xor    %edi,%edi
movzbl (%rax),%edx
call   1030 <eepromWrite@plt>
jmp    1125 <eepromWriteMulti+0x15>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eepromWriteMulti>:
push   %rbp
push   %r14
push   %rbx
test   %ecx,%ecx
je     1135 <eepromWriteMulti+0x25>
mov    %ecx,%ebx
mov    %rdx,%r14
nopl   (%rax)
lea    0x1(%rsi),%ebp
movzbl (%r14),%edx
xor    %edi,%edi
call   1030 <eepromWrite@plt>
mov    %ebp,%esi
add    $0xffffffff,%ebx
jne    1120 <eepromWriteMulti+0x10>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @eepromWriteMulti(i32 %0, i32 %1, i8* nocapture %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %14, label %6
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ %3, %4 ]
%8 = phi i32 [ %10, %6 ], [ %1, %4 ]
%9 = add i32 %7, -1
%10 = add i32 %8, 1
%11 = load i8, i8* %2
%12 = tail call i32 @eepromWrite(i32 0, i32 %8, i8 zeroext %11)
%13 = icmp eq i32 %9, 0
br i1 %13, label %14, label %6
14: ; preds = %6, %4
ret void
}
/* Variables and functions */
int PAPI_num_cmp_hwctrs(int);
void papif_num_cmp_hwctrs__(int *cidx, int *num) {
  *num = PAPI_num_cmp_hwctrs(*cidx);
}


x86 assembly (clang, -O0):
<papif_num_cmp_hwctrs__>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <PAPI_num_cmp_hwctrs@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<papif_num_cmp_hwctrs__>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_num_cmp_hwctrs@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @papif_num_cmp_hwctrs__(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* %5
%7 = call i32 @PAPI_num_cmp_hwctrs(i32 %6)
%8 = load i32*, i32** %4
store i32 %7, i32* %8
ret void
}

LLVM IR (-O2):
define void @papif_num_cmp_hwctrs__(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @PAPI_num_cmp_hwctrs(i32 %3)
store i32 %4, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void lol2() { printf("Hello World\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
define void @lol2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
size_t strlen(char *);
void chomp(char *str) {
  size_t len = strlen(str);
  if (str[len - 1] == '\n')
    str[len - 1] = '\0';
}


x86 assembly (clang, -O0):
<chomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1152 <chomp+0x42>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    1125 <chomp+0x15>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @chomp(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, -1
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 10
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 0, i8* %4
br label %8
8: ; preds = %7, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ font_draw_char(int /*<<< orphan*/, int, long, int);
int /*<<< orphan*/ toCode(char);
void print(char c, long y) {
  font_draw_char(toCode((c >> 4) & 0xF), 10, y * 16, 0xffffff);
  font_draw_char(toCode(c & 0xF), 19, y * 16, 0xffffff);
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
sar    $0x4,%eax
and    $0xf,%eax
movsbl %al,%edi
call   1030 <toCode@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rdx
shl    $0x4,%rdx
mov    $0xa,%esi
mov    $0xffffff,%ecx
call   1040 <font_draw_char@plt>
movsbl -0x1(%rbp),%eax
and    $0xf,%eax
movsbl %al,%edi
call   1030 <toCode@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rdx
shl    $0x4,%rdx
mov    $0x13,%esi
mov    $0xffffff,%ecx
call   1040 <font_draw_char@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %ebp,%eax
shr    $0x4,%al
movzbl %al,%edi
call   1030 <toCode@plt>
shl    $0x4,%rbx
mov    %eax,%edi
mov    $0xa,%esi
mov    %rbx,%rdx
mov    $0xffffff,%ecx
call   1040 <font_draw_char@plt>
and    $0xf,%ebp
mov    %ebp,%edi
call   1030 <toCode@plt>
mov    %eax,%edi
mov    $0x13,%esi
mov    %rbx,%rdx
mov    $0xffffff,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <font_draw_char@plt>

LLVM IR (-O0):
define void @print(i8 signext %0, i64 %1) {
%3 = alloca i8
%4 = alloca i64
store i8 %0, i8* %3
store i64 %1, i64* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = ashr i32 %6, 4
%8 = and i32 %7, 15
%9 = trunc i32 %8 to i8
%10 = call i32 @toCode(i8 signext %9)
%11 = load i64, i64* %4
%12 = mul nsw i64 %11, 16
%13 = call i32 @font_draw_char(i32 %10, i32 10, i64 %12, i32 16777215)
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = and i32 %15, 15
%17 = trunc i32 %16 to i8
%18 = call i32 @toCode(i8 signext %17)
%19 = load i64, i64* %4
%20 = mul nsw i64 %19, 16
%21 = call i32 @font_draw_char(i32 %18, i32 19, i64 %20, i32 16777215)
ret void
}

LLVM IR (-O2):
define void @print(i8 signext %0, i64 %1) {
%3 = lshr i8 %0, 4
%4 = tail call i32 @toCode(i8 signext %3)
%5 = shl nsw i64 %1, 4
%6 = tail call i32 @font_draw_char(i32 %4, i32 10, i64 %5, i32 16777215)
%7 = and i8 %0, 15
%8 = tail call i32 @toCode(i8 signext %7)
%9 = tail call i32 @font_draw_char(i32 %8, i32 19, i64 %5, i32 16777215)
ret void
}
unsigned short get_be16(unsigned short v_) {
  const unsigned char *v = (const unsigned char *)&v_;
  unsigned short r = v[0];
  r <<= 8;
  r |= v[1];
  return r;
}


x86 assembly (clang, -O0):
<get_be16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
lea    -0x2(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
mov    %ax,-0x12(%rbp)
movzwl -0x12(%rbp),%eax
shl    $0x8,%eax
mov    %ax,-0x12(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%ecx
movzwl -0x12(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0x12(%rbp)
movzwl -0x12(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_be16>:
mov    %edi,%eax
rol    $0x8,%ax
ret

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

LLVM IR (-O2):
define zeroext i16 @get_be16(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ crypt_des_ecb(unsigned char *, unsigned char const *,
                                 unsigned char const *, int);
void DesEncrypt(const unsigned char *in, const unsigned char *key,
                unsigned char *out) {
  crypt_des_ecb(out, in, key, 1);
}


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

x86 assembly (clang, -O2):
<DesEncrypt>:
mov    %rdx,%rax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %rax,%rdi
mov    $0x1,%ecx
jmp    1030 <crypt_des_ecb@plt>

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

LLVM IR (-O2):
define void @DesEncrypt(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @crypt_des_ecb(i8* %2, i8* %0, i8* %1, i32 1)
ret void
}
/* Type definitions */
struct TNCDATA {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ BPQSerialSendData(struct TNCDATA *, unsigned char *, int);
int KissEncode(unsigned char *, unsigned char *, int);
void SendKISSData(struct TNCDATA *conn, unsigned char *txbuffer, int Len) {
  unsigned char EncodedReply[800];
  int TXLen;
  TXLen = KissEncode(txbuffer, EncodedReply, Len);
  BPQSerialSendData(conn, EncodedReply, TXLen);
}


x86 assembly (clang, -O0):
<SendKISSData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x340(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <KissEncode@plt>
mov    %eax,-0x344(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x340(%rbp),%rsi
mov    -0x344(%rbp),%edx
call   1030 <BPQSerialSendData@plt>
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendKISSData>:
push   %r14
push   %rbx
sub    $0x328,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %rsi,%rdi
mov    %r14,%rsi
call   1040 <KissEncode@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <BPQSerialSendData@plt>
add    $0x328,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TNCDATA = type { i32 }
define void @SendKISSData(%struct.TNCDATA* %0, i8* %1, i32 %2) {
%4 = alloca %struct.TNCDATA*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [800 x i8]
%8 = alloca i32
store %struct.TNCDATA* %0, %struct.TNCDATA** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i8*, i8** %5
%10 = getelementptr inbounds [800 x i8], [800 x i8]* %7, i64 0, i64 0
%11 = load i32, i32* %6
%12 = call i32 @KissEncode(i8* %9, i8* %10, i32 %11)
store i32 %12, i32* %8
%13 = load %struct.TNCDATA*, %struct.TNCDATA** %4
%14 = getelementptr inbounds [800 x i8], [800 x i8]* %7, i64 0, i64 0
%15 = load i32, i32* %8
%16 = call i32 @BPQSerialSendData(%struct.TNCDATA* %13, i8* %14, i32 %15)
ret void
}

LLVM IR (-O2):
%struct.TNCDATA = type { i32 }
define void @SendKISSData(%struct.TNCDATA* %0, i8* %1, i32 %2) {
%4 = alloca [800 x i8]
%5 = getelementptr inbounds [800 x i8], [800 x i8]* %4, i64 0, i64 0
%6 = call i32 @KissEncode(i8* %1, i8* %5, i32 %2)
%7 = call i32 @BPQSerialSendData(%struct.TNCDATA* %0, i8* %5, i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void sirius_free(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<sirius_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):
<sirius_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @sirius_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 @sirius_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int test_imm_91int64_lowword_reg(long long val) {
  return ((val) & (0x91 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_91int64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 145
%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_91int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 145
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int main(int argc, char **argv) {
  double x = 1.48734 + (double)argc;
  return (int)__builtin_fabs(x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xef1(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movaps 0xecc(%rip),%xmm1
pand   %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cvtsi2sd %edi,%xmm0
addsd  0xef4(%rip),%xmm0
andpd  0xefc(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to double
%9 = fadd double 1.487340e+00, %8
store double %9, double* %6
%10 = load double, double* %6
%11 = call double @llvm.fabs.f64(double %10)
%12 = fptosi double %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = sitofp i32 %0 to double
%4 = fadd double %3, 1.487340e+00
%5 = tail call double @llvm.fabs.f64(double %4)
%6 = fptosi double %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ cf_xlnk_open(int);
__attribute__((constructor)) void open_xlnk(void) { cf_xlnk_open(1); }


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

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

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @open_xlnk, i8* null }]
define void @open_xlnk() {
%1 = call i32 @cf_xlnk_open(i32 1)
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @open_xlnk, i8* null }]
define void @open_xlnk() {
%1 = tail call i32 @cf_xlnk_open(i32 1)
ret void
}
int test_imm_24int64_highword_reg(long long val) {
  return ((val >> 32) & (0x24 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_24int64_highword_reg(i64 %0) {
%2 = and i64 %0, 154618822656
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ Buttons_Init();
int /*<<< orphan*/ Display_Init();
int /*<<< orphan*/ Panel_UpdateDisplay();
void Panel_Init() {
  Buttons_Init();
  Display_Init();
  Panel_UpdateDisplay();
}


x86 assembly (clang, -O0):
<Panel_Init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <Buttons_Init@plt>
mov    $0x0,%al
call   1050 <Display_Init@plt>
mov    $0x0,%al
call   1030 <Panel_UpdateDisplay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Panel_Init>:
push   %rax
xor    %eax,%eax
call   1040 <Buttons_Init@plt>
xor    %eax,%eax
call   1050 <Display_Init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <Panel_UpdateDisplay@plt>

LLVM IR (-O0):
define void @Panel_Init() {
%1 = call i32 (...) @Buttons_Init()
%2 = call i32 (...) @Display_Init()
%3 = call i32 (...) @Panel_UpdateDisplay()
ret void
}

LLVM IR (-O2):
define void @Panel_Init() {
%1 = tail call i32 (...) @Buttons_Init()
%2 = tail call i32 (...) @Display_Init()
%3 = tail call i32 (...) @Panel_UpdateDisplay()
ret void
}
void nseel_asm_cos(void) { __asm__("fcos\n"); }


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

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

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

LLVM IR (-O2):
define void @nseel_asm_cos() {
tail call void asm sideeffect "fcos\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int print(char **, int *);
int sml_sprintf(char *out, const char *format, ...) {
  register int *varg = (int *)(&format);
  return print(&out, varg);
}


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

x86 assembly (clang, -O2):
<sml_sprintf>:
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <print@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @sml_sprintf(i8* %0, i8* %1, ...) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = bitcast i8** %4 to i32*
%6 = call i32 @print(i8** %3, i32* %5)
ret i32 %6
}
void pmsav7_adjust_lowmem_bounds(void) {}


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

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

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

LLVM IR (-O2):
define void @pmsav7_adjust_lowmem_bounds() {
ret void
}
/* Variables and functions */
int geteuid();
int getuid();
int /*<<< orphan*/ printf(char *, int);
void print_ids() {
  int uid = getuid();
  int euid = geteuid();
  printf("uid = %d\n", uid);
  printf("euid = %d\n", euid);
}


x86 assembly (clang, -O0):
<print_ids>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <geteuid@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ids>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <getuid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <geteuid@plt>
mov    %eax,%ebp
lea    0xeb5(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
lea    0xea6(%rip),%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"uid = %d\0A\00"
@.str.1 = [11 x i8] c"euid = %d\0A\00"
define void @print_ids() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @getuid()
store i32 %3, i32* %1
%4 = call i32 (...) @geteuid()
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"uid = %d\0A\00"
@.str.1 = [11 x i8] c"euid = %d\0A\00"
define void @print_ids() {
%1 = tail call i32 (...) @getuid()
%2 = tail call i32 (...) @geteuid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, void *, int);
int /*<<< orphan*/ sys_puts(char *);
int main(void) {
  char buffer[10];
  sys_puts("before read\n");
  memcpy(buffer, (void *)0x0, sizeof(buffer));
  sys_puts("after read");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <sys_puts@plt>
lea    -0xe(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <memcpy@plt>
lea    0xeb9(%rip),%rdi
call   1040 <sys_puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
call   1040 <sys_puts@plt>
lea    0xe(%rsp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1030 <memcpy@plt>
lea    0xec5(%rip),%rdi
call   1040 <sys_puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"before read\0A\00"
@.str.1 = [11 x i8] c"after read\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
store i32 0, i32* %1
%3 = call i32 @sys_puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = call i32 @memcpy(i8* %4, i8* null, i32 10)
%6 = call i32 @sys_puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"before read\0A\00"
@.str.1 = [11 x i8] c"after read\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @sys_puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @memcpy(i8* %2, i8* null, i32 10)
%5 = call i32 @sys_puts(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(void) {
  uint32_t i = 0x04030201;
  unsigned char *cp = (unsigned char *)&i;
  if (*cp == 1)
    printf("little-endian\n");
  else if (*cp == 4)
    printf("big-endian\n");
  else
    printf("who knows?\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4030201,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x1,%eax
jne    115f <main+0x3f>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
jmp    1191 <main+0x71>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x4,%eax
jne    1180 <main+0x60>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    118c <main+0x6c>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
jmp    1191 <main+0x71>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"little-endian\0A\00"
@.str.1 = [12 x i8] c"big-endian\0A\00"
@.str.2 = [12 x i8] c"who knows?\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
store i32 67305985, i32* %2
%4 = bitcast i32* %2 to i8*
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %21
11: ; preds = %0
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = icmp eq i32 %14, 4
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %20
18: ; preds = %11
%19 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %18, %16
br label %21
21: ; preds = %20, %9
%22 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [14 x i8] c"little-endian\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void fatal(char *str) {
  fprintf(stderr, "%s\n", str);
  exit(1);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @fatal(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
char *my_strcat(char *s1, const char *s2) {
  char *p = s1;
  while (*p)
    p++;
  while ((*p++ = *s2++))
    ;
  return s1;
}


x86 assembly (clang, -O0):
<my_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
cmpb   $0x0,(%rax)
je     1132 <my_strcat+0x32>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <my_strcat+0x14>
jmp    1137 <my_strcat+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1166 <my_strcat+0x66>
jmp    1137 <my_strcat+0x37>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x0,(%rcx)
lea    0x1(%rcx),%rcx
jne    1110 <my_strcat+0x10>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rsi,%rdx,1),%edi
mov    %dil,-0x1(%rcx,%rdx,1)
add    $0x1,%rdx
test   %dil,%dil
jne    1120 <my_strcat+0x20>
ret

LLVM IR (-O0):
define i8* @my_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 = %11, %2
%8 = load i8*, i8** %5
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i8*, i8** %5
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %5
br label %7
14: ; preds = %7
br label %15
15: ; preds = %22, %14
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %4
%18 = load i8, i8* %16
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %5
store i8 %18, i8* %19
%21 = icmp ne i8 %18, 0
br i1 %21, label %22, label %23
22: ; preds = %15
br label %15
23: ; preds = %15
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
define i8* @my_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, %8
%9 = phi i8* [ %11, %8 ], [ %1, %3 ]
%10 = phi i8* [ %13, %8 ], [ %4, %3 ]
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = load i8, i8* %9
%13 = getelementptr inbounds i8, i8* %10, i64 1
store i8 %12, i8* %10
%14 = icmp eq i8 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ show_fibonacci_sequence();
int main() {
  printf("A sequence of fibonacci numbers\n");
  show_fibonacci_sequence();
  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 <show_fibonacci_sequence@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [33 x i8] c"A sequence of fibonacci numbers\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @show_fibonacci_sequence()
ret i32 0
}

LLVM IR (-O2):
@str = [32 x i8] c"A sequence of fibonacci numbers\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @show_fibonacci_sequence()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gen_call(char *);
int /*<<< orphan*/ gen_pop();
void gen_udiv(void) {
  gen_pop();
  gen_call("_udiv");
}


x86 assembly (clang, -O0):
<gen_udiv>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <gen_pop@plt>
lea    0xece(%rip),%rdi
call   1040 <gen_call@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_udiv>:
push   %rax
xor    %eax,%eax
call   1030 <gen_pop@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <gen_call@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"_udiv\00"
define void @gen_udiv() {
%1 = call i32 (...) @gen_pop()
%2 = call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"_udiv\00"
define void @gen_udiv() {
%1 = tail call i32 (...) @gen_pop()
%2 = tail call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double cos(int);
float vy(float v, float x, float y, int Ind) {
  if (Ind == 0)
    return (v);
  else
    return (0.25 * cos(Ind * 3.141592 * y));
}


x86 assembly (clang, -O0):
<vy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1143 <vy+0x33>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1182 <vy+0x72>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  0xe8b(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vy>:
test   %edi,%edi
je     1145 <vy+0x35>
push   %rax
xorps  %xmm0,%xmm0
cvtsi2sd %edi,%xmm0
mulsd  0xedc(%rip),%xmm0
cvtss2sd %xmm2,%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <cos@plt>
mulsd  0xecb(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x8,%rsp
ret

LLVM IR (-O0):
define float @vy(float %0, float %1, float %2, i32 %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca i32
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store i32 %3, i32* %9
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = load float, float* %6
store float %13, float* %5
br label %25
14: ; preds = %4
%15 = load i32, i32* %9
%16 = sitofp i32 %15 to double
%17 = fmul double %16, 0x400921FAFC8B007A
%18 = load float, float* %8
%19 = fpext float %18 to double
%20 = fmul double %17, %19
%21 = fptosi double %20 to i32
%22 = call double @cos(i32 %21)
%23 = fmul double 2.500000e-01, %22
%24 = fptrunc double %23 to float
store float %24, float* %5
br label %25
25: ; preds = %14, %12
%26 = load float, float* %5
ret float %26
}

LLVM IR (-O2):
define float @vy(float %0, float %1, float %2, i32 %3) {
%5 = icmp eq i32 %3, 0
br i1 %5, label %15, label %6
6: ; preds = %4
%7 = sitofp i32 %3 to double
%8 = fmul double %7, 0x400921FAFC8B007A
%9 = fpext float %2 to double
%10 = fmul double %8, %9
%11 = fptosi double %10 to i32
%12 = tail call double @cos(i32 %11)
%13 = fmul double %12, 2.500000e-01
%14 = fptrunc double %13 to float
br label %15
15: ; preds = %4, %6
%16 = phi float [ %14, %6 ], [ %0, %4 ]
ret float %16
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t evpd_peripheral_device_type(uint8_t *data) { return data[0] & 0x1F; }


x86 assembly (clang, -O0):
<evpd_peripheral_device_type>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0x1f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<evpd_peripheral_device_type>:
mov    (%rdi),%eax
and    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @evpd_peripheral_device_type(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = and i32 %5, 31
ret i32 %6
}

LLVM IR (-O2):
define i32 @evpd_peripheral_device_type(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 31
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ lgen(char *, char *, int);
void cgdecsb(int a) { lgen("%s\t%c%d", "decb", a); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"%s\09%c%d\00"
@.str.1 = [5 x i8] c"decb\00"
define void @cgdecsb(i32 %0) {
%2 = tail call i32 @lgen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}