xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ str_to_decimal(char const *, long long *, int, void *);
int check_range_bytes(const char *str, long *val, void *data) {
  long long __val;
  if (!str_to_decimal(str, &__val, 1, data)) {
    *val = __val;
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_range_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%rsi
mov    $0x1,%edx
call   1030 <str_to_decimal@plt>
cmp    $0x0,%eax
jne    115a <check_range_bytes+0x4a>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1161 <check_range_bytes+0x51>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_range_bytes>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rcx
mov    %rsi,%rbx
mov    %rsp,%rsi
mov    $0x1,%ebp
mov    $0x1,%edx
call   1030 <str_to_decimal@plt>
test   %eax,%eax
jne    1138 <check_range_bytes+0x28>
mov    (%rsp),%rax
mov    %rax,(%rbx)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @check_range_bytes(i8* %0, i64* nocapture writeonly %1, i8* %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
%6 = call i32 @str_to_decimal(i8* %0, i64* %4, i32 1, i8* %2)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = load i64, i64* %4
store i64 %9, i64* %1
br label %10
10: ; preds = %3, %8
%11 = phi i32 [ 0, %8 ], [ 1, %3 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ nl_catd;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
char *catgets(nl_catd catd, int set_id, int msg_id, const char *s) {
  printf("catgets NYI\n");
  return NULL;
}


x86 assembly (clang, -O0):
<catgets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"catgets NYI\0A\00"
define i8* @catgets(i32 %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@str = [12 x i8] c"catgets NYI\00"
define noalias i8* @catgets(i32 %0, i32 %1, i32 %2, i8* nocapture readnone %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i8* null
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
int cmpzero(const void *data, int len) {
  for (int i = 0; i < len; ++i) {
    if (((uint8_t *)data)[i]) {
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<cmpzero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1150 <cmpzero+0x50>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     113d <cmpzero+0x3d>
movl   $0x0,-0x4(%rbp)
jmp    1157 <cmpzero+0x57>
jmp    1142 <cmpzero+0x42>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <cmpzero+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpzero>:
test   %esi,%esi
jle    110d <cmpzero+0xd>
xor    %eax,%eax
cmpq   $0x0,(%rdi)
je     1113 <cmpzero+0x13>
ret
mov    $0x1,%eax
ret
mov    %esi,%ecx
mov    $0x1,%eax
nopw   0x0(%rax,%rax,1)
mov    %rax,%rdx
cmp    %rax,%rcx
je     1133 <cmpzero+0x33>
lea    0x1(%rdx),%rax
cmpq   $0x0,(%rdi,%rdx,8)
je     1120 <cmpzero+0x20>
xor    %eax,%eax
cmp    %rcx,%rdx
setae  %al
ret

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

LLVM IR (-O2):
define i32 @cmpzero(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i64*
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %21
5: ; preds = %2
%6 = zext i32 %1 to i64
%7 = zext i32 %1 to i64
%8 = load i64, i64* %3
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %21
10: ; preds = %5, %13
%11 = phi i64 [ %17, %13 ], [ 1, %5 ]
%12 = icmp eq i64 %11, %7
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = getelementptr inbounds i64, i64* %3, i64 %11
%15 = load i64, i64* %14
%16 = icmp eq i64 %15, 0
%17 = add nuw nsw i64 %11, 1
br i1 %16, label %10, label %18
18: ; preds = %10, %13
%19 = icmp uge i64 %11, %6
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %18, %5, %2
%22 = phi i32 [ 1, %2 ], [ 0, %5 ], [ %20, %18 ]
ret i32 %22
}
/* Variables and functions */
int /*<<< orphan*/ tp6801_send_cmd(int, int /*<<< orphan*/, int, int,
                                   unsigned char *, int);
void eeprom_read(int fd, int offset, unsigned char *data, int data_size) {
  tp6801_send_cmd(fd, 0, 0xc1, offset, data, data_size);
}


x86 assembly (clang, -O0):
<eeprom_read>:
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    -0x4(%rbp),%edi
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%r8
mov    -0x14(%rbp),%r9d
xor    %esi,%esi
mov    $0xc1,%edx
call   1030 <tp6801_send_cmd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eeprom_read>:
mov    %ecx,%r9d
mov    %rdx,%r8
mov    %esi,%ecx
xor    %esi,%esi
mov    $0xc1,%edx
jmp    1030 <tp6801_send_cmd@plt>

LLVM IR (-O0):
define void @eeprom_read(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
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @tp6801_send_cmd(i32 %9, i32 0, i32 193, i32 %10, i8* %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @eeprom_read(i32 %0, i32 %1, i8* %2, i32 %3) {
%5 = tail call i32 @tp6801_send_cmd(i32 %0, i32 0, i32 193, i32 %1, i8* %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ reverse(int *, int, int);
void rotate(int a[], int pos, int len) {
  reverse(a, 0, pos - 1);
  reverse(a, pos, len - 1);
  reverse(a, 0, len - 1);
}


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

x86 assembly (clang, -O2):
<rotate>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%r15
lea    -0x1(%r14),%edx
xor    %esi,%esi
call   1030 <reverse@plt>
add    $0xffffffff,%ebx
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
call   1030 <reverse@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <reverse@plt>

LLVM IR (-O0):
define void @rotate(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = sub nsw i32 %8, 1
%10 = call i32 @reverse(i32* %7, i32 0, i32 %9)
%11 = load i32*, i32** %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = sub nsw i32 %13, 1
%15 = call i32 @reverse(i32* %11, i32 %12, i32 %14)
%16 = load i32*, i32** %4
%17 = load i32, i32* %6
%18 = sub nsw i32 %17, 1
%19 = call i32 @reverse(i32* %16, i32 0, i32 %18)
ret void
}

LLVM IR (-O2):
define void @rotate(i32* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, -1
%5 = tail call i32 @reverse(i32* %0, i32 0, i32 %4)
%6 = add nsw i32 %2, -1
%7 = tail call i32 @reverse(i32* %0, i32 %1, i32 %6)
%8 = tail call i32 @reverse(i32* %0, i32 0, i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_MAKE_INT3_INPUT() { clear_io_bit(0x45, 3); }


x86 assembly (clang, -O0):
<TOSH_MAKE_INT3_INPUT>:
push   %rbp
mov    %rsp,%rbp
mov    $0x45,%edi
mov    $0x3,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_MAKE_INT3_INPUT>:
mov    $0x45,%edi
mov    $0x3,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_MAKE_INT3_INPUT() {
%1 = call i32 @clear_io_bit(i32 69, i32 3)
ret void
}

LLVM IR (-O2):
define void @TOSH_MAKE_INT3_INPUT() {
%1 = tail call i32 @clear_io_bit(i32 69, i32 3)
ret void
}
int _hash(const char *sz) { return *sz; }


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

x86 assembly (clang, -O2):
<_hash>:
movsbl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @_hash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
ret i32 %3
}
int f_gt_rc1(float a1) { return (((a1) > (100))); }


x86 assembly (clang, -O0):
<f_gt_rc1>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeea(%rip),%xmm1
ucomiss %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_gt_rc1>:
xor    %eax,%eax
ucomiss 0xef7(%rip),%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @f_gt_rc1(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp ogt float %3, 1.000000e+02
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @f_gt_rc1(float %0) {
%2 = fcmp ogt float %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
void foo332(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo332(i32 %0) {
ret void
}
void *copystring(char *str, char *str2) {
  int i;
  for (i = 0; str2[i] != '\0'; i++) {
    str[i] = str2[i];
  }
  str[i] = '\0';
}


x86 assembly (clang, -O0):
<copystring>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114c <copystring+0x4c>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1113 <copystring+0x13>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<copystring>:
mov    (%rsi),%al
test   %al,%al
je     1127 <copystring+0x27>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %al,(%rdi,%rcx,1)
movzbl 0x1(%rsi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1110 <copystring+0x10>
mov    %ecx,%eax
movb   $0x0,(%rdi,%rax,1)
ret
xor    %eax,%eax
movb   $0x0,(%rdi,%rax,1)
ret

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

LLVM IR (-O2):
define noalias i8* @copystring(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = and i64 %9, 4294967295
br label %15
15: ; preds = %13, %2
%16 = phi i64 [ 0, %2 ], [ %14, %13 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %16
store i8 0, i8* %17
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ AddEStr(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ SendFileCleanup();
void SendFileError() {
  AddEStr("EXEC EDTS8; failed.\n", 0, 0);
  SendFileCleanup();
}


x86 assembly (clang, -O0):
<SendFileError>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <AddEStr@plt>
mov    $0x0,%al
call   1040 <SendFileCleanup@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SendFileError>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <AddEStr@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <SendFileCleanup@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"EXEC EDTS8; failed.\0A\00"
define void @SendFileError() {
%1 = call i32 @AddEStr(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%2 = call i32 (...) @SendFileCleanup()
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"EXEC EDTS8; failed.\0A\00"
define void @SendFileError() {
%1 = tail call i32 @AddEStr(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%2 = tail call i32 (...) @SendFileCleanup()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *name) {
  fprintf(stderr, "Usage: %s [options] u1,v1 u2,v2 u3,v3 ...\n", name);
  fprintf(stderr, "For more information type: %s -h \n\n", name);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xee2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ec2(%rip),%r14
mov    (%r14),%edi
lea    0xed8(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xef1(%rip),%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: %s [options] u1,v1 u2,v2 u3,v3 ...\0A\00"
@.str.1 = [36 x i8] c"For more information type: %s -h \0A\0A\00"
define void @usage(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 ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %2
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"Usage: %s [options] u1,v1 u2,v2 u3,v3 ...\0A\00"
@.str.1 = [36 x i8] c"For more information type: %s -h \0A\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int strlen(char *);
char toupper(unsigned char);
char *strtoupper(char *string) {
  int i;
  for (i = 0; i < strlen(string); i++)
    string[i] = toupper((unsigned char)string[i]);
  return string;
}


x86 assembly (clang, -O0):
<strtoupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    117b <strtoupper+0x5b>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <strtoupper+0x13>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtoupper>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
test   %eax,%eax
jle    1161 <strtoupper+0x41>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1140 <strtoupper+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strtoupper(i8* returned %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = tail call signext i8 @toupper(i8 zeroext %7)
store i8 %8, i8* %6
%9 = add nuw nsw i64 %5, 1
%10 = tail call i32 @strlen(i8* %0)
%11 = sext i32 %10 to i64
%12 = icmp slt i64 %9, %11
br i1 %12, label %4, label %13
13: ; preds = %4, %1
ret i8* %0
}
/* Variables and functions */
unsigned int strlen(const char *p) {
  int n;
  if (!p)
    return (0);
  for (n = 0; *p; p++)
    n++;
  return (n);
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    111f <strlen+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    1153 <strlen+0x53>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114d <strlen+0x4d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1126 <strlen+0x26>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
xor    %eax,%eax
test   %rdi,%rdi
je     111b <strlen+0x1b>
cmpb   $0x0,(%rdi)
je     111b <strlen+0x1b>
xor    %eax,%eax
xchg   %ax,%ax
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 0, %3 ]
%8 = phi i8* [ %10, %6 ], [ %0, %3 ]
%9 = add nuw nsw i32 %7, 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %9, %6 ]
ret i32 %14
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, long);
main() {
  long nc;
  nc = 0;
  while (getchar() != EOF) {
    ++nc;
    printf("%ld\n", nc);
  }
  printf("%ld\n", nc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%rax
je     116f <main+0x4f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
jmp    1137 <main+0x17>
mov    -0x10(%rbp),%rsi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%r15
cmp    (%r15),%rax
je     116b <main+0x4b>
lea    0xebf(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%rax
jne    1150 <main+0x30>
lea    0xe8e(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@EOF = global i64 0
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @getchar()
%2 = load i64, i64* @EOF
%3 = icmp eq i64 %1, %2
br i1 %3, label %11, label %4
4: ; preds = %0, %4
%5 = phi i64 [ %6, %4 ], [ 0, %0 ]
%6 = add nuw nsw i64 %5, 1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %6)
%8 = tail call i64 (...) @getchar()
%9 = load i64, i64* @EOF
%10 = icmp eq i64 %8, %9
br i1 %10, label %11, label %4
11: ; preds = %4, %0
%12 = phi i64 [ 0, %0 ], [ %6, %4 ]
%13 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %12)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_binary(int);
int main() {
  int a = 47;
  int b = 73;
  print_binary(a);
  print_binary(b);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print_binary(i32 47)
%2 = tail call i32 @print_binary(i32 73)
ret i32 0
}
long long fibonacci(unsigned int n) {
  if (n <= 0)
    return 0;
  if (n == 1)
    return 1;
  return fibonacci(n - 1) + fibonacci(n - 2);
}


x86 assembly (clang, -O0):
<fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
ja     1132 <fibonacci+0x22>
movq   $0x0,-0x8(%rbp)
jmp    1171 <fibonacci+0x61>
cmpl   $0x1,-0xc(%rbp)
jne    1149 <fibonacci+0x39>
movq   $0x1,-0x8(%rbp)
jmp    1171 <fibonacci+0x61>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <fibonacci@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x2,%edi
call   1030 <fibonacci@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibonacci>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %r14d,%r14d
test   %ebx,%ebx
je     1137 <fibonacci+0x27>
nopl   (%rax)
cmp    $0x1,%ebx
je     113b <fibonacci+0x2b>
lea    -0x1(%rbx),%edi
call   1030 <fibonacci@plt>
add    %rax,%r14
add    $0xfffffffe,%ebx
test   %ebx,%ebx
jne    1120 <fibonacci+0x10>
xor    %eax,%eax
jmp    1140 <fibonacci+0x30>
mov    $0x1,%eax
add    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fibonacci(i32 %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i64 [ 0, %1 ], [ %9, %5 ]
%4 = phi i32 [ %0, %1 ], [ %8, %5 ]
switch i32 %4, label %5 [
i32 0, label %10
i32 1, label %11
]
5: ; preds = %2
%6 = add i32 %4, -1
%7 = tail call i64 @fibonacci(i32 %6)
%8 = add i32 %4, -2
%9 = add nsw i64 %7, %3
br label %2
10: ; preds = %2
br label %11
11: ; preds = %2, %10
%12 = phi i64 [ 0, %10 ], [ 1, %2 ]
%13 = add nsw i64 %12, %3
ret i64 %13
}
int test_imm_59int64_highword_reg(long long val) {
  return ((val >> 32) & (0x59 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_59int64_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, 89
%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_59int64_highword_reg(i64 %0) {
%2 = and i64 %0, 382252089344
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char const *script_strerror(int);
char const *strerror(int);
const char *strerror_extended(int errnum) {
  if (errnum < (1 << 8))
    return strerror(errnum);
  else
    return script_strerror(errnum);
}


x86 assembly (clang, -O0):
<strerror_extended>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    1149 <strerror_extended+0x29>
mov    -0xc(%rbp),%edi
call   1030 <strerror@plt>
mov    %rax,-0x8(%rbp)
jmp    1155 <strerror_extended+0x35>
mov    -0xc(%rbp),%edi
call   1040 <script_strerror@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strerror_extended>:
cmp    $0xff,%edi
jg     112d <strerror_extended+0xd>
jmp    1030 <strerror@plt>
jmp    1040 <script_strerror@plt>

LLVM IR (-O0):
define i8* @strerror_extended(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 256
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = call i8* @strerror(i32 %7)
store i8* %8, i8** %2
br label %12
9: ; preds = %1
%10 = load i32, i32* %3
%11 = call i8* @script_strerror(i32 %10)
store i8* %11, i8** %2
br label %12
12: ; preds = %9, %6
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
define i8* @strerror_extended(i32 %0) {
%2 = icmp slt i32 %0, 256
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i8* @strerror(i32 %0)
br label %7
5: ; preds = %1
%6 = tail call i8* @script_strerror(i32 %0)
br label %7
7: ; preds = %5, %3
%8 = phi i8* [ %4, %3 ], [ %6, %5 ]
ret i8* %8
}
unsigned short fix_freq(unsigned short freq) {
  return freq >= 600 ? (freq < 1400 ? freq : 1400) : 600;
}


x86 assembly (clang, -O0):
<fix_freq>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x258,%eax
jl     114d <fix_freq+0x4d>
movzwl -0x2(%rbp),%eax
cmp    $0x578,%eax
jge    1135 <fix_freq+0x35>
movzwl -0x2(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <fix_freq+0x42>
mov    $0x578,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <fix_freq+0x42>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    115a <fix_freq+0x5a>
mov    $0x258,%eax
mov    %eax,-0xc(%rbp)
jmp    115a <fix_freq+0x5a>
mov    -0xc(%rbp),%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_freq>:
cmp    $0x578,%edi
mov    $0x578,%ecx
cmovb  %edi,%ecx
cmp    $0x259,%ecx
mov    $0x258,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i16 @fix_freq(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = icmp sge i32 %4, 600
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i16, i16* %2
%8 = zext i16 %7 to i32
%9 = icmp slt i32 %8, 1400
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i16, i16* %2
%12 = zext i16 %11 to i32
br label %14
13: ; preds = %6
br label %14
14: ; preds = %13, %10
%15 = phi i32 [ %12, %10 ], [ 1400, %13 ]
br label %17
16: ; preds = %1
br label %17
17: ; preds = %16, %14
%18 = phi i32 [ %15, %14 ], [ 600, %16 ]
%19 = trunc i32 %18 to i16
ret i16 %19
}

LLVM IR (-O2):
define zeroext i16 @fix_freq(i16 zeroext %0) {
%2 = icmp ult i16 %0, 1400
%3 = select i1 %2, i16 %0, i16 1400
%4 = icmp ugt i16 %3, 600
%5 = select i1 %4, i16 %3, i16 600
ret i16 %5
}
int f2(int x, int y, int z) { return x + y - z; }


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

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

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

LLVM IR (-O2):
define i32 @f2(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = sub i32 %4, %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int /*<<< orphan*/ my_free(int *);
int main() {
  int *p = malloc(sizeof(int));
  *p = 2;
  free(p);
  my_free(p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1050 <my_free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
movl   $0x2,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1050 <my_free@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
store i32 2, i32* %1
%2 = tail call i32 @free(i32* %1)
%3 = tail call i32 @my_free(i32* %1)
ret i32 0
}
/* Variables and functions */
bool nrf53_errata_53(void) { return false; }


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

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

LLVM IR (-O0):
define i32 @nrf53_errata_53() {
ret i32 0
}

LLVM IR (-O2):
define i32 @nrf53_errata_53() {
ret i32 0
}
void delay(void) {
  long int liCount;
  for (liCount = 0; liCount < 100000; liCount++) {
    ;
  }
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
cmpq   $0x186a0,-0x8(%rbp)
jge    1130 <delay+0x30>
jmp    111f <delay+0x1f>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <delay+0xc>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @delay() {
%1 = alloca i64
store i64 0, i64* %1
br label %2
2: ; preds = %6, %0
%3 = load i64, i64* %1
%4 = icmp slt i64 %3, 100000
br i1 %4, label %5, label %9
5: ; preds = %2
br label %6
6: ; preds = %5
%7 = load i64, i64* %1
%8 = add nsw i64 %7, 1
store i64 %8, i64* %1
br label %2
9: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @delay() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RETN(int, int);
int /*<<< orphan*/ T_WAIT_UNTIL(int);
void op_ED_0x55(void) {
  RETN(4, 7);
  T_WAIT_UNTIL(10);
  return;
}


x86 assembly (clang, -O0):
<op_ED_0x55>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
mov    $0x7,%esi
call   1030 <RETN@plt>
mov    $0xa,%edi
call   1040 <T_WAIT_UNTIL@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_ED_0x55>:
push   %rax
mov    $0x4,%edi
mov    $0x7,%esi
call   1030 <RETN@plt>
mov    $0xa,%edi
pop    %rax
jmp    1040 <T_WAIT_UNTIL@plt>

LLVM IR (-O0):
define void @op_ED_0x55() {
%1 = call i32 @RETN(i32 4, i32 7)
%2 = call i32 @T_WAIT_UNTIL(i32 10)
ret void
}

LLVM IR (-O2):
define void @op_ED_0x55() {
%1 = tail call i32 @RETN(i32 4, i32 7)
%2 = tail call i32 @T_WAIT_UNTIL(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ kernel_init();
int main() {
  kernel_init();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @kernel_init()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t rfcomm_event_channel_opened_get_rfcomm_cid(const uint8_t *event) {
  return little_endian_read_16(event, 12);
}


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

x86 assembly (clang, -O2):
<rfcomm_event_channel_opened_get_rfcomm_cid>:
mov    $0xc,%esi
jmp    1030 <little_endian_read_16@plt>

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

LLVM IR (-O2):
define i32 @rfcomm_event_channel_opened_get_rfcomm_cid(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 12)
ret i32 %2
}
int defaultOnShouldQuit(void *data) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @defaultOnShouldQuit(i8* nocapture readnone %0) {
ret i32 0
}
unsigned ds1743_bcd_to_int(unsigned val) {
  if ((val & 0x0f) > 0x09) {
    val += 0x06;
  }
  if ((val & 0xf0) > 0x90) {
    val += 0x60;
  }
  return ((val & 0x0f) + 10 * ((val >> 4) & 0xf0));
}


x86 assembly (clang, -O0):
<ds1743_bcd_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
cmp    $0x9,%eax
jbe    111f <ds1743_bcd_to_int+0x1f>
mov    -0x4(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf0,%eax
cmp    $0x90,%eax
jbe    113b <ds1743_bcd_to_int+0x3b>
mov    -0x4(%rbp),%eax
add    $0x60,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    -0x4(%rbp),%ecx
shr    $0x4,%ecx
and    $0xf0,%ecx
imul   $0xa,%ecx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ds1743_bcd_to_int>:
mov    %edi,%eax
and    $0xe,%eax
lea    0x6(%rdi),%ecx
cmp    $0xa,%eax
cmovb  %edi,%ecx
mov    %ecx,%eax
and    $0xf0,%eax
lea    0x60(%rcx),%edx
cmp    $0x91,%eax
cmovb  %ecx,%edx
mov    %edx,%ecx
and    $0xf,%ecx
shr    $0x3,%edx
and    $0x1e0,%edx
lea    (%rdx,%rdx,4),%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ds1743_bcd_to_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 15
%5 = icmp ugt i32 %4, 9
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = add i32 %7, 6
store i32 %8, i32* %2
br label %9
9: ; preds = %6, %1
%10 = load i32, i32* %2
%11 = and i32 %10, 240
%12 = icmp ugt i32 %11, 144
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = load i32, i32* %2
%15 = add i32 %14, 96
store i32 %15, i32* %2
br label %16
16: ; preds = %13, %9
%17 = load i32, i32* %2
%18 = and i32 %17, 15
%19 = load i32, i32* %2
%20 = lshr i32 %19, 4
%21 = and i32 %20, 240
%22 = mul i32 10, %21
%23 = add i32 %18, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @ds1743_bcd_to_int(i32 %0) {
%2 = and i32 %0, 14
%3 = icmp ugt i32 %2, 9
%4 = add i32 %0, 6
%5 = select i1 %3, i32 %4, i32 %0
%6 = and i32 %5, 240
%7 = icmp ugt i32 %6, 144
%8 = add i32 %5, 96
%9 = select i1 %7, i32 %8, i32 %5
%10 = and i32 %9, 15
%11 = lshr i32 %9, 4
%12 = and i32 %11, 240
%13 = mul nuw nsw i32 %12, 10
%14 = or i32 %13, %10
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ pledge_wrapper(char *);
void initialpledge(void) { pledge_wrapper("stdio rpath"); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"stdio rpath\00"
define void @initialpledge() {
%1 = call i32 @pledge_wrapper(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"stdio rpath\00"
define void @initialpledge() {
%1 = tail call i32 @pledge_wrapper(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t *log_sense_data(uint8_t *data) { return data + 4; }


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

x86 assembly (clang, -O2):
<log_sense_data>:
lea    0x10(%rdi),%rax
ret

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

LLVM IR (-O2):
define i32* @log_sense_data(i32* readnone %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
ret i32* %2
}
/* Variables and functions */
void *cgi_server(void *x_void_ptr) { return NULL; }


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

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

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

LLVM IR (-O2):
define noalias i8* @cgi_server(i8* nocapture readnone %0) {
ret i8* null
}
int Operand_tp7_decode(unsigned int *valp) {
  unsigned tp7_0, t_0;
  t_0 = *valp & 0xf;
  tp7_0 = t_0 + 0x7;
  *valp = tp7_0;
  return 0;
}


x86 assembly (clang, -O0):
<Operand_tp7_decode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xf,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_tp7_decode>:
mov    (%rdi),%eax
and    $0xf,%eax
add    $0x7,%eax
mov    %eax,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @Operand_tp7_decode(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = and i32 %6, 15
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = add i32 %8, 7
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = load i32*, i32** %2
store i32 %10, i32* %11
ret i32 0
}

LLVM IR (-O2):
define i32 @Operand_tp7_decode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 15
%4 = add nuw nsw i32 %3, 7
store i32 %4, i32* %0
ret i32 0
}
/* Variables and functions */
double M_PI;
double cos(double);
double dw_dx(double L, double a_wx, double w_x, double x) {
  return M_PI * a_wx * w_x * cos(M_PI * a_wx * x / L) / L;
}


x86 assembly (clang, -O0):
<dw_dx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    0x2eb5(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    0x2e9b(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dw_dx>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mulsd  (%rax),%xmm1
movsd  %xmm0,0x8(%rsp)
mulsd  %xmm1,%xmm2
movsd  %xmm2,0x10(%rsp)
mulsd  %xmm3,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <cos@plt>
mulsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @dw_dx(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* @M_PI
%10 = load double, double* %6
%11 = fmul double %9, %10
%12 = load double, double* %7
%13 = fmul double %11, %12
%14 = load double, double* @M_PI
%15 = load double, double* %6
%16 = fmul double %14, %15
%17 = load double, double* %8
%18 = fmul double %16, %17
%19 = load double, double* %5
%20 = fdiv double %18, %19
%21 = call double @cos(double %20)
%22 = fmul double %13, %21
%23 = load double, double* %5
%24 = fdiv double %22, %23
ret double %24
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @dw_dx(double %0, double %1, double %2, double %3) {
%5 = load double, double* @M_PI
%6 = fmul double %5, %1
%7 = fmul double %6, %2
%8 = fmul double %6, %3
%9 = fdiv double %8, %0
%10 = tail call double @cos(double %9)
%11 = fmul double %10, %7
%12 = fdiv double %11, %0
ret double %12
}
/* Variables and functions */
char *rtrim(char *);
char *right_trim(char *buffer) { return rtrim(buffer); }


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

x86 assembly (clang, -O2):
<right_trim>:
jmp    1030 <rtrim@plt>

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

LLVM IR (-O2):
define i8* @right_trim(i8* %0) {
%2 = tail call i8* @rtrim(i8* %0)
ret i8* %2
}
int fun638() { return 638; }


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

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

LLVM IR (-O0):
define i32 @fun638() {
ret i32 638
}

LLVM IR (-O2):
define i32 @fun638() {
ret i32 638
}