xunge/DecIR huggingface dataset:
int my_strrpos(char *str, char s) {
  int i = -1;
  int j = 0;
  if (str)
    for (; *str != '\0'; str++, j++)
      if (*str == s)
        i = j;
  return i;
}


x86 assembly (clang, -O0):
<my_strrpos>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0xffffffff,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1179 <my_strrpos+0x79>
jmp    112c <my_strrpos+0x2c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1174 <my_strrpos+0x74>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1155 <my_strrpos+0x55>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    115a <my_strrpos+0x5a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112c <my_strrpos+0x2c>
jmp    1179 <my_strrpos+0x79>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strrpos>:
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     1133 <my_strrpos+0x33>
mov    (%rdi),%cl
test   %cl,%cl
je     1133 <my_strrpos+0x33>
mov    $0xffffffff,%eax
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
cmp    %sil,%cl
cmove  %edx,%eax
movzbl 0x1(%rdi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1120 <my_strrpos+0x20>
ret

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

LLVM IR (-O2):
define i32 @my_strrpos(i8* %0, i8 signext %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %18, label %7
7: ; preds = %4, %7
%8 = phi i8 [ %16, %7 ], [ %5, %4 ]
%9 = phi i32 [ %15, %7 ], [ 0, %4 ]
%10 = phi i32 [ %13, %7 ], [ -1, %4 ]
%11 = phi i8* [ %14, %7 ], [ %0, %4 ]
%12 = icmp eq i8 %8, %1
%13 = select i1 %12, i32 %9, i32 %10
%14 = getelementptr inbounds i8, i8* %11, i64 1
%15 = add nuw nsw i32 %9, 1
%16 = load i8, i8* %14
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %7
18: ; preds = %7, %4, %2
%19 = phi i32 [ -1, %2 ], [ -1, %4 ], [ %13, %7 ]
ret i32 %19
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int __rt_sigsuspend(const sigset_t *mask) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @__rt_sigsuspend(i32* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
char *strdup(char *);
int addVertex(char *str, char **names, int N) {
  names[N] = strdup(str);
  return N;
}


x86 assembly (clang, -O0):
<addVertex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addVertex>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
call   1030 <strdup@plt>
movslq %ebx,%rcx
mov    %rax,(%r14,%rcx,8)
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @addVertex(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = call i8* @strdup(i8* %7)
%9 = load i8**, i8*** %5
%10 = load i32, i32* %6
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8*, i8** %9, i64 %11
store i8* %8, i8** %12
%13 = load i32, i32* %6
ret i32 %13
}

LLVM IR (-O2):
define i32 @addVertex(i8* nocapture %0, i8** nocapture writeonly %1, i32 returned %2) {
%4 = tail call i8* @strdup(i8* %0)
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i8*, i8** %1, i64 %5
store i8* %4, i8** %6
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int8_t;
typedef int /*<<< orphan*/ u_char;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
const u_int8_t *pkt_get_offset(const u_char *packet_data, const int offset) {
  if (offset < 0 || NULL == packet_data) {
    printf("ERR: Invalid input packet_data or offset\n");
    return NULL;
  }
  return packet_data + offset;
}


x86 assembly (clang, -O0):
<pkt_get_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1135 <pkt_get_offset+0x25>
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    114e <pkt_get_offset+0x3e>
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1161 <pkt_get_offset+0x51>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pkt_get_offset>:
test   %rdi,%rdi
je     1120 <pkt_get_offset+0x10>
test   %esi,%esi
js     1120 <pkt_get_offset+0x10>
mov    %esi,%eax
lea    (%rdi,%rax,4),%rax
ret
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"ERR: Invalid input packet_data or offset\0A\00"
define i32* @pkt_get_offset(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp slt i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32*, i32** %4
%10 = icmp eq i32* null, %9
br i1 %10, label %11, label %13
11: ; preds = %8, %2
%12 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32* null, i32** %3
br label %18
13: ; preds = %8
%14 = load i32*, i32** %4
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
store i32* %17, i32** %3
br label %18
18: ; preds = %13, %11
%19 = load i32*, i32** %3
ret i32* %19
}

LLVM IR (-O2):
@str = [41 x i8] c"ERR: Invalid input packet_data or offset\00"
define i32* @pkt_get_offset(i32* readnone %0, i32 %1) {
%3 = icmp slt i32 %1, 0
%4 = icmp eq i32* %0, null
%5 = or i1 %4, %3
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %11
8: ; preds = %2
%9 = zext i32 %1 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
br label %11
11: ; preds = %8, %6
%12 = phi i32* [ null, %6 ], [ %10, %8 ]
ret i32* %12
}
void Ustar_newt2b(double *prim, double *Us, double sK, double sC, double x[2],
                  struct parList *pars) {}


x86 assembly (clang, -O0):
<Ustar_newt2b>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.parList = type opaque
define void @Ustar_newt2b(double* %0, double* %1, double %2, double %3, double* %4, %struct.parList* %5) {
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca %struct.parList*
store double* %0, double** %7
store double* %1, double** %8
store double %2, double* %9
store double %3, double* %10
store double* %4, double** %11
store %struct.parList* %5, %struct.parList** %12
ret void
}

LLVM IR (-O2):
%struct.parList = type opaque
define void @Ustar_newt2b(double* nocapture %0, double* nocapture %1, double %2, double %3, double* nocapture %4, %struct.parList* nocapture %5) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ recurse();
int main(void) {
  recurse();
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <recurse@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <recurse@plt>
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @recurse()
%3 = load i32, i32* @EXIT_SUCCESS
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @recurse()
%2 = load i32, i32* @EXIT_SUCCESS
%3 = tail call i32 @exit(i32 %2)
unreachable
}
int rcu_preempt_blocked_readers_cgp(struct rcu_node *rnp) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.rcu_node = type opaque
define i32 @rcu_preempt_blocked_readers_cgp(%struct.rcu_node* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ port_suspend();
void chSysSuspend(void) {
  port_suspend();
  ;
}


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

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

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

LLVM IR (-O2):
define void @chSysSuspend() {
%1 = tail call i32 (...) @port_suspend()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *name) {
  printf("%s [-a] filename\n", name);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@.str = [18 x i8] c"%s [-a] filename\0A\00"
@EXIT_SUCCESS = global i32 0
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @EXIT_SUCCESS
%4 = tail call i32 @exit(i32 %3)
unreachable
}
int can_be_compressed(int a) {
  if ((a >= 0x0000 && a <= 0x1e) || a == 0xffff)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<can_be_compressed>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     111b <can_be_compressed+0x1b>
cmpl   $0x1e,-0x8(%rbp)
jle    1128 <can_be_compressed+0x28>
cmpl   $0xffff,-0x8(%rbp)
jne    1134 <can_be_compressed+0x34>
movl   $0x1,-0x4(%rbp)
jmp    113b <can_be_compressed+0x3b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<can_be_compressed>:
cmp    $0x1f,%edi
setb   %al
cmp    $0xffff,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @can_be_compressed(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 30
br i1 %8, label %12, label %9
9: ; preds = %6, %1
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 65535
br i1 %11, label %12, label %13
12: ; preds = %9, %6
store i32 1, i32* %2
br label %14
13: ; preds = %9
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @can_be_compressed(i32 %0) {
%2 = icmp ult i32 %0, 31
%3 = icmp eq i32 %0, 65535
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ execl(char *, char *, int /*<<< orphan*/ *);
int main() { execl("./bin/portable_set-up.exe", "portable_set-up.exe", NULL); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee4(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <execl@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [26 x i8] c"./bin/portable_set-up.exe\00"
@.str.1 = [20 x i8] c"portable_set-up.exe\00"
define i32 @main() {
%1 = call i32 @execl(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"./bin/portable_set-up.exe\00"
@.str.1 = [20 x i8] c"portable_set-up.exe\00"
define i32 @main() {
%1 = tail call i32 @execl(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32* null)
ret i32 0
}
const char *nogg_version(void) { return "1.9"; }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"1.9\00"
define i8* @nogg_version() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"1.9\00"
define i8* @nogg_version() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int foo(int n) {
  printf("foo %d\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"foo %d\0A\00"
define i32 @foo(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}
void pcp_def_pwr_usb_metrics(struct activity *a) {}


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

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

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

LLVM IR (-O2):
%struct.activity = type opaque
define void @pcp_def_pwr_usb_metrics(%struct.activity* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PORTD_DriverIRQHandler();
__attribute__((weak)) void PORTD_IRQHandler(void) { PORTD_DriverIRQHandler(); }


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

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

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

LLVM IR (-O2):
define weak void @PORTD_IRQHandler() {
%1 = tail call i32 (...) @PORTD_DriverIRQHandler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void bar_v2(void) { printf("weak_as_needed_b: bar_v2\n"); }


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

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

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

LLVM IR (-O2):
@str = [25 x i8] c"weak_as_needed_b: bar_v2\00"
define void @bar_v2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
double f(x)
double x;
{ return x * x * x - 3 * x + 1; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  0xee8(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xeb4(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0xeec(%rip),%xmm0
addsd  %xmm1,%xmm0
addsd  0xee8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
%6 = load double, double* %2
%7 = load double, double* %2
%8 = fmul double 3.000000e+00, %7
%9 = fneg double %8
%10 = call double @llvm.fmuladd.f64(double %5, double %6, double %9)
%11 = fadd double %10, 1.000000e+00
ret double %11
}

LLVM IR (-O2):
define double @f(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %0, -3.000000e+00
%4 = tail call double @llvm.fmuladd.f64(double %2, double %0, double %3)
%5 = fadd double %4, 1.000000e+00
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ReadWord(char *, int /*<<< orphan*/ *);
int SearchVocab(char *);
scalar_t__ feof(int /*<<< orphan*/ *);
int ReadWordIndex(FILE *fin) {
  char word[60];
  ReadWord(word, fin);
  if (feof(fin))
    return -1;
  return SearchVocab(word);
}


x86 assembly (clang, -O0):
<ReadWordIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <ReadWord@plt>
mov    -0x10(%rbp),%rdi
call   1030 <feof@plt>
cmp    $0x0,%rax
je     1168 <ReadWordIndex+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1174 <ReadWordIndex+0x44>
lea    -0x50(%rbp),%rdi
call   1050 <SearchVocab@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadWordIndex>:
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <ReadWord@plt>
mov    %rbx,%rdi
call   1030 <feof@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    1160 <ReadWordIndex+0x30>
mov    %rsp,%rdi
call   1050 <SearchVocab@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ReadWordIndex(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [60 x i8]
store i32* %0, i32** %3
%5 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 0
%6 = load i32*, i32** %3
%7 = call i32 @ReadWord(i8* %5, i32* %6)
%8 = load i32*, i32** %3
%9 = call i64 @feof(i32* %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 -1, i32* %2
br label %15
12: ; preds = %1
%13 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 0
%14 = call i32 @SearchVocab(i8* %13)
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %11
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @ReadWordIndex(i32* %0) {
%2 = alloca [60 x i8]
%3 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
%4 = call i32 @ReadWord(i8* %3, i32* %0)
%5 = call i64 @feof(i32* %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @SearchVocab(i8* %3)
br label %9
9: ; preds = %1, %7
%10 = phi i32 [ %8, %7 ], [ -1, %1 ]
ret i32 %10
}
/* Variables and functions */
int BIT(int);
int wpa_key_mgmt_wpa_psk(int akm) {
  return akm == BIT(1) || akm == BIT(6) || akm == BIT(8);
}


x86 assembly (clang, -O0):
<wpa_key_mgmt_wpa_psk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x1,%edi
call   1030 <BIT@plt>
mov    -0xc(%rbp),%ecx
mov    %eax,%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x5(%rbp)
je     117c <wpa_key_mgmt_wpa_psk+0x6c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x6,%edi
call   1030 <BIT@plt>
mov    -0x10(%rbp),%ecx
mov    %eax,%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x5(%rbp)
je     117c <wpa_key_mgmt_wpa_psk+0x6c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x8,%edi
call   1030 <BIT@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wpa_key_mgmt_wpa_psk>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x1,%ebx
mov    $0x1,%edi
call   1030 <BIT@plt>
cmp    %ebp,%eax
je     1147 <wpa_key_mgmt_wpa_psk+0x37>
mov    $0x6,%edi
call   1030 <BIT@plt>
cmp    %ebp,%eax
je     1147 <wpa_key_mgmt_wpa_psk+0x37>
mov    $0x8,%edi
call   1030 <BIT@plt>
xor    %ebx,%ebx
cmp    %ebp,%eax
sete   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @wpa_key_mgmt_wpa_psk(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @BIT(i32 1)
%5 = icmp eq i32 %3, %4
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @BIT(i32 6)
%9 = icmp eq i32 %7, %8
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = call i32 @BIT(i32 8)
%13 = icmp eq i32 %11, %12
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @wpa_key_mgmt_wpa_psk(i32 %0) {
%2 = tail call i32 @BIT(i32 1)
%3 = icmp eq i32 %2, %0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 @BIT(i32 6)
%6 = icmp eq i32 %5, %0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i32 @BIT(i32 8)
%9 = icmp eq i32 %8, %0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %4, %1
%12 = phi i32 [ 1, %4 ], [ 1, %1 ], [ %10, %7 ]
ret i32 %12
}
int judas_memlock(void *start, unsigned size) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @judas_memlock(i8* nocapture readnone %0, i32 %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ bzero(void *, size_t);
void *malloc(size_t);
void *calloc(size_t nelem, size_t elsize) {
  void *p;
  p = malloc(nelem * elsize);
  if (p == 0)
    return (p);
  bzero(p, nelem * elsize);
  return (p);
}


x86 assembly (clang, -O0):
<calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
imul   -0x18(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115a <calloc+0x3a>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1174 <calloc+0x54>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
imul   -0x18(%rbp),%rsi
call   1040 <bzero@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1030 <malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1146 <calloc+0x26>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <bzero@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define noalias i8* @calloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @bzero(i8* %4, i64 %3)
br label %8
8: ; preds = %2, %6
ret i8* %4
}
void s5pv210_default_sdhci3(void) {}


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

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

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

LLVM IR (-O2):
define void @s5pv210_default_sdhci3() {
ret void
}
/* Type definitions */
struct statfs {
  double f_blocks;
  double f_bfree;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, double);
int /*<<< orphan*/ statfs(char *, struct statfs *);
void disk_part_max_used(char *buf) {
  struct statfs s;
  statfs("/", &s);
  sprintf(buf, "%.1f", (100.0 * (s.f_blocks - s.f_bfree)) / s.f_blocks);
}


x86 assembly (clang, -O0):
<disk_part_max_used>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xed5(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <statfs@plt>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xeae(%rip),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
lea    0xea8(%rip),%rsi
call   1040 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disk_part_max_used>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xed9(%rip),%rdi
mov    %rsp,%rsi
call   1030 <statfs@plt>
movsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
subsd  0x8(%rsp),%xmm0
mulsd  0xeb2(%rip),%xmm0
divsd  %xmm1,%xmm0
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.statfs = type { double, double }
@.str = [2 x i8] c"/\00"
@.str.1 = [5 x i8] c"%.1f\00"
define void @disk_part_max_used(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.statfs
store i8* %0, i8** %2
%4 = call i32 @statfs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.statfs* %3)
%5 = load i8*, i8** %2
%6 = getelementptr inbounds %struct.statfs, %struct.statfs* %3, i32 0, i32 0
%7 = load double, double* %6
%8 = getelementptr inbounds %struct.statfs, %struct.statfs* %3, i32 0, i32 1
%9 = load double, double* %8
%10 = fsub double %7, %9
%11 = fmul double 1.000000e+02, %10
%12 = getelementptr inbounds %struct.statfs, %struct.statfs* %3, i32 0, i32 0
%13 = load double, double* %12
%14 = fdiv double %11, %13
%15 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %14)
ret void
}

LLVM IR (-O2):
%struct.statfs = type { double, double }
@.str = [2 x i8] c"/\00"
@.str.1 = [5 x i8] c"%.1f\00"
define void @disk_part_max_used(i8* nocapture writeonly %0) {
%2 = alloca %struct.statfs
%3 = bitcast %struct.statfs* %2 to i8*
%4 = call i32 @statfs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %struct.statfs* %2)
%5 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i64 0, i32 0
%6 = load double, double* %5
%7 = getelementptr inbounds %struct.statfs, %struct.statfs* %2, i64 0, i32 1
%8 = load double, double* %7
%9 = fsub double %6, %8
%10 = fmul double %9, 1.000000e+02
%11 = fdiv double %10, %6
%12 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %11)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ulltoa(long long, char *, int);
char *lltoa(long long value, char *str, int base) {
  char *ptr = str;
  if (value < 0) {
    *ptr++ = '-';
    value = -value;
  }
  ulltoa(value, ptr, base);
  return str;
}


x86 assembly (clang, -O0):
<lltoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1152 <lltoa+0x42>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x2d,(%rax)
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <ulltoa@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lltoa>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
js     111e <lltoa+0xe>
mov    %rbx,%rsi
jmp    1128 <lltoa+0x18>
lea    0x1(%rbx),%rsi
movb   $0x2d,(%rbx)
neg    %rdi
call   1030 <ulltoa@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @lltoa(i64 %0, i8* returned %1, i32 %2) {
%4 = icmp slt i64 %0, 0
br i1 %4, label %5, label %8
5: ; preds = %3
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 45, i8* %1
%7 = sub nsw i64 0, %0
br label %8
8: ; preds = %5, %3
%9 = phi i64 [ %7, %5 ], [ %0, %3 ]
%10 = phi i8* [ %6, %5 ], [ %1, %3 ]
%11 = tail call i32 @ulltoa(i64 %9, i8* %10, i32 %2)
ret i8* %1
}
char _uart_getc() {
  unsigned char lsr;
  char c;
  do {
    lsr = *((volatile unsigned char *)(0x90000000 + 5));
  } while ((lsr & 0x01) != 0x01);
  return *((volatile unsigned char *)(0x90000000 + 0));
}


x86 assembly (clang, -O0):
<_uart_getc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x90000005,%eax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x1,%eax
jne    1104 <_uart_getc+0x4>
mov    $0x90000000,%eax
mov    (%rax),%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_uart_getc>:
mov    $0x90000000,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testb  $0x1,0x5(%rax)
je     1110 <_uart_getc+0x10>
mov    (%rax),%al
ret

LLVM IR (-O0):
define signext i8 @_uart_getc() {
%1 = alloca i8
%2 = alloca i8
br label %3
3: ; preds = %5, %0
%4 = load volatile i8, i8* inttoptr (i64 2415919109 to i8*)
store i8 %4, i8* %1
br label %5
5: ; preds = %3
%6 = load i8, i8* %1
%7 = zext i8 %6 to i32
%8 = and i32 %7, 1
%9 = icmp ne i32 %8, 1
br i1 %9, label %3, label %10
10: ; preds = %5
%11 = load volatile i8, i8* inttoptr (i64 2415919104 to i8*)
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @_uart_getc() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i8, i8* inttoptr (i64 2415919109 to i8*)
%3 = and i8 %2, 1
%4 = icmp eq i8 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = load volatile i8, i8* inttoptr (i64 2415919104 to i8*)
ret i8 %6
}
char *I_RunSoftwareKeyboard(const char *title, const char *oldStr,
                            const int bufferSize) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @I_RunSoftwareKeyboard(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2) {
ret i8* null
}
int SysCall4(int EAX__, int EBX__, int ECX__, int EDX__) {
  asm volatile("" ::"a"(EAX__));
  asm volatile("" ::"b"(EBX__));
  asm volatile("" ::"c"(ECX__));
  asm volatile("" ::"d"(EDX__));
  asm volatile("int $0x40");
  register int res;
  asm volatile("" : "=a"(res) :);
  return res;
}


x86 assembly (clang, -O0):
<SysCall4>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ebx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%edx
int    $0x40
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCall4>:
push   %rbx
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%ebx
mov    %edi,%eax
mov    %r8d,%edx
int    $0x40
pop    %rbx
ret

LLVM IR (-O0):
define i32 @SysCall4(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 asm sideeffect "", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i32 %14, i32* %9
%15 = load i32, i32* %9
ret i32 %15
}

LLVM IR (-O2):
define i32 @SysCall4(i32 %0, i32 %1, i32 %2, i32 %3) {
tail call void asm sideeffect "", "{ax},~{dirflag},~{fpsr},~{flags}"(i32 %0)
tail call void asm sideeffect "", "{bx},~{dirflag},~{fpsr},~{flags}"(i32 %1)
tail call void asm sideeffect "", "{cx},~{dirflag},~{fpsr},~{flags}"(i32 %2)
tail call void asm sideeffect "", "{dx},~{dirflag},~{fpsr},~{flags}"(i32 %3)
tail call void asm sideeffect "int $$0x40", "~{dirflag},~{fpsr},~{flags}"()
%5 = tail call i32 asm sideeffect "", "={ax},~{dirflag},~{fpsr},~{flags}"()
ret i32 %5
}
int term_probe(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @term_probe() {
ret i32 1
}

LLVM IR (-O2):
define i32 @term_probe() {
ret i32 1
}
int sign(int x) {
  int lastNum = !!x;
  int res = x >> 31;
  res = res << 1 | lastNum;
  return res;
}


x86 assembly (clang, -O0):
<sign>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
sar    $0x1e,%edi
and    $0xfffffffe,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @sign(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = xor i1 %7, true
%9 = zext i1 %8 to i32
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = ashr i32 %10, 31
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = shl i32 %12, 1
%14 = load i32, i32* %3
%15 = or i32 %13, %14
store i32 %15, i32* %4
%16 = load i32, i32* %4
ret i32 %16
}

LLVM IR (-O2):
define i32 @sign(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
%4 = ashr i32 %0, 30
%5 = and i32 %4, -2
%6 = or i32 %5, %3
ret i32 %6
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ write_error();
void write_blank(void) {
  if (fputc('\n', stdout) == EOF) {
    write_error();
  }
}


x86 assembly (clang, -O0):
<write_blank>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%rax
jne    114e <write_blank+0x2e>
mov    $0x0,%al
call   1040 <write_error@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_blank>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
mov    0x2ead(%rip),%rcx
cmp    (%rcx),%rax
jne    1148 <write_blank+0x28>
xor    %eax,%eax
pop    %rcx
jmp    1040 <write_error@plt>
pop    %rax
ret

LLVM IR (-O0):
@stdout = global i32 0
@EOF = global i64 0
define void @write_blank() {
%1 = load i32, i32* @stdout
%2 = call i64 @fputc(i8 signext 10, i32 %1)
%3 = load i64, i64* @EOF
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @write_error()
br label %7
7: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@EOF = global i64 0
define void @write_blank() {
%1 = load i32, i32* @stdout
%2 = tail call i64 @fputc(i8 signext 10, i32 %1)
%3 = load i64, i64* @EOF
%4 = icmp eq i64 %2, %3
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 (...) @write_error()
br label %7
7: ; preds = %5, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *isofs_bread(unsigned int block) {
  if (block)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<isofs_bread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     113c <isofs_bread+0x1c>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<isofs_bread>:
push   %rax
test   %edi,%edi
jne    112c <isofs_bread+0xc>
xor    %edi,%edi
call   1040 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @isofs_bread(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define noalias i8* @isofs_bread(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int genlabel(int n) {
  static int label = 1;
  label += n;
  return label - n;
}


x86 assembly (clang, -O0):
<genlabel>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    0x2f10(%rip),%eax
mov    %eax,0x2f0a(%rip)
mov    0x2f04(%rip),%eax
sub    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<genlabel>:
mov    0x2f1a(%rip),%eax
add    %eax,%edi
mov    %edi,0x2f12(%rip)
ret

LLVM IR (-O0):
@genlabel.label = internal global i32 1
define i32 @genlabel(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @genlabel.label
%5 = add nsw i32 %4, %3
store i32 %5, i32* @genlabel.label
%6 = load i32, i32* @genlabel.label
%7 = load i32, i32* %2
%8 = sub nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
@genlabel.label = internal unnamed_addr global i32 1
define i32 @genlabel(i32 %0) {
%2 = load i32, i32* @genlabel.label
%3 = add nsw i32 %2, %0
store i32 %3, i32* @genlabel.label
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __emit_expression_range(int /*<<< orphan*/, int);
void test_within_macro_4(int lhs, int rhs) {
  __emit_expression_range(0, lhs == rhs);
}


x86 assembly (clang, -O0):
<test_within_macro_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
xor    %edi,%edi
call   1030 <__emit_expression_range@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_within_macro_4>:
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
xor    %edi,%edi
mov    %eax,%esi
jmp    1030 <__emit_expression_range@plt>

LLVM IR (-O0):
define void @test_within_macro_4(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
%9 = call i32 @__emit_expression_range(i32 0, i32 %8)
ret void
}

LLVM IR (-O2):
define void @test_within_macro_4(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = zext i1 %3 to i32
%5 = tail call i32 @__emit_expression_range(i32 0, i32 %4)
ret void
}
int empty() {}


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

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

LLVM IR (-O0):
define i32 @empty() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @empty() {
ret i32 undef
}
int division(int nbr, int div) {
  int c;
  c = 0;
  while (nbr / div >= 1) {
    div *= 10;
    c++;
  }
  return (c);
}


x86 assembly (clang, -O0):
<division>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x1,%eax
jl     1136 <division+0x36>
imul   $0xa,-0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1111 <division+0x11>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<division>:
mov    %edi,%eax
cltd
idiv   %esi
xor    %ecx,%ecx
test   %eax,%eax
jle    1121 <division+0x21>
nopl   0x0(%rax,%rax,1)
add    %esi,%esi
lea    (%rsi,%rsi,4),%esi
add    $0x1,%ecx
mov    %edi,%eax
cltd
idiv   %esi
test   %eax,%eax
jg     1110 <division+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @division(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %2, %5
%6 = phi i32 [ %9, %5 ], [ 0, %2 ]
%7 = phi i32 [ %8, %5 ], [ %1, %2 ]
%8 = mul nsw i32 %7, 10
%9 = add nuw nsw i32 %6, 1
%10 = sdiv i32 %0, %8
%11 = icmp sgt i32 %10, 0
br i1 %11, label %5, label %12
12: ; preds = %5, %2
%13 = phi i32 [ 0, %2 ], [ %9, %5 ]
ret i32 %13
}
int decode_hex(int ch) {
  if ('0' <= ch && ch <= '9') {
    return ch - '0';
  } else if ('A' <= ch && ch <= 'F') {
    return ch - 'A' + 0xa;
  } else if ('a' <= ch && ch <= 'f') {
    return ch - 'a' + 0xa;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<decode_hex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    $0x30,%eax
cmp    -0x8(%rbp),%eax
jg     112d <decode_hex+0x2d>
cmpl   $0x39,-0x8(%rbp)
jg     112d <decode_hex+0x2d>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1186 <decode_hex+0x86>
mov    $0x41,%eax
cmp    -0x8(%rbp),%eax
jg     1156 <decode_hex+0x56>
cmpl   $0x46,-0x8(%rbp)
jg     1156 <decode_hex+0x56>
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1186 <decode_hex+0x86>
mov    $0x61,%eax
cmp    -0x8(%rbp),%eax
jg     117f <decode_hex+0x7f>
cmpl   $0x66,-0x8(%rbp)
jg     117f <decode_hex+0x7f>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1186 <decode_hex+0x86>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_hex>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
jb     1127 <decode_hex+0x27>
lea    -0x41(%rdi),%eax
cmp    $0x5,%eax
ja     1116 <decode_hex+0x16>
add    $0xffffffc9,%edi
mov    %edi,%eax
ret
lea    -0x61(%rdi),%eax
add    $0xffffffa9,%edi
cmp    $0x6,%eax
mov    $0xffffffff,%eax
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @decode_hex(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 48, %4
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 57
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 48
store i32 %11, i32* %2
br label %33
12: ; preds = %6, %1
%13 = load i32, i32* %3
%14 = icmp sle i32 65, %13
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp sle i32 %16, 70
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 65
%21 = add nsw i32 %20, 10
store i32 %21, i32* %2
br label %33
22: ; preds = %15, %12
%23 = load i32, i32* %3
%24 = icmp sle i32 97, %23
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = load i32, i32* %3
%27 = icmp sle i32 %26, 102
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load i32, i32* %3
%30 = sub nsw i32 %29, 97
%31 = add nsw i32 %30, 10
store i32 %31, i32* %2
br label %33
32: ; preds = %25, %22
store i32 -1, i32* %2
br label %33
33: ; preds = %32, %28, %18, %9
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @decode_hex(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = add i32 %0, -65
%6 = icmp ult i32 %5, 6
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = add nsw i32 %0, -55
br label %14
9: ; preds = %4
%10 = add i32 %0, -97
%11 = icmp ult i32 %10, 6
%12 = add nsw i32 %0, -87
%13 = select i1 %11, i32 %12, i32 -1
br label %14
14: ; preds = %1, %9, %7
%15 = phi i32 [ %8, %7 ], [ %13, %9 ], [ %2, %1 ]
ret i32 %15
}