xunge/DecIR huggingface dataset:
unsigned blargg_max(unsigned x, unsigned y) {
  if (x < y)
    x = y;
  return x;
}


x86 assembly (clang, -O0):
<blargg_max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    111c <blargg_max+0x1c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<blargg_max>:
mov    %edi,%eax
cmp    %esi,%edi
cmovb  %esi,%eax
ret

LLVM IR (-O0):
define i32 @blargg_max(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 ult i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
store i32 %9, i32* %3
br label %10
10: ; preds = %8, %2
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @blargg_max(i32 %0, i32 %1) {
%3 = icmp ult i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
unsigned ror(unsigned value, int places) {
  return (value >> places) | (value << (32 - places));
}


x86 assembly (clang, -O0):
<ror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ror>:
mov    %esi,%ecx
mov    %edi,%eax
ror    %cl,%eax
ret

LLVM IR (-O0):
define i32 @ror(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 = lshr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 32, %9
%11 = shl i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @ror(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = sub nsw i32 32, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
unsigned char identity_transform(unsigned char grayscale) { return grayscale; }


x86 assembly (clang, -O0):
<identity_transform>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i8 @identity_transform(i8 returned zeroext %0) {
ret i8 %0
}
int insert(int set[], int size, int value) {
  set[size] = value;
  return size + 1;
}


x86 assembly (clang, -O0):
<insert>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert>:
movslq %esi,%rax
mov    %edx,(%rdi,%rax,4)
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @insert(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* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %8, i64 %10
store i32 %7, i32* %11
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
ret i32 %13
}

LLVM IR (-O2):
define i32 @insert(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
store i32 %2, i32* %5
%6 = add nsw i32 %1, 1
ret i32 %6
}
char *strcpy(s1, s2)
register char *s1, *s2;
{
  register char *os1;
  os1 = s1;
  while (*s1++ = *s2++)
    ;
  return (os1);
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ pi();
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main(int argc, const char *argv[]) {
  printf("The PI is %.9Lf", pi());
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"The PI is %.9Lf\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @pi()
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"The PI is %.9Lf\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @pi()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ write_to_vga(int, char);
void write_char(int row, int col, char chr, char attr) {
  write_to_vga(row * 160 + col * 2 + 0, chr);
  write_to_vga(row * 160 + col * 2 + 1, attr);
}


x86 assembly (clang, -O0):
<write_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
imul   $0xa0,-0x4(%rbp),%edi
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
add    %eax,%edi
add    $0x0,%edi
movsbl -0x9(%rbp),%esi
call   1030 <write_to_vga@plt>
imul   $0xa0,-0x4(%rbp),%edi
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
add    %eax,%edi
add    $0x1,%edi
movsbl -0xa(%rbp),%esi
call   1030 <write_to_vga@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_char>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %esi,%ebx
lea    (%rdi,%rdi,4),%ebp
shl    $0x5,%ebp
lea    0x0(%rbp,%rbx,2),%edi
mov    %edx,%esi
call   1030 <write_to_vga@plt>
lea    0x1(%rbp,%rbx,2),%edi
mov    %r14d,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <write_to_vga@plt>

LLVM IR (-O0):
define void @write_char(i32 %0, i32 %1, i8 signext %2, i8 signext %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = load i32, i32* %5
%10 = mul nsw i32 %9, 160
%11 = load i32, i32* %6
%12 = mul nsw i32 %11, 2
%13 = add nsw i32 %10, %12
%14 = add nsw i32 %13, 0
%15 = load i8, i8* %7
%16 = call i32 @write_to_vga(i32 %14, i8 signext %15)
%17 = load i32, i32* %5
%18 = mul nsw i32 %17, 160
%19 = load i32, i32* %6
%20 = mul nsw i32 %19, 2
%21 = add nsw i32 %18, %20
%22 = add nsw i32 %21, 1
%23 = load i8, i8* %8
%24 = call i32 @write_to_vga(i32 %22, i8 signext %23)
ret void
}

LLVM IR (-O2):
define void @write_char(i32 %0, i32 %1, i8 signext %2, i8 signext %3) {
%5 = mul nsw i32 %0, 160
%6 = shl nsw i32 %1, 1
%7 = add nsw i32 %6, %5
%8 = tail call i32 @write_to_vga(i32 %7, i8 signext %2)
%9 = or i32 %7, 1
%10 = tail call i32 @write_to_vga(i32 %9, i8 signext %3)
ret void
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int S_ISDIR(int /*<<< orphan*/);
scalar_t__ stat(char *, struct stat *);
int is_dir(char *file) {
  struct stat sbuf;
  if (stat(file, &sbuf) < 0)
    return 0;
  return S_ISDIR(sbuf.st_mode);
}


x86 assembly (clang, -O0):
<is_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
jge    114f <is_dir+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    115a <is_dir+0x3a>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_dir>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %rax,%rax
js     1138 <is_dir+0x18>
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @is_dir(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %13
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i32 @S_ISDIR(i32 %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @is_dir(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp slt i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i32 @S_ISDIR(i32 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ a();
int /*<<< orphan*/ b();
int /*<<< orphan*/ printf(char *);
int main() {
  b();
  a();
  b();
  printf("Done!\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"Done!\00"
define i32 @main() {
%1 = tail call i32 (...) @b()
%2 = tail call i32 (...) @a()
%3 = tail call i32 (...) @b()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}
char *_glp_lib_strspx(char *str) {
  char *s, *t;
  for (s = t = str; *s; s++)
    if (*s != ' ')
      *t++ = *s;
  *t = '\0';
  return str;
}


x86 assembly (clang, -O0):
<_glp_lib_strspx>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115e <_glp_lib_strspx+0x5e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     1148 <_glp_lib_strspx+0x48>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    114d <_glp_lib_strspx+0x4d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1114 <_glp_lib_strspx+0x14>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_glp_lib_strspx>:
mov    %rdi,%rax
mov    %rdi,%rdx
mov    %rdi,%rsi
jmp    1114 <_glp_lib_strspx+0x14>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rdx
movzbl (%rdx),%ecx
cmp    $0x20,%cl
je     1110 <_glp_lib_strspx+0x10>
test   %cl,%cl
je     1128 <_glp_lib_strspx+0x28>
mov    %cl,(%rsi)
add    $0x1,%rsi
jmp    1110 <_glp_lib_strspx+0x10>
movb   $0x0,(%rsi)
ret

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

LLVM IR (-O2):
define i8* @_glp_lib_strspx(i8* returned %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i8* [ %0, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %6 [
i8 0, label %11
i8 32, label %8
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %5, i8* %4
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ %4, %2 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
store i8 0, i8* %4
ret i8* %0
}
void uart_init(void) {
  (*(volatile unsigned long *)0x56000070) |= 0xa0;
  (*(volatile unsigned long *)0x56000078) = 0x0c;
  (*(volatile unsigned long *)0x50000000) = 0x03;
  (*(volatile unsigned long *)0x50000004) = 0x05;
  (*(volatile unsigned long *)0x50000008) = 0x00;
  (*(volatile unsigned long *)0x5000000c) = 0x00;
  (*(volatile unsigned long *)0x50000028) = ((12000000) / (57600 * 16) - 1);
}


x86 assembly (clang, -O0):
<uart_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x56000070,%eax
mov    (%rax),%rcx
or     $0xa0,%rcx
mov    $0x56000070,%eax
mov    %rcx,(%rax)
mov    $0x56000078,%eax
movq   $0xc,(%rax)
mov    $0x50000000,%eax
movq   $0x3,(%rax)
mov    $0x50000004,%eax
movq   $0x5,(%rax)
mov    $0x50000008,%eax
movq   $0x0,(%rax)
mov    $0x5000000c,%eax
movq   $0x0,(%rax)
mov    $0x50000028,%eax
movq   $0xc,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_init>:
orq    $0xa0,0x56000070
movq   $0xc,0x56000078
movq   $0x3,0x50000000
movq   $0x5,0x50000004
movq   $0x0,0x50000008
movq   $0x0,0x5000000c
movq   $0xc,0x50000028
ret

LLVM IR (-O0):
define void @uart_init() {
%1 = load volatile i64, i64* inttoptr (i64 1442840688 to i64*)
%2 = or i64 %1, 160
store volatile i64 %2, i64* inttoptr (i64 1442840688 to i64*)
store volatile i64 12, i64* inttoptr (i64 1442840696 to i64*)
store volatile i64 3, i64* inttoptr (i64 1342177280 to i64*)
store volatile i64 5, i64* inttoptr (i64 1342177284 to i64*)
store volatile i64 0, i64* inttoptr (i64 1342177288 to i64*)
store volatile i64 0, i64* inttoptr (i64 1342177292 to i64*)
store volatile i64 12, i64* inttoptr (i64 1342177320 to i64*)
ret void
}

LLVM IR (-O2):
define void @uart_init() {
%1 = load volatile i64, i64* inttoptr (i64 1442840688 to i64*)
%2 = or i64 %1, 160
store volatile i64 %2, i64* inttoptr (i64 1442840688 to i64*)
store volatile i64 12, i64* inttoptr (i64 1442840696 to i64*)
store volatile i64 3, i64* inttoptr (i64 1342177280 to i64*)
store volatile i64 5, i64* inttoptr (i64 1342177284 to i64*)
store volatile i64 0, i64* inttoptr (i64 1342177288 to i64*)
store volatile i64 0, i64* inttoptr (i64 1342177292 to i64*)
store volatile i64 12, i64* inttoptr (i64 1342177320 to i64*)
ret void
}
void free_opencl() {}


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

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

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

LLVM IR (-O2):
define void @free_opencl() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mcal_cpu_nop();
void __bus_fault_handler() {
  for (;;) {
    mcal_cpu_nop();
  }
}


x86 assembly (clang, -O0):
<__bus_fault_handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <__bus_fault_handler+0x9>
mov    $0x0,%al
call   1030 <mcal_cpu_nop@plt>
jmp    1119 <__bus_fault_handler+0x9>

x86 assembly (clang, -O2):
<__bus_fault_handler>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <mcal_cpu_nop@plt>
jmp    1120 <__bus_fault_handler+0x10>

LLVM IR (-O0):
define void @__bus_fault_handler() {
br label %1
1: ; preds = %1, %0
%2 = call i32 (...) @mcal_cpu_nop()
br label %1
}

LLVM IR (-O2):
define void @__bus_fault_handler() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @mcal_cpu_nop()
br label %1
}
int main() { return 2 == 2; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void isready() { printf("readyok\n"); }


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

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

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

LLVM IR (-O2):
@str = [8 x i8] c"readyok\00"
define void @isready() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct servent {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ getservbyname_r(char const *, char const *, struct servent *,
                                   char *, size_t, struct servent **);
int __gnat_safe_getservbyname(const char *name, const char *proto,
                              struct servent *ret, char *buf, size_t buflen) {
  struct servent *rh;
  int ri;
  (void)getservbyname_r(name, proto, ret, buf, buflen, &rh);
  ri = (rh == NULL) ? -1 : 0;
  return ri;
}


x86 assembly (clang, -O0):
<__gnat_safe_getservbyname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    -0x30(%rbp),%r9
call   1030 <getservbyname_r@plt>
mov    -0x30(%rbp),%rdx
xor    %eax,%eax
mov    $0xffffffff,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__gnat_safe_getservbyname>:
push   %rax
mov    %rsp,%r9
call   1030 <getservbyname_r@plt>
cmpq   $0x1,(%rsp)
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.servent = type { i32 }
define i32 @__gnat_safe_getservbyname(i8* %0, i8* %1, %struct.servent* %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca %struct.servent*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca %struct.servent*
%12 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store %struct.servent* %2, %struct.servent** %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%13 = load i8*, i8** %6
%14 = load i8*, i8** %7
%15 = load %struct.servent*, %struct.servent** %8
%16 = load i8*, i8** %9
%17 = load i64, i64* %10
%18 = call i32 @getservbyname_r(i8* %13, i8* %14, %struct.servent* %15, i8* %16, i64 %17, %struct.servent** %11)
%19 = load %struct.servent*, %struct.servent** %11
%20 = icmp eq %struct.servent* %19, null
%21 = zext i1 %20 to i64
%22 = select i1 %20, i32 -1, i32 0
store i32 %22, i32* %12
%23 = load i32, i32* %12
ret i32 %23
}

LLVM IR (-O2):
%struct.servent = type { i32 }
define i32 @__gnat_safe_getservbyname(i8* %0, i8* %1, %struct.servent* %2, i8* %3, i64 %4) {
%6 = alloca %struct.servent*
%7 = bitcast %struct.servent** %6 to i8*
%8 = call i32 @getservbyname_r(i8* %0, i8* %1, %struct.servent* %2, i8* %3, i64 %4, %struct.servent** %6)
%9 = load %struct.servent*, %struct.servent** %6
%10 = icmp eq %struct.servent* %9, null
%11 = sext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
usage() {
  fputs("usage: man [-] [-a] [-M path] [section] title ...\n", stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"usage: man [-] [-a] [-M path] [section] title ...\0A\00"
@stderr = global i32 0
define i32 @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [51 x i8] c"usage: man [-] [-a] [-M path] [section] title ...\0A\00"
@stderr = global i32 0
define i32 @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void justquit(int sig) { exit(0); }


x86 assembly (clang, -O0):
<justquit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<justquit>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @justquit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @justquit(i32 %0) {
%2 = tail call i32 @exit(i32 0)
unreachable
}
void HI_RegRead(unsigned long *pvalue, unsigned long addr) {
  *pvalue = readl((const volatile void *)addr);
}


x86 assembly (clang, -O0):
<HI_RegRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <readl@plt>
movslq %eax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HI_RegRead>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
xor    %eax,%eax
call   1030 <readl@plt>
cltq
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @HI_RegRead(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = inttoptr i64 %5 to i8*
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @readl to i32 (i8*, ...)*)(i8* %6)
%8 = sext i32 %7 to i64
%9 = load i64*, i64** %3
store i64 %8, i64* %9
ret void
}

LLVM IR (-O2):
define void @HI_RegRead(i64* nocapture writeonly %0, i64 %1) {
%3 = inttoptr i64 %1 to i8*
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @readl to i32 (i8*, ...)*)(i8* %3)
%5 = sext i32 %4 to i64
store i64 %5, i64* %0
ret void
}
void md_raw_standout() {}


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

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

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

LLVM IR (-O2):
define void @md_raw_standout() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int type;
  type = 123;
  switch (type) {
    printf("SOMETHING\n");
  case 1:
    printf("1\n");
    break;
  case 2:
    printf("2\n");
    break;
  default:
    printf("default\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x7b,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     1152 <main+0x42>
jmp    1141 <main+0x31>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     1163 <main+0x53>
jmp    1174 <main+0x64>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
jmp    118c <main+0x7c>
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    118c <main+0x7c>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1193 <main+0x83>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@str = [8 x i8] c"default\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 1
}
void BLInternalFlashErrorClear(void) {
  (*((volatile unsigned long *)(0x400FD014))) = 0x00000001;
}


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

x86 assembly (clang, -O2):
<BLInternalFlashErrorClear>:
movq   $0x1,0x400fd014
ret

LLVM IR (-O0):
define void @BLInternalFlashErrorClear() {
store volatile i64 1, i64* inttoptr (i64 1074778132 to i64*)
ret void
}

LLVM IR (-O2):
define void @BLInternalFlashErrorClear() {
store volatile i64 1, i64* inttoptr (i64 1074778132 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char stringvar[100];
  char *name = stringvar;
  printf("I am HAL, What is your name---> ");
  scanf("%s", name);
  printf("I can't open the pod bay doors, %s \n", name);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%rsi
lea    0xece(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x78(%rbp),%rsi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee7(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
lea    0xed8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"I am HAL, What is your name---> \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [37 x i8] c"I can't open the pod bay doors, %s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
store i8* %4, i8** %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"I am HAL, What is your name---> \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [37 x i8] c"I can't open the pod bay doors, %s \0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Type definitions */
struct terminal_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cr(struct terminal_t *);
int /*<<< orphan*/ nl(struct terminal_t *);
void crnl(struct terminal_t *term) {
  cr(term);
  nl(term);
}


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

x86 assembly (clang, -O2):
<crnl>:
push   %rbx
mov    %rdi,%rbx
call   1040 <cr@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <nl@plt>

LLVM IR (-O0):
%struct.terminal_t = type { i32 }
define void @crnl(%struct.terminal_t* %0) {
%2 = alloca %struct.terminal_t*
store %struct.terminal_t* %0, %struct.terminal_t** %2
%3 = load %struct.terminal_t*, %struct.terminal_t** %2
%4 = call i32 @cr(%struct.terminal_t* %3)
%5 = load %struct.terminal_t*, %struct.terminal_t** %2
%6 = call i32 @nl(%struct.terminal_t* %5)
ret void
}

LLVM IR (-O2):
%struct.terminal_t = type { i32 }
define void @crnl(%struct.terminal_t* %0) {
%2 = tail call i32 @cr(%struct.terminal_t* %0)
%3 = tail call i32 @nl(%struct.terminal_t* %0)
ret void
}
/* Variables and functions */
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("\n[Child Process]: Default exec program Started....\n");
  printf("\n[Child Process]: own pid:%u, parent id:%u....\n", getpid(),
         getppid());
  while (1)
    continue;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getppid@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1171 <main+0x41>

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <getppid@plt>
lea    0xe9c(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
nop
jmp    1170 <main+0x30>

LLVM IR (-O0):
@.str = [52 x i8] c"\0A[Child Process]: Default exec program Started....\0A\00"
@.str.1 = [48 x i8] c"\0A[Child Process]: own pid:%u, parent id:%u....\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @getpid()
%4 = call i32 (...) @getppid()
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %3, i32 %4)
br label %6
6: ; preds = %0, %6
br label %6
}

LLVM IR (-O2):
@.str.1 = [48 x i8] c"\0A[Child Process]: own pid:%u, parent id:%u....\0A\00"
@str = [51 x i8] c"\0A[Child Process]: Default exec program Started....\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (...) @getppid()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3)
br label %5
5: ; preds = %0, %5
br label %5
}
int carries(int a, int b) { return ((a & b) << 1); }


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

x86 assembly (clang, -O2):
<carries>:
and    %esi,%edi
lea    (%rdi,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @carries(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 = and i32 %5, %6
%8 = shl i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @carries(i32 %0, i32 %1) {
%3 = and i32 %1, %0
%4 = shl i32 %3, 1
ret i32 %4
}
void function(char test[]) { test[0] = 'A'; }


x86 assembly (clang, -O0):
<function>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x41,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<function>:
movb   $0x41,(%rdi)
ret

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

LLVM IR (-O2):
define void @function(i8* nocapture writeonly %0) {
store i8 65, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit_test();
int /*<<< orphan*/ print_error(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strsignal(int);
void exception_handler(int sig) {
  print_error("%s\n", strsignal(sig));
  exit_test();
}


x86 assembly (clang, -O0):
<exception_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <strsignal@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <print_error@plt>
mov    $0x0,%al
call   1040 <exit_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exception_handler>:
push   %rax
call   1050 <strsignal@plt>
lea    0xec3(%rip),%rdi
mov    %eax,%esi
call   1030 <print_error@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <exit_test@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @exception_handler(i32 %0) {
%2 = tail call i32 @strsignal(i32 %0)
%3 = tail call i32 @print_error(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 (...) @exit_test()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
char *SPC_LTrim(char *line) {
  char *ptr = line;
  while (*ptr == ' ' || *ptr == '\t') {
    ptr++;
  }
  strcpy(line, ptr);
  return line;
}


x86 assembly (clang, -O0):
<SPC_LTrim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
je     1149 <SPC_LTrim+0x39>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1159 <SPC_LTrim+0x49>
jmp    116a <SPC_LTrim+0x5a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <SPC_LTrim+0x14>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPC_LTrim>:
push   %rbx
mov    %rdi,%rbx
mov    %rdi,%rsi
jmp    1124 <SPC_LTrim+0x14>
nopl   0x0(%rax)
add    $0x1,%rsi
movzbl (%rsi),%eax
cmp    $0x20,%al
je     1120 <SPC_LTrim+0x10>
cmp    $0x9,%al
je     1120 <SPC_LTrim+0x10>
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @SPC_LTrim(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %17, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 32
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 9
br label %15
15: ; preds = %10, %5
%16 = phi i1 [ true, %5 ], [ %14, %10 ]
br i1 %16, label %17, label %20
17: ; preds = %15
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %3
br label %5
20: ; preds = %15
%21 = load i8*, i8** %2
%22 = load i8*, i8** %3
%23 = call i32 @strcpy(i8* %21, i8* %22)
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
define i8* @SPC_LTrim(i8* returned %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
%8 = tail call i32 @strcpy(i8* %0, i8* %3)
ret i8* %0
}
/* Variables and functions */
void *cfe_calloc(size_t, size_t);
void *cfe_calloc_secure(size_t nmemb, size_t size) {
  return cfe_calloc(nmemb, size);
}


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

x86 assembly (clang, -O2):
<cfe_calloc_secure>:
jmp    1030 <cfe_calloc@plt>

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

LLVM IR (-O2):
define i8* @cfe_calloc_secure(i64 %0, i64 %1) {
%3 = tail call i8* @cfe_calloc(i64 %0, i64 %1)
ret i8* %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int);
void inspect_fw_phex(const char *label, uint32_t val) {
  printf("%-23s: 0x%08x\n", label, val);
}


x86 assembly (clang, -O0):
<inspect_fw_phex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inspect_fw_phex>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%-23s: 0x%08x\0A\00"
define void @inspect_fw_phex(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%-23s: 0x%08x\0A\00"
define void @inspect_fw_phex(i8* %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t ILI9341_color565(uint8_t r, uint8_t g, uint8_t b) {
  return ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3);
}


x86 assembly (clang, -O0):
<ILI9341_color565>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf8,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%ecx
and    $0xfc,%ecx
shl    $0x3,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
sar    $0x3,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ILI9341_color565>:
shl    $0x8,%edi
and    $0xf800,%edi
and    $0xfc,%esi
lea    (%rdi,%rsi,8),%eax
sar    $0x3,%edx
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @ILI9341_color565(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 = and i32 %7, 248
%9 = shl i32 %8, 8
%10 = load i32, i32* %5
%11 = and i32 %10, 252
%12 = shl i32 %11, 3
%13 = or i32 %9, %12
%14 = load i32, i32* %6
%15 = ashr i32 %14, 3
%16 = or i32 %13, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @ILI9341_color565(i32 %0, i32 %1, i32 %2) {
%4 = shl i32 %0, 8
%5 = and i32 %4, 63488
%6 = shl i32 %1, 3
%7 = and i32 %6, 2016
%8 = or i32 %7, %5
%9 = ashr i32 %2, 3
%10 = or i32 %8, %9
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ parse_hex_uint64_t(char const *);
uint64_t parse_variantkey_hex(const char *vs) { return parse_hex_uint64_t(vs); }


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

x86 assembly (clang, -O2):
<parse_variantkey_hex>:
jmp    1030 <parse_hex_uint64_t@plt>

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

LLVM IR (-O2):
define i32 @parse_variantkey_hex(i8* %0) {
%2 = tail call i32 @parse_hex_uint64_t(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ printf(char *, double *);
void alloc_free(double **p) {
  printf("About to free %p\n", *p);
  free(*p);
}


x86 assembly (clang, -O0):
<alloc_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_free>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rsi
lea    0xed2(%rip),%rdi
call   1040 <printf@plt>
mov    (%rbx),%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"About to free %p\0A\00"
define void @alloc_free(double** %0) {
%2 = alloca double**
store double** %0, double*** %2
%3 = load double**, double*** %2
%4 = load double*, double** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double* %4)
%6 = load double**, double*** %2
%7 = load double*, double** %6
%8 = call i32 @free(double* %7)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"About to free %p\0A\00"
define void @alloc_free(double** nocapture %0) {
%2 = load double*, double** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), double* %2)
%4 = load double*, double** %0
%5 = tail call i32 @free(double* %4)
ret void
}
int main(int argc, char *argv[]) {
  enum cardsuit { CLUBS, DIAMONDS, HEARTS, SPADES };
  enum cardsuit suit = DIAMONDS;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
struct wcore_platform {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(struct wcore_platform *);
bool wcore_platform_init(struct wcore_platform *self) {
  assert(self);
  return true;
}


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

x86 assembly (clang, -O2):
<wcore_platform_init>:
push   %rax
call   1030 <assert@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.wcore_platform = type { i32 }
define i32 @wcore_platform_init(%struct.wcore_platform* %0) {
%2 = alloca %struct.wcore_platform*
store %struct.wcore_platform* %0, %struct.wcore_platform** %2
%3 = load %struct.wcore_platform*, %struct.wcore_platform** %2
%4 = call i32 @assert(%struct.wcore_platform* %3)
ret i32 1
}

LLVM IR (-O2):
%struct.wcore_platform = type { i32 }
define i32 @wcore_platform_init(%struct.wcore_platform* %0) {
%2 = tail call i32 @assert(%struct.wcore_platform* %0)
ret i32 1
}
/* Variables and functions */
scalar_t__ sqrt(float const);
float Length3fv(const float v[3]) {
  return ((float)sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]));
}


x86 assembly (clang, -O0):
<Length3fv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
cvtsi2ss %rax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Length3fv>:
push   %rax
movss  (%rdi),%xmm1
movss  0x4(%rdi),%xmm0
mulss  %xmm0,%xmm0
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0x8(%rdi),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @Length3fv(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
%5 = load float, float* %4
%6 = load float*, float** %2
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 1
%11 = load float, float* %10
%12 = load float*, float** %2
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = fmul float %11, %14
%16 = call float @llvm.fmuladd.f32(float %5, float %8, float %15)
%17 = load float*, float** %2
%18 = getelementptr inbounds float, float* %17, i64 2
%19 = load float, float* %18
%20 = load float*, float** %2
%21 = getelementptr inbounds float, float* %20, i64 2
%22 = load float, float* %21
%23 = call float @llvm.fmuladd.f32(float %19, float %22, float %16)
%24 = call i64 @sqrt(float %23)
%25 = sitofp i64 %24 to float
ret float %25
}

LLVM IR (-O2):
define float @Length3fv(float* nocapture %0) {
%2 = load float, float* %0
%3 = getelementptr inbounds float, float* %0, i64 1
%4 = load float, float* %3
%5 = fmul float %4, %4
%6 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %5)
%7 = getelementptr inbounds float, float* %0, i64 2
%8 = load float, float* %7
%9 = tail call float @llvm.fmuladd.f32(float %8, float %8, float %6)
%10 = tail call i64 @sqrt(float %9)
%11 = sitofp i64 %10 to float
ret float %11
}