xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ video_display_buffer_();
void cop_lcd_test() {
  while ((*(volatile unsigned int *)(0x40015020)) & (1 << 0)) {
    while (((*(volatile unsigned int *)(0x40015020)) & (1 << 1)) == 0)
      ;
    video_display_buffer_();
    (*(volatile unsigned int *)(0x40015020) =
         ((*(volatile unsigned int *)(0x40015020)) & ~(1 << 1)));
  }
}


x86 assembly (clang, -O0):
<cop_lcd_test>:
push   %rbp
mov    %rsp,%rbp
jmp    1119 <cop_lcd_test+0x9>
mov    $0x40015020,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1166 <cop_lcd_test+0x56>
jmp    1131 <cop_lcd_test+0x21>
mov    $0x40015020,%eax
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    1149 <cop_lcd_test+0x39>
jmp    1131 <cop_lcd_test+0x21>
mov    $0x0,%al
call   1030 <video_display_buffer_@plt>
mov    $0x40015020,%eax
mov    (%rax),%ecx
and    $0xfffffffd,%ecx
mov    $0x40015020,%eax
mov    %ecx,(%rax)
jmp    1119 <cop_lcd_test+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cop_lcd_test>:
push   %rax
testl  $0x1,0x40015020
je     1147 <cop_lcd_test+0x37>
xchg   %ax,%ax
testl  $0x2,0x40015020
je     1120 <cop_lcd_test+0x10>
xor    %eax,%eax
call   1030 <video_display_buffer_@plt>
andl   $0xfffffffd,0x40015020
fd
mov    0x40015020,%eax
test   $0x1,%al
jne    1120 <cop_lcd_test+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @cop_lcd_test() {
br label %1
1: ; preds = %11, %0
%2 = load volatile i32, i32* inttoptr (i64 1073827872 to i32*)
%3 = and i32 %2, 1
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %15
5: ; preds = %1
br label %6
6: ; preds = %10, %5
%7 = load volatile i32, i32* inttoptr (i64 1073827872 to i32*)
%8 = and i32 %7, 2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6
br label %6
11: ; preds = %6
%12 = call i32 (...) @video_display_buffer_()
%13 = load volatile i32, i32* inttoptr (i64 1073827872 to i32*)
%14 = and i32 %13, -3
store volatile i32 %14, i32* inttoptr (i64 1073827872 to i32*)
br label %1
15: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @cop_lcd_test() {
%1 = load volatile i32, i32* inttoptr (i64 1073827872 to i32*)
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %0, %8
%5 = load volatile i32, i32* inttoptr (i64 1073827872 to i32*)
%6 = and i32 %5, 2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4, %9
br label %4
9: ; preds = %4
%10 = tail call i32 (...) @video_display_buffer_()
%11 = load volatile i32, i32* inttoptr (i64 1073827872 to i32*)
%12 = and i32 %11, -3
store volatile i32 %12, i32* inttoptr (i64 1073827872 to i32*)
%13 = load volatile i32, i32* inttoptr (i64 1073827872 to i32*)
%14 = and i32 %13, 1
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %8
16: ; preds = %9, %0
ret void
}
/* Variables and functions */
scalar_t__ strcasecmp(char const *, char const *);
int _os_strcmp_last(const char *pattern, const char *str, size_t str_len,
                    size_t size) {
  if (str_len < size) {
    return (0);
  }
  if (strcasecmp(pattern, str + (str_len - size)) == 0) {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<_os_strcmp_last>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1142 <_os_strcmp_last+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1177 <_os_strcmp_last+0x67>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
sub    -0x28(%rbp),%rax
add    %rax,%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1170 <_os_strcmp_last+0x60>
movl   $0x1,-0x4(%rbp)
jmp    1177 <_os_strcmp_last+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_os_strcmp_last>:
xor    %eax,%eax
sub    %rcx,%rdx
jb     112f <_os_strcmp_last+0x1f>
push   %rax
add    %rdx,%rsi
call   1030 <strcasecmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @_os_strcmp_last(i8* nocapture %0, i8* nocapture %1, i64 %2, i64 %3) {
%5 = icmp ult i64 %2, %3
br i1 %5, label %12, label %6
6: ; preds = %4
%7 = sub i64 %2, %3
%8 = getelementptr inbounds i8, i8* %1, i64 %7
%9 = tail call i64 @strcasecmp(i8* %0, i8* %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %4
%13 = phi i32 [ 0, %4 ], [ %11, %6 ]
ret i32 %13
}
int dotime(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @dotime() {
ret i32 1
}
struct proc_dir_entry *proc_symlink(const char *name,
                                    struct proc_dir_entry *parent,
                                    const char *dest) {
  return ((void *)0);
}


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

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

LLVM IR (-O0):
%struct.proc_dir_entry = type opaque
define %struct.proc_dir_entry* @proc_symlink(i8* %0, %struct.proc_dir_entry* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca %struct.proc_dir_entry*
%6 = alloca i8*
store i8* %0, i8** %4
store %struct.proc_dir_entry* %1, %struct.proc_dir_entry** %5
store i8* %2, i8** %6
ret %struct.proc_dir_entry* null
}

LLVM IR (-O2):
%struct.proc_dir_entry = type opaque
define noalias %struct.proc_dir_entry* @proc_symlink(i8* nocapture readnone %0, %struct.proc_dir_entry* nocapture readnone %1, i8* nocapture readnone %2) {
ret %struct.proc_dir_entry* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void message(char *m) { printf("test %s\n", m); }


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

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

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

LLVM IR (-O2):
@.str = [9 x i8] c"test %s\0A\00"
define void @message(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int f3(int x, int y) {
  if (y == -1)
    __builtin_unreachable();
  return x % -y;
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1114 <f3+0x14>
mov    -0x4(%rbp),%eax
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
mov    %edi,%eax
neg    %esi
cltd
idiv   %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @f3(i32 %0, i32 %1) {
%3 = icmp ne i32 %1, -1
tail call void @llvm.assume(i1 %3)
%4 = sub nsw i32 0, %1
%5 = srem i32 %0, %4
ret i32 %5
}
setlin_(n) int *n;
{ setlinestyle(*n); }


x86 assembly (clang, -O0):
<setlin_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1030 <setlinestyle@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setlin_>:
mov    (%rdi),%edi
xor    %eax,%eax
jmp    1030 <setlinestyle@plt>

LLVM IR (-O0):
define i32 @setlin_(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = call i32 (i32, ...) bitcast (i32 (...)* @setlinestyle to i32 (i32, ...)*)(i32 %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
define i32 @setlin_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @setlinestyle to i32 (i32, ...)*)(i32 %2)
ret i32 undef
}
void BN_get_word(void) {}


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

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

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

LLVM IR (-O2):
define void @BN_get_word() {
ret void
}
int isOperator(char op) {
  if (op == '*' || op == '^' || op == '+' || op == '/' || op == '-')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isOperator>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x2a,%eax
je     114b <isOperator+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x5e,%eax
je     114b <isOperator+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x2b,%eax
je     114b <isOperator+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x2f,%eax
je     114b <isOperator+0x4b>
movsbl -0x5(%rbp),%eax
cmp    $0x2d,%eax
jne    1157 <isOperator+0x57>
movl   $0x1,-0x4(%rbp)
jmp    115e <isOperator+0x5e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isOperator>:
add    $0xd6,%dil
cmp    $0x34,%dil
ja     1124 <isOperator+0x24>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x1000000000002b,%rdx
bt     %rcx,%rdx
jae    1124 <isOperator+0x24>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @isOperator(i8 signext %0) {
switch i8 %0, label %2 [
i8 94, label %3
i8 47, label %3
i8 45, label %3
i8 43, label %3
i8 42, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int errno;
int open(char *, int /*<<< orphan*/);
int main(void) {
  int fd = open("xopen.c", O_RDONLY);
  return (fd <= 0 ? 1 + errno : 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%esi
lea    0xed1(%rip),%rdi
call   1030 <open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1155 <main+0x45>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115f <main+0x4f>
xor    %eax,%eax
mov    %eax,-0xc(%rbp)
jmp    115f <main+0x4f>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <open@plt>
mov    0x2eab(%rip),%rcx
mov    (%rcx),%edx
add    $0x1,%edx
xor    %ecx,%ecx
test   %eax,%eax
cmovle %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"xopen.c\00"
@O_RDONLY = global i32 0
@errno = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @O_RDONLY
%4 = call i32 @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* @errno
%9 = add nsw i32 1, %8
br label %11
10: ; preds = %0
br label %11
11: ; preds = %10, %7
%12 = phi i32 [ %9, %7 ], [ 0, %10 ]
ret i32 %12
}

LLVM IR (-O2):
@.str = [8 x i8] c"xopen.c\00"
@O_RDONLY = global i32 0
@errno = global i32 0
define i32 @main() {
%1 = load i32, i32* @O_RDONLY
%2 = tail call i32 @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @errno
%4 = add nsw i32 %3, 1
%5 = icmp sgt i32 %2, 0
%6 = select i1 %5, i32 0, i32 %4
ret i32 %6
}
regx0indreg1_set(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{ (p0[x0]) = (*p1); }


x86 assembly (clang, -O0):
<regx0indreg1_set>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%dx
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dx,(%rax,%rcx,2)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<regx0indreg1_set>:
movzwl (%r9),%eax
movslq %edx,%rcx
mov    %ax,(%r8,%rcx,2)
ret

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

LLVM IR (-O2):
define i32 @regx0indreg1_set(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture writeonly %4, i16* nocapture %5) {
%7 = load i16, i16* %5
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds i16, i16* %4, i64 %8
store i16 %7, i16* %9
ret i32 undef
}
/* Variables and functions */
scalar_t__ allocate(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
void string_copy(char **dest, const char *src) {
  *dest = (char *)allocate(strlen(src) + 1);
  strcpy(*dest, src);
}


x86 assembly (clang, -O0):
<string_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <allocate@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_copy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <allocate@plt>
mov    %rax,(%r14)
mov    %rax,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define void @string_copy(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = call i64 @allocate(i64 %7)
%9 = inttoptr i64 %8 to i8*
%10 = load i8**, i8*** %3
store i8* %9, i8** %10
%11 = load i8**, i8*** %3
%12 = load i8*, i8** %11
%13 = load i8*, i8** %4
%14 = call i32 @strcpy(i8* %12, i8* %13)
ret void
}

LLVM IR (-O2):
define void @string_copy(i8** nocapture writeonly %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = add nsw i64 %3, 1
%5 = tail call i64 @allocate(i64 %4)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %0
%7 = tail call i32 @strcpy(i8* %6, i8* %1)
ret void
}
void plugin_exit_iconv(void) {}


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

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

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

LLVM IR (-O2):
define void @plugin_exit_iconv() {
ret void
}
unsigned int DRV_SDMMC_USB_STATUS(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @DRV_SDMMC_USB_STATUS() {
ret i32 0
}
int gt(long x, long y) { return x > y; }


x86 assembly (clang, -O0):
<gt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gt>:
xor    %eax,%eax
cmp    %rsi,%rdi
setg   %al
ret

LLVM IR (-O0):
define i32 @gt(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 = icmp sgt i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @gt(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ bind_assert(int /*<<< orphan*/, char *);
void *realloc(void *, size_t);
void *bind_safe_realloc(void *p, size_t c, size_t s) {
  void *ret = realloc(p, c * s);
  bind_assert(ret != NULL, "realloc failed");
  return ret;
}


x86 assembly (clang, -O0):
<bind_safe_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
imul   -0x18(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
lea    0xea2(%rip),%rsi
call   1040 <bind_assert@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bind_safe_realloc>:
push   %rbx
imul   %rdx,%rsi
call   1030 <realloc@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
lea    0xec3(%rip),%rsi
call   1040 <bind_assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"realloc failed\00"
define i8* @bind_safe_realloc(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = mul i64 %9, %10
%12 = call i8* @realloc(i8* %8, i64 %11)
store i8* %12, i8** %7
%13 = load i8*, i8** %7
%14 = icmp ne i8* %13, null
%15 = zext i1 %14 to i32
%16 = call i32 @bind_assert(i32 %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%17 = load i8*, i8** %7
ret i8* %17
}

LLVM IR (-O2):
@.str = [15 x i8] c"realloc failed\00"
define noalias i8* @bind_safe_realloc(i8* nocapture %0, i64 %1, i64 %2) {
%4 = mul i64 %2, %1
%5 = tail call i8* @realloc(i8* %0, i64 %4)
%6 = icmp ne i8* %5, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @bind_assert(i32 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i8* %5
}
/* Type definitions */
struct in6_addr {
  int dummy;
};
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ AF_INET6;
scalar_t__ inet_ntop(int /*<<< orphan*/, struct in6_addr *, char *, int);
char *in6toa(struct in6_addr addr6) {
  static char buf[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"];
  char *ret = (char *)inet_ntop(AF_INET6, &addr6, buf, sizeof(buf));
  if (ret == NULL) {
    buf[0] = '\0';
  }
  return (ret);
}


x86 assembly (clang, -O0):
<in6toa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
lea    0x2f11(%rip),%rdx
mov    $0x28,%ecx
call   1030 <inet_ntop@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114f <in6toa+0x3f>
movb   $0x0,0x2ef1(%rip)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<in6toa>:
push   %rax
mov    %edi,(%rsp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x2f1c(%rip),%rdx
mov    %rsp,%rsi
mov    $0x28,%ecx
call   1030 <inet_ntop@plt>
test   %rax,%rax
je     1138 <in6toa+0x28>
pop    %rcx
ret
movb   $0x0,0x2f01(%rip)
pop    %rcx
ret

LLVM IR (-O0):
%struct.in6_addr = type { i32 }
@in6toa.buf = internal global [40 x i8] zeroinitializer
@AF_INET6 = global i32 0
define i8* @in6toa(i32 %0) {
%2 = alloca %struct.in6_addr
%3 = alloca i8*
%4 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %2, i32 0, i32 0
store i32 %0, i32* %4
%5 = load i32, i32* @AF_INET6
%6 = call i64 @inet_ntop(i32 %5, %struct.in6_addr* %2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @in6toa.buf, i64 0, i64 0), i32 40)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %1
store i8 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @in6toa.buf, i64 0, i64 0)
br label %11
11: ; preds = %10, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
%struct.in6_addr = type { i32 }
@in6toa.buf = internal global [40 x i8] zeroinitializer
@AF_INET6 = global i32 0
define i8* @in6toa(i32 %0) {
%2 = alloca %struct.in6_addr
%3 = getelementptr inbounds %struct.in6_addr, %struct.in6_addr* %2, i64 0, i32 0
store i32 %0, i32* %3
%4 = load i32, i32* @AF_INET6
%5 = call i64 @inet_ntop(i32 %4, %struct.in6_addr* %2, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @in6toa.buf, i64 0, i64 0), i32 40)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @in6toa.buf, i64 0, i64 0)
br label %8
8: ; preds = %7, %1
%9 = inttoptr i64 %5 to i8*
ret i8* %9
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ ftell(int /*<<< orphan*/ *);
int64_t fsize(FILE *f) {
  int64_t end, pos = ftell(f);
  fseek(f, 0, SEEK_END);
  end = ftell(f);
  fseek(f, pos, SEEK_SET);
  return end;
}


x86 assembly (clang, -O0):
<fsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea5(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <ftell@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    0x2e72(%rip),%rax
mov    (%rax),%edx
call   1040 <fseek@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsize>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <ftell@plt>
mov    %eax,%r14d
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %eax,%ebp
mov    0x2e85(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <fseek@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @fsize(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @ftell(i32* %5)
store i32 %6, i32* %4
%7 = load i32*, i32** %2
%8 = load i32, i32* @SEEK_END
%9 = call i32 @fseek(i32* %7, i32 0, i32 %8)
%10 = load i32*, i32** %2
%11 = call i32 @ftell(i32* %10)
store i32 %11, i32* %3
%12 = load i32*, i32** %2
%13 = load i32, i32* %4
%14 = load i32, i32* @SEEK_SET
%15 = call i32 @fseek(i32* %12, i32 %13, i32 %14)
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @fsize(i32* nocapture %0) {
%2 = tail call i32 @ftell(i32* %0)
%3 = load i32, i32* @SEEK_END
%4 = tail call i32 @fseek(i32* %0, i32 0, i32 %3)
%5 = tail call i32 @ftell(i32* %0)
%6 = load i32, i32* @SEEK_SET
%7 = tail call i32 @fseek(i32* %0, i32 %2, i32 %6)
ret i32 %5
}
int ffi_closure_free(struct ffi_closure_t *c) {}


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

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

LLVM IR (-O0):
%struct.ffi_closure_t = type opaque
define i32 @ffi_closure_free(%struct.ffi_closure_t* %0) {
%2 = alloca i32
%3 = alloca %struct.ffi_closure_t*
store %struct.ffi_closure_t* %0, %struct.ffi_closure_t** %3
%4 = load i32, i32* %2
ret i32 %4
}

LLVM IR (-O2):
%struct.ffi_closure_t = type opaque
define i32 @ffi_closure_free(%struct.ffi_closure_t* nocapture readnone %0) {
ret i32 undef
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void SysCtlPeripheralDeepSleepEnable(uint32_t ui32Peripheral) {
  ;
  (*((volatile uint32_t
          *)(((uint32_t)(0x400fe800 + ((ui32Peripheral & 0xff00) >> 8)) &
              0xF0000000) |
             0x02000000 |
             (((uint32_t)(0x400fe800 + ((ui32Peripheral & 0xff00) >> 8)) &
               0x000FFFFF)
              << 5) |
             ((ui32Peripheral & 0xff) << 2)))) = 1;
}


x86 assembly (clang, -O0):
<SysCtlPeripheralDeepSleepEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
add    $0x400fe800,%eax
and    $0xf0000000,%eax
or     $0x2000000,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
add    $0x400fe800,%ecx
and    $0xfffff,%ecx
shl    $0x5,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x2,%ecx
or     %ecx,%eax
mov    %eax,%eax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlPeripheralDeepSleepEnable>:
movzbl %dil,%eax
shr    $0x3,%edi
and    $0x1fe0,%edi
shl    $0x2,%eax
or     %edi,%eax
movl   $0x1,0x43fd0000(%rax)
ret

LLVM IR (-O0):
define void @SysCtlPeripheralDeepSleepEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65280
%5 = ashr i32 %4, 8
%6 = add nsw i32 1074784256, %5
%7 = and i32 %6, -268435456
%8 = or i32 %7, 33554432
%9 = load i32, i32* %2
%10 = and i32 %9, 65280
%11 = ashr i32 %10, 8
%12 = add nsw i32 1074784256, %11
%13 = and i32 %12, 1048575
%14 = shl i32 %13, 5
%15 = or i32 %8, %14
%16 = load i32, i32* %2
%17 = and i32 %16, 255
%18 = shl i32 %17, 2
%19 = or i32 %15, %18
%20 = zext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
store volatile i32 1, i32* %21
ret void
}

LLVM IR (-O2):
define void @SysCtlPeripheralDeepSleepEnable(i32 %0) {
%2 = lshr i32 %0, 3
%3 = and i32 %2, 8160
%4 = shl i32 %0, 2
%5 = and i32 %4, 1020
%6 = or i32 %5, %3
%7 = or i32 %6, 1140654080
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store volatile i32 1, i32* %9
ret void
}
void set_bit(char *buf, int idx, int is_one) {
  unsigned char bit = 1 << (0x7 - (idx & 0x7));
  if (is_one)
    buf[idx / 8] |= bit;
  else
    buf[idx / 8] &= ~bit;
}


x86 assembly (clang, -O0):
<set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x7,%eax
mov    $0x7,%ecx
sub    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %al,-0x11(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     115d <set_bit+0x5d>
movzbl -0x11(%rbp),%esi
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edx
or     %esi,%edx
mov    %dl,(%rax,%rcx,1)
jmp    1189 <set_bit+0x89>
movzbl -0x11(%rbp),%esi
xor    $0xffffffff,%esi
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edx
and    %esi,%edx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit>:
mov    %esi,%ecx
not    %cl
and    $0x7,%cl
mov    $0x1,%r8d
shl    %cl,%r8d
lea    0x7(%rsi),%ecx
test   %esi,%esi
cmovns %esi,%ecx
sar    $0x3,%ecx
movslq %ecx,%rsi
mov    (%rdi,%rsi,1),%cl
mov    %r8d,%eax
not    %al
and    %cl,%al
or     %r8b,%cl
test   %edx,%edx
movzbl %cl,%ecx
movzbl %al,%eax
cmovne %ecx,%eax
mov    %al,(%rdi,%rsi,1)
ret

LLVM IR (-O0):
define void @set_bit(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = and i32 %8, 7
%10 = sub nsw i32 7, %9
%11 = shl i32 1, %10
%12 = trunc i32 %11 to i8
store i8 %12, i8* %7
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %3
%16 = load i8, i8* %7
%17 = zext i8 %16 to i32
%18 = load i8*, i8** %4
%19 = load i32, i32* %5
%20 = sdiv i32 %19, 8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = or i32 %24, %17
%26 = trunc i32 %25 to i8
store i8 %26, i8* %22
br label %40
27: ; preds = %3
%28 = load i8, i8* %7
%29 = zext i8 %28 to i32
%30 = xor i32 %29, -1
%31 = load i8*, i8** %4
%32 = load i32, i32* %5
%33 = sdiv i32 %32, 8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %31, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = and i32 %37, %30
%39 = trunc i32 %38 to i8
store i8 %39, i8* %35
br label %40
40: ; preds = %27, %15
ret void
}

LLVM IR (-O2):
define void @set_bit(i8* nocapture %0, i32 %1, i32 %2) {
%4 = and i32 %1, 7
%5 = xor i32 %4, 7
%6 = shl nuw i32 1, %5
%7 = icmp eq i32 %2, 0
%8 = sdiv i32 %1, 8
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = trunc i32 %6 to i8
%13 = xor i8 %12, -1
%14 = and i8 %11, %13
%15 = or i8 %11, %12
%16 = select i1 %7, i8 %14, i8 %15
store i8 %16, i8* %10
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, char *);
void usage(char *pname) {
  printf("\n\n"
         "usage: %s [-x xtnum] <list of FITS files>\n"
         "usage: %s [-x xtnum] -\n"
         "\n"
         "The former version expects file names.\n"
         "The latter expects data coming in from stdin.\n"
         "\n"
         "-x xtnum specifies the extension header to print\n"
         "-x 0     specifies main header + all extensions\n"
         "\n\n",
         pname, pname);
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [254 x i8] c"\0A\0Ausage: %s [-x xtnum] <list of FITS files>\0Ausage: %s [-x xtnum] -\0A\0AThe former version expects file names.\0AThe latter expects data coming in from stdin.\0A\0A-x xtnum specifies the extension header to print\0A-x 0 specifies main header + all extensions\0A\0A\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([254 x i8], [254 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [254 x i8] c"\0A\0Ausage: %s [-x xtnum] <list of FITS files>\0Ausage: %s [-x xtnum] -\0A\0AThe former version expects file names.\0AThe latter expects data coming in from stdin.\0A\0A-x xtnum specifies the extension header to print\0A-x 0 specifies main header + all extensions\0A\0A\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([254 x i8], [254 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
toascii(int c) { return (c & 0x7F); }


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

x86 assembly (clang, -O2):
<toascii>:
mov    %edi,%eax
and    $0x7f,%eax
ret

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

LLVM IR (-O2):
define i32 @toascii(i32 %0) {
%2 = and i32 %0, 127
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() { printf("\nusage: rm (/path/to/FILE)\n\n"); }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"\0Ausage: rm (/path/to/FILE)\0A\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [28 x i8] c"\0Ausage: rm (/path/to/FILE)\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret void
}
unsigned int cpuid_ebx(int op) {
  unsigned int eax, ebx;
  __asm__("cpuid" : "=a"(eax), "=b"(ebx) : "0"(op) : "cx", "dx");
  return ebx;
}


x86 assembly (clang, -O0):
<cpuid_ebx>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cpuid
mov    %eax,-0x10(%rbp)
mov    %ebx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_ebx>:
push   %rbx
mov    %edi,%eax
cpuid
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @cpuid_ebx(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call { i32, i32 } asm "cpuid", "={ax},={bx},0,~{cx},~{dx},~{dirflag},~{fpsr},~{flags}"(i32 %5)
%7 = extractvalue { i32, i32 } %6, 0
%8 = extractvalue { i32, i32 } %6, 1
store i32 %7, i32* %3
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @cpuid_ebx(i32 %0) {
%2 = tail call { i32, i32 } asm "cpuid", "={ax},={bx},0,~{cx},~{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
%3 = extractvalue { i32, i32 } %2, 1
ret i32 %3
}
long factorial(int n) {
  if (n == 0 || n == 1)
    return 1;
  return n * factorial(n - 1);
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     112f <factorial+0x1f>
cmpl   $0x1,-0xc(%rbp)
jne    113c <factorial+0x2c>
movq   $0x1,-0x8(%rbp)
jmp    115e <factorial+0x4e>
movslq -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <factorial@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
mov    $0x1,%eax
cmp    $0x2,%edi
jb     1130 <factorial+0x30>
movslq %edi,%rcx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
imul   %rcx,%rax
add    $0xffffffffffffffff,%rcx
test   $0xfffffffe,%ecx
jne    1120 <factorial+0x20>
ret

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

LLVM IR (-O2):
define i64 @factorial(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = sext i32 %0 to i64
br label %5
5: ; preds = %3, %5
%6 = phi i64 [ %4, %3 ], [ %8, %5 ]
%7 = phi i64 [ 1, %3 ], [ %9, %5 ]
%8 = add nsw i64 %6, -1
%9 = mul nsw i64 %7, %6
%10 = and i64 %8, 4294967294
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %1
%13 = phi i64 [ 1, %1 ], [ %9, %5 ]
ret i64 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void clock(void) { printf("In the clock\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"In the clock\00"
define void @clock() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void get_architecture(void) { printf("ZARCH"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"ZARCH\00"
define void @get_architecture() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
void ft_get_values(char **data, char **dest, char **src) {
  *dest = data[0];
  *src = data[1];
}


x86 assembly (clang, -O0):
<ft_get_values>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_get_values>:
mov    (%rdi),%rax
mov    %rax,(%rsi)
mov    0x8(%rdi),%rax
mov    %rax,(%rdx)
ret

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

LLVM IR (-O2):
define void @ft_get_values(i8** nocapture %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
%4 = load i8*, i8** %0
store i8* %4, i8** %1
%5 = getelementptr inbounds i8*, i8** %0, i64 1
%6 = load i8*, i8** %5
store i8* %6, i8** %2
ret void
}
void foo394(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo394(i32 %0) {
ret void
}
/* Type definitions */
struct UPnPService {
  int dummy;
};
struct UPnPDevice {
  int dummy;
};

/* Variables and functions */
struct UPnPService *CPGetService(struct UPnPDevice *, char *, int);
struct UPnPService *CPGetService_DeviceProtection(struct UPnPDevice *device) {
  return (CPGetService(device,
                       "urn:schemas-upnp-org:service:DeviceProtection:1", 47));
}


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

x86 assembly (clang, -O2):
<CPGetService_DeviceProtection>:
lea    0xee9(%rip),%rsi
mov    $0x2f,%edx
jmp    1030 <CPGetService@plt>

LLVM IR (-O0):
%struct.UPnPService = type { i32 }
%struct.UPnPDevice = type { i32 }
@.str = [48 x i8] c"urn:schemas-upnp-org:service:DeviceProtection:1\00"
define %struct.UPnPService* @CPGetService_DeviceProtection(%struct.UPnPDevice* %0) {
%2 = alloca %struct.UPnPDevice*
store %struct.UPnPDevice* %0, %struct.UPnPDevice** %2
%3 = load %struct.UPnPDevice*, %struct.UPnPDevice** %2
%4 = call %struct.UPnPService* @CPGetService(%struct.UPnPDevice* %3, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 47)
ret %struct.UPnPService* %4
}

LLVM IR (-O2):
%struct.UPnPService = type { i32 }
%struct.UPnPDevice = type { i32 }
@.str = [48 x i8] c"urn:schemas-upnp-org:service:DeviceProtection:1\00"
define %struct.UPnPService* @CPGetService_DeviceProtection(%struct.UPnPDevice* %0) {
%2 = tail call %struct.UPnPService* @CPGetService(%struct.UPnPDevice* %0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 47)
ret %struct.UPnPService* %2
}
int COLS() { return 80; }


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

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

LLVM IR (-O0):
define i32 @COLS() {
ret i32 80
}

LLVM IR (-O2):
define i32 @COLS() {
ret i32 80
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void cbfunc_show_elems(void *data, void *magic) {
  int *i = data;
  printf("i value %d\n", *i);
}


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

x86 assembly (clang, -O2):
<cbfunc_show_elems>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"i value %d\0A\00"
define void @cbfunc_show_elems(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"i value %d\0A\00"
define void @cbfunc_show_elems(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
int ft_tolower(int c) {
  if (c >= 'A' && c <= 'Z')
    return (c - ('A' - 'a'));
  else
    return (c);
}


x86 assembly (clang, -O0):
<ft_tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     1129 <ft_tolower+0x29>
cmpl   $0x5a,-0x8(%rbp)
jg     1129 <ft_tolower+0x29>
mov    -0x8(%rbp),%eax
sub    $0xffffffe0,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <ft_tolower+0x2f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_tolower>:
lea    -0x41(%rdi),%ecx
lea    0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_tolower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ w5100_write_byte(int, unsigned int);
void w5100_writeIMR(unsigned data) { w5100_write_byte(0x0016, data); }


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

x86 assembly (clang, -O2):
mov    %edi,%esi
mov    $0x16,%edi
jmp    1030 <w5100_write_byte@plt>

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

LLVM IR (-O2):
define void @w5100_writeIMR(i32 %0) {
%2 = tail call i32 @w5100_write_byte(i32 22, i32 %0)
ret void
}
double jac_chain_nm7_sign(double x) { return x < 0 ? -1 : x > 0 ? 1 : x; }


x86 assembly (clang, -O0):
<jac_chain_nm7_sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1129 <jac_chain_nm7_sign+0x29>
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1161 <jac_chain_nm7_sign+0x61>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114d <jac_chain_nm7_sign+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1157 <jac_chain_nm7_sign+0x57>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<jac_chain_nm7_sign>:
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm0,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
andnpd %xmm0,%xmm2
orpd   %xmm3,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm2,%xmm1
movsd  0xed2(%rip),%xmm2
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @jac_chain_nm7_sign(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %6
5: ; preds = %1
br label %14
6: ; preds = %1
%7 = load double, double* %2
%8 = fcmp ogt double %7, 0.000000e+00
br i1 %8, label %9, label %10
9: ; preds = %6
br label %12
10: ; preds = %6
%11 = load double, double* %2
br label %12
12: ; preds = %10, %9
%13 = phi double [ 1.000000e+00, %9 ], [ %11, %10 ]
br label %14
14: ; preds = %12, %5
%15 = phi double [ -1.000000e+00, %5 ], [ %13, %12 ]
ret double %15
}

LLVM IR (-O2):
define double @jac_chain_nm7_sign(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp ogt double %0, 0.000000e+00
%4 = select i1 %3, double 1.000000e+00, double %0
%5 = select i1 %2, double -1.000000e+00, double %4
ret double %5
}