xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, char *);
void print_cifs_mount_version(void) {
  printf("mount.cifs version: %s.%s%s\n", "1", "14", "");
}


x86 assembly (clang, -O0):
<print_cifs_mount_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xefb(%rip),%rsi
lea    0xef6(%rip),%rdx
lea    0xeec(%rip),%rcx
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_cifs_mount_version>:
lea    0xee9(%rip),%rdi
lea    0xeff(%rip),%rsi
lea    0xefa(%rip),%rdx
lea    0xef0(%rip),%rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"mount.cifs version: %s.%s%s\0A\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [3 x i8] c"14\00"
@.str.3 = [1 x i8] zeroinitializer
define void @print_cifs_mount_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"mount.cifs version: %s.%s%s\0A\00"
@.str.1 = [2 x i8] c"1\00"
@.str.2 = [3 x i8] c"14\00"
@.str.3 = [1 x i8] zeroinitializer
define void @print_cifs_mount_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test() { printf("Test\n"); }


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"Test\00"
define void @test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  unsigned char c = argv[1][0];
  if (c > 127)
    printf("win\n");
  else
    printf("lose\n");
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
movzbl -0x11(%rbp),%eax
cmp    $0x7f,%eax
jle    1151 <main+0x41>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
jmp    115d <main+0x4d>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rax
cmpb   $0x0,(%rax)
lea    0xee6(%rip),%rax
lea    0xeda(%rip),%rdi
cmovs  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [5 x i8] c"lose\00"
@str.2 = [4 x i8] c"win\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = icmp slt i8 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}
adr0reg1_set(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (*((float *)10000000)) = r1; }


x86 assembly (clang, -O0):
<adr0reg1_set>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movss  -0xc(%rbp),%xmm0
mov    $0x989680,%eax
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adr0reg1_set>:
cvtsd2ss %xmm1,%xmm0
movss  %xmm0,0x989680
ret

LLVM IR (-O0):
define i32 @adr0reg1_set(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float, float* %9
store float %16, float* inttoptr (i64 10000000 to float*)
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @adr0reg1_set(double %0, double %1, i32 %2, i32 %3, float* nocapture readnone %4, float* nocapture readnone %5) {
%7 = fptrunc double %1 to float
store float %7, float* inttoptr (i64 10000000 to float*)
ret i32 undef
}
/* Variables and functions */
char *ft_strchr(const char *s, char c) {
  while (*s != c && *s != '\0')
    s++;
  if (*s == c)
    return ((char *)s);
  return (NULL);
}


x86 assembly (clang, -O0):
<ft_strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
movsbl -0x11(%rbp),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x12(%rbp)
je     1136 <ft_strchr+0x36>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1146 <ft_strchr+0x46>
jmp    1157 <ft_strchr+0x57>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110e <ft_strchr+0xe>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1177 <ft_strchr+0x77>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    117f <ft_strchr+0x7f>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strchr>:
add    $0xffffffffffffffff,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x1(%rdi),%ecx
add    $0x1,%rdi
cmp    %sil,%cl
je     1121 <ft_strchr+0x21>
test   %cl,%cl
jne    1110 <ft_strchr+0x10>
xor    %eax,%eax
cmp    %sil,%cl
cmove  %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @ft_strchr(i8* %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %9, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, %1
%7 = icmp eq i8 %5, 0
%8 = or i1 %6, %7
%9 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %8, label %10, label %3
10: ; preds = %3
%11 = select i1 %6, i8* %4, i8* null
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void *resize(void *, size_t, size_t);
void *resize_or_die(void *p, size_t old, size_t new) {
  p = resize(p, old, new);
  {
    if (!(p || !new)) {
      perror("memory allocation failed");
      exit(EXIT_FAILURE);
    }
  };
  return p;
}


x86 assembly (clang, -O0):
<resize_or_die>:
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
mov    -0x18(%rbp),%rdx
call   1030 <resize@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1189 <resize_or_die+0x59>
cmpq   $0x0,-0x18(%rbp)
je     1189 <resize_or_die+0x59>
lea    0xe8a(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resize_or_die>:
push   %rbx
mov    %rdx,%rbx
call   1030 <resize@plt>
test   %rbx,%rbx
je     1143 <resize_or_die+0x13>
test   %rax,%rax
je     1145 <resize_or_die+0x15>
pop    %rbx
ret
lea    0xeb4(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"memory allocation failed\00"
@EXIT_FAILURE = global i32 0
define i8* @resize_or_die(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i64, i64* %5
%9 = load i64, i64* %6
%10 = call i8* @resize(i8* %7, i64 %8, i64 %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = icmp ne i8* %11, null
br i1 %12, label %20, label %13
13: ; preds = %3
%14 = load i64, i64* %6
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %13, %3
%21 = load i8*, i8** %4
ret i8* %21
}

LLVM IR (-O2):
@.str = [25 x i8] c"memory allocation failed\00"
@EXIT_FAILURE = global i32 0
define i8* @resize_or_die(i8* %0, i64 %1, i64 %2) {
%4 = tail call i8* @resize(i8* %0, i64 %1, i64 %2)
%5 = icmp eq i8* %4, null
%6 = icmp ne i64 %2, 0
%7 = and i1 %6, %5
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = tail call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %3
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void asctohex(unsigned char *asc, size_t size) {
  size_t i;
  for (i = 0; i < size; i++)
    printf("%02x", asc[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<asctohex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1161 <asctohex+0x51>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <asctohex+0x18>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asctohex>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1158 <asctohex+0x38>
mov    %rsi,%r12
mov    %rdi,%r14
lea    0xec6(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <asctohex+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @asctohex(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
store i64 0, i64* %5
br label %6
6: ; preds = %17, %2
%7 = load i64, i64* %5
%8 = load i64, i64* %4
%9 = icmp ult i64 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i64, i64* %5
%13 = getelementptr inbounds i8, i8* %11, i64 %12
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i64, i64* %5
%19 = add i64 %18, 1
store i64 %19, i64* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
define void @asctohex(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %10, %4 ], [ 0, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = add nuw i64 %5, 1
%11 = icmp eq i64 %10, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %2
%13 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int t = 1;
  int i;
  for (i = 2; i <= 5;) {
    t = t * i;
    i = i + 1;
  }
  printf("t=%d\n", t);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jg     114f <main+0x3f>
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"t=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 120)
ret i32 0
}
void ierror(s) char *s;
{
  char buffer[256];
  sprintf(buffer, "error evaluating built in function [%s]", s);
  gerror(buffer);
}


x86 assembly (clang, -O0):
<ierror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x110(%rbp),%rdi
mov    $0x0,%al
call   1030 <gerror@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ierror>:
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%rdx
lea    0xece(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <gerror@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"error evaluating built in function [%s]\00"
define void @ierror(i8* %0) {
%2 = alloca i8*
%3 = alloca [256 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* %4, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @gerror to i32 (i8*, ...)*)(i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"error evaluating built in function [%s]\00"
define void @ierror(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 (i8*, i8*, ...) @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @gerror to i32 (i8*, ...)*)(i8* %3)
ret void
}
/* Variables and functions */
char *classify(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  char *input = "hel8lo9";
  char *output = (char *)malloc(sizeof(char) * 50);
  output = classify(input);
  printf("%s", output);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    $0x32,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <classify@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x32,%edi
call   1050 <malloc@plt>
lea    0xebe(%rip),%rdi
call   1040 <classify@plt>
lea    0xeba(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"hel8lo9\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = call i64 @malloc(i32 50)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %3
%6 = load i8*, i8** %2
%7 = call i8* @classify(i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"hel8lo9\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 50)
%2 = tail call i8* @classify(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
void get_board_serial(struct tag_serialnr *serialnr) {}


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

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

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

LLVM IR (-O2):
%struct.tag_serialnr = type opaque
define void @get_board_serial(%struct.tag_serialnr* nocapture %0) {
ret void
}
int __TBB_machine_fetchadd4(volatile void *ptr, int addend) {
  int result;
  __asm__ __volatile__("lock\nxaddl %0,%1"
                       : "=r"(result), "=m"(*(int *)ptr)
                       : "0"(addend), "m"(*(int *)ptr)
                       : "memory");
  return result;
}


x86 assembly (clang, -O0):
<__TBB_machine_fetchadd4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rdx
lock xadd %eax,(%rcx)
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__TBB_machine_fetchadd4>:
mov    %esi,%eax
lock xadd %eax,(%rdi)
ret

LLVM IR (-O0):
define i32 @__TBB_machine_fetchadd4(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %4
%9 = load i8*, i8** %3
%10 = bitcast i8* %9 to i32*
%11 = call i32 asm sideeffect "lock\0Axaddl $0,$1", "=r,=*m,0,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %7, i32 %8, i32* elementtype(i32) %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @__TBB_machine_fetchadd4(i8* %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = tail call i32 asm sideeffect "lock\0Axaddl $0,$1", "=r,=*m,0,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %3, i32 %1, i32* elementtype(i32) %3)
ret i32 %4
}
void clear_buf(char buf[]) {
  int i;
  i = 0;
  for (i = 0; i < 1024; i++) {
    buf[i] = 0;
  }
}


x86 assembly (clang, -O0):
<clear_buf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x400,-0xc(%rbp)
jge    113d <clear_buf+0x3d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <clear_buf+0x16>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_buf>:
push   %rax
mov    $0x400,%edx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @clear_buf(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 1024
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8 0, i8* %11
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @clear_buf(i8* nocapture writeonly %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello World\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
int search(int val, int *table, int size) {
  int i;
  for (i = 0; i < size; i++) {
    if (val <= *table++)
      return (i);
  }
  return (size);
}


x86 assembly (clang, -O0):
<search>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1159 <search+0x59>
mov    -0x8(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x4,%rdx
mov    %rdx,-0x10(%rbp)
cmp    (%rcx),%eax
jg     1146 <search+0x46>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <search+0x5f>
jmp    114b <search+0x4b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <search+0x15>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<search>:
mov    %edx,%eax
test   %edx,%edx
jle    111d <search+0x1d>
mov    %eax,%eax
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
cmp    %edi,(%rsi,%rcx,4)
jge    111e <search+0x1e>
add    $0x1,%rcx
cmp    %ecx,%eax
jne    1110 <search+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @search(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %14
5: ; preds = %3, %10
%6 = phi i32 [ %12, %10 ], [ 0, %3 ]
%7 = phi i32* [ %11, %10 ], [ %1, %3 ]
%8 = load i32, i32* %7
%9 = icmp slt i32 %8, %0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = getelementptr inbounds i32, i32* %7, i64 1
%12 = add nuw nsw i32 %6, 1
%13 = icmp eq i32 %12, %2
br i1 %13, label %14, label %5
14: ; preds = %5, %10, %3
%15 = phi i32 [ %2, %3 ], [ %2, %10 ], [ %6, %5 ]
ret i32 %15
}
const char *find_whitespace(const char *s) {
  while (1) {
    switch (*s) {
    case '\0':
    case '#':
    case ' ':
    case '\r':
    case '\n':
    case '\t':
      return s;
    default:
      ++s;
    }
  }
}


x86 assembly (clang, -O0):
<find_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1166 <find_whitespace+0x66>
jmp    111f <find_whitespace+0x1f>
mov    -0xc(%rbp),%eax
add    $0xfffffff7,%eax
sub    $0x2,%eax
jb     1166 <find_whitespace+0x66>
jmp    1133 <find_whitespace+0x33>
mov    -0xc(%rbp),%eax
sub    $0xd,%eax
je     1166 <find_whitespace+0x66>
jmp    1144 <find_whitespace+0x44>
mov    -0xc(%rbp),%eax
sub    $0x20,%eax
je     1166 <find_whitespace+0x66>
jmp    1155 <find_whitespace+0x55>
mov    -0xc(%rbp),%eax
sub    $0x23,%eax
jne    116c <find_whitespace+0x6c>
jmp    1166 <find_whitespace+0x66>
mov    -0x8(%rbp),%rax
pop    %rbp
ret
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <find_whitespace+0x8>

x86 assembly (clang, -O2):
<find_whitespace>:
mov    %rdi,%rax
movabs $0x900002601,%rcx
jmp    1114 <find_whitespace+0x14>
nop
add    $0x1,%rax
movsbl (%rax),%edx
cmp    $0x23,%edx
ja     1110 <find_whitespace+0x10>
bt     %rdx,%rcx
jae    1110 <find_whitespace+0x10>
ret

LLVM IR (-O0):
define i8* @find_whitespace(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %12
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %9 [
i32 0, label %7
i32 35, label %7
i32 32, label %7
i32 13, label %7
i32 10, label %7
i32 9, label %7
]
7: ; preds = %3, %3, %3, %3, %3, %3
%8 = load i8*, i8** %2
ret i8* %8
9: ; preds = %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %2
br label %12
12: ; preds = %9
br label %3
}

LLVM IR (-O2):
define i8* @find_whitespace(i8* %0) {
br label %2
2: ; preds = %1, %7
%3 = phi i8* [ %0, %1 ], [ %8, %7 ]
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %7 [
i32 0, label %6
i32 35, label %6
i32 32, label %6
i32 13, label %6
i32 10, label %6
i32 9, label %6
]
6: ; preds = %2, %2, %2, %2, %2, %2
ret i8* %3
7: ; preds = %2
%8 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
}
int test_008(int a, int c, int b, int d) { return (d & 1) + a + b + c; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x1,%eax
add    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
and    $0x1,%ecx
lea    (%rdi,%rsi,1),%eax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_008(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = and i32 %9, 1
%11 = load i32, i32* %5
%12 = add nsw i32 %10, %11
%13 = load i32, i32* %7
%14 = add nsw i32 %12, %13
%15 = load i32, i32* %6
%16 = add nsw i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @test_008(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = and i32 %3, 1
%6 = add i32 %1, %0
%7 = add i32 %6, %2
%8 = add i32 %7, %5
ret i32 %8
}
/* Type definitions */
struct adbuf {
  int dummy;
};

/* Variables and functions */
int adbuf_add(struct adbuf *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int adbuf_strcat(struct adbuf *b, char *string) {
  return adbuf_add(b, string, strlen(string));
}


x86 assembly (clang, -O0):
<adbuf_strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <adbuf_add@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adbuf_strcat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <adbuf_add@plt>

LLVM IR (-O0):
%struct.adbuf = type { i32 }
define i32 @adbuf_strcat(%struct.adbuf* %0, i8* %1) {
%3 = alloca %struct.adbuf*
%4 = alloca i8*
store %struct.adbuf* %0, %struct.adbuf** %3
store i8* %1, i8** %4
%5 = load %struct.adbuf*, %struct.adbuf** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @adbuf_add(%struct.adbuf* %5, i8* %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.adbuf = type { i32 }
define i32 @adbuf_strcat(%struct.adbuf* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @adbuf_add(%struct.adbuf* %0, i8* %1, i32 %3)
ret i32 %4
}
void error(const char *format, ...) {}


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

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

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

LLVM IR (-O2):
define void @error(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
char *concat(char const *, char *, char *);
char *HTMLGenA(const char *innerHTML) {
  return concat(innerHTML, "<a>", "</a>");
}


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

x86 assembly (clang, -O2):
<HTMLGenA>:
lea    0xee9(%rip),%rsi
lea    0xee6(%rip),%rdx
jmp    1030 <concat@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"<a>\00"
@.str.1 = [5 x i8] c"</a>\00"
define i8* @HTMLGenA(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @concat(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [4 x i8] c"<a>\00"
@.str.1 = [5 x i8] c"</a>\00"
define i8* @HTMLGenA(i8* %0) {
%2 = tail call i8* @concat(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ FIONREAD;
scalar_t__ ioctl(int /*<<< orphan*/, int /*<<< orphan*/, char *);
int typeahead(void) {
  int x;
  return ((ioctl(0, FIONREAD, (char *)&x) < 0) ? 0 : x);
}


x86 assembly (clang, -O0):
<typeahead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    -0x4(%rbp),%rdx
xor    %edi,%edi
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    1140 <typeahead+0x30>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <typeahead+0x36>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<typeahead>:
push   %rbx
sub    $0x10,%rsp
mov    0x2ecc(%rip),%rax
mov    (%rax),%esi
xor    %ebx,%ebx
lea    0xc(%rsp),%rdx
xor    %edi,%edi
call   1030 <ioctl@plt>
test   %rax,%rax
js     1135 <typeahead+0x25>
mov    0xc(%rsp),%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@FIONREAD = global i32 0
define i32 @typeahead() {
%1 = alloca i32
%2 = load i32, i32* @FIONREAD
%3 = bitcast i32* %1 to i8*
%4 = call i64 @ioctl(i32 0, i32 %2, i8* %3)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
br label %9
7: ; preds = %0
%8 = load i32, i32* %1
br label %9
9: ; preds = %7, %6
%10 = phi i32 [ 0, %6 ], [ %8, %7 ]
ret i32 %10
}

LLVM IR (-O2):
@FIONREAD = global i32 0
define i32 @typeahead() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @FIONREAD
%4 = call i64 @ioctl(i32 0, i32 %3, i8* %2)
%5 = icmp slt i64 %4, 0
%6 = load i32, i32* %1
%7 = select i1 %5, i32 0, i32 %6
ret i32 %7
}
/* Variables and functions */
int shmget(int, int, int);
int open_shmem(int key, int memsize) { return shmget(key, memsize, 0660); }


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

x86 assembly (clang, -O2):
<open_shmem>:
mov    $0x1b0,%edx
jmp    1030 <shmget@plt>

LLVM IR (-O0):
define i32 @open_shmem(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 = call i32 @shmget(i32 %5, i32 %6, i32 432)
ret i32 %7
}

LLVM IR (-O2):
define i32 @open_shmem(i32 %0, i32 %1) {
%3 = tail call i32 @shmget(i32 %0, i32 %1, i32 432)
ret i32 %3
}
/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int /*<<< orphan*/ rd_key;
};
struct TYPE_5__ {
  TYPE_1__ u;
  int /*<<< orphan*/ grand_rounds;
};
typedef TYPE_2__ CAMELLIA_KEY;

/* Variables and functions */
int /*<<< orphan*/ Camellia_DecryptBlock_Rounds(int /*<<< orphan*/,
                                                unsigned char const *,
                                                int /*<<< orphan*/,
                                                unsigned char *);
void Camellia_decrypt(const unsigned char *in, unsigned char *out,
                      const CAMELLIA_KEY *key) {
  Camellia_DecryptBlock_Rounds(key->grand_rounds, in, key->u.rd_key, out);
}


x86 assembly (clang, -O0):
<Camellia_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rcx
call   1030 <Camellia_DecryptBlock_Rounds@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Camellia_decrypt>:
mov    %rsi,%rcx
mov    %rdi,%rsi
mov    (%rdx),%eax
mov    0x4(%rdx),%edi
mov    %eax,%edx
jmp    1030 <Camellia_DecryptBlock_Rounds@plt>

LLVM IR (-O0):
%struct.TYPE_5__ = type { %struct.TYPE_4__, i32 }
%struct.TYPE_4__ = type { i32 }
define void @Camellia_decrypt(i8* %0, i8* %1, %struct.TYPE_5__* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.TYPE_5__*
store i8* %0, i8** %4
store i8* %1, i8** %5
store %struct.TYPE_5__* %2, %struct.TYPE_5__** %6
%7 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%8 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %7, i32 0, i32 1
%9 = load i32, i32* %8
%10 = load i8*, i8** %4
%11 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%12 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %11, i32 0, i32 0
%13 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = load i8*, i8** %5
%16 = call i32 @Camellia_DecryptBlock_Rounds(i32 %9, i8* %10, i32 %14, i8* %15)
ret void
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { %struct.TYPE_4__, i32 }
%struct.TYPE_4__ = type { i32 }
define void @Camellia_decrypt(i8* %0, i8* %1, %struct.TYPE_5__* nocapture %2) {
%4 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i64 0, i32 1
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %2, i64 0, i32 0, i32 0
%7 = load i32, i32* %6
%8 = tail call i32 @Camellia_DecryptBlock_Rounds(i32 %5, i8* %0, i32 %7, i8* %1)
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t swap32(uint64_t x) {
  uint32_t out;
  out = ((x & 0xffull) << 24) | (((x & 0xff00ull) >> 8) << 16) |
        (((x & 0xff0000ull) >> 16) << 8) | (((x & 0xff000000ull) >> 24) << 0);
  return out;
}


x86 assembly (clang, -O0):
<swap32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
and    $0xff,%rax
shl    $0x18,%rax
movslq -0x4(%rbp),%rcx
and    $0xff00,%rcx
shr    $0x8,%rcx
shl    $0x10,%rcx
or     %rcx,%rax
movslq -0x4(%rbp),%rcx
and    $0xff0000,%rcx
shr    $0x10,%rcx
shl    $0x8,%rcx
or     %rcx,%rax
movslq -0x4(%rbp),%rcx
movabs $0xff000000,%rdx
and    %rdx,%rcx
shr    $0x18,%rcx
shl    $0x0,%rcx
or     %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @swap32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = and i64 %5, 255
%7 = shl i64 %6, 24
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = and i64 %9, 65280
%11 = lshr i64 %10, 8
%12 = shl i64 %11, 16
%13 = or i64 %7, %12
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = and i64 %15, 16711680
%17 = lshr i64 %16, 16
%18 = shl i64 %17, 8
%19 = or i64 %13, %18
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = and i64 %21, 4278190080
%23 = lshr i64 %22, 24
%24 = shl i64 %23, 0
%25 = or i64 %19, %24
%26 = trunc i64 %25 to i32
store i32 %26, i32* %3
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @swap32(i32 %0) {
%2 = call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
void *av_realloc(void *, int);
void *av_fast_realloc(void *ptr, int *size, int min_size) {
  if (min_size < *size)
    return ptr;
  *size = 17 * min_size / 16 + 32;
  return av_realloc(ptr, *size);
}


x86 assembly (clang, -O0):
<av_fast_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    113f <av_fast_realloc+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1169 <av_fast_realloc+0x59>
imul   $0x11,-0x1c(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
add    $0x20,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1030 <av_realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_fast_realloc>:
cmp    %edx,(%rsi)
jle    1118 <av_fast_realloc+0x8>
mov    %rdi,%rax
ret
mov    %edx,%eax
shl    $0x4,%eax
mov    %edx,%ecx
add    %eax,%ecx
lea    0xf(%rdx,%rax,1),%eax
cmovns %ecx,%eax
sar    $0x4,%eax
add    $0x20,%eax
mov    %eax,(%rsi)
mov    %eax,%esi
jmp    1030 <av_realloc@plt>

LLVM IR (-O0):
define i8* @av_fast_realloc(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = load i8*, i8** %5
store i8* %13, i8** %4
br label %24
14: ; preds = %3
%15 = load i32, i32* %7
%16 = mul nsw i32 17, %15
%17 = sdiv i32 %16, 16
%18 = add nsw i32 %17, 32
%19 = load i32*, i32** %6
store i32 %18, i32* %19
%20 = load i8*, i8** %5
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = call i8* @av_realloc(i8* %20, i32 %22)
store i8* %23, i8** %4
br label %24
24: ; preds = %14, %12
%25 = load i8*, i8** %4
ret i8* %25
}

LLVM IR (-O2):
define i8* @av_fast_realloc(i8* %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, %2
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = mul nsw i32 %2, 17
%8 = sdiv i32 %7, 16
%9 = add nsw i32 %8, 32
store i32 %9, i32* %1
%10 = tail call i8* @av_realloc(i8* %0, i32 %9)
br label %11
11: ; preds = %3, %6
%12 = phi i8* [ %10, %6 ], [ %0, %3 ]
ret i8* %12
}
/* Type definitions */
struct spwd {
  int dummy;
};
typedef enum nss_status { ____Placeholder_nss_status } nss_status;

/* Variables and functions */
int ENOENT;
int NSS_STATUS_UNAVAIL;
enum nss_status _nss_noenum_getspent_r(struct spwd *spw, char *buffer,
                                       size_t buflen, int *errnop) {
  *errnop = ENOENT;
  return NSS_STATUS_UNAVAIL;
}


x86 assembly (clang, -O0):
<_nss_noenum_getspent_r>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2ebe(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nss_noenum_getspent_r>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rcx)
mov    0x2ed6(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.spwd = type { i32 }
@ENOENT = global i32 0
@NSS_STATUS_UNAVAIL = global i32 0
define i32 @_nss_noenum_getspent_r(%struct.spwd* %0, i8* %1, i64 %2, i32* %3) {
%5 = alloca %struct.spwd*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32*
store %struct.spwd* %0, %struct.spwd** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%9 = load i32, i32* @ENOENT
%10 = load i32*, i32** %8
store i32 %9, i32* %10
%11 = load i32, i32* @NSS_STATUS_UNAVAIL
ret i32 %11
}

LLVM IR (-O2):
%struct.spwd = type { i32 }
@ENOENT = global i32 0
@NSS_STATUS_UNAVAIL = global i32 0
define i32 @_nss_noenum_getspent_r(%struct.spwd* nocapture readnone %0, i8* nocapture readnone %1, i64 %2, i32* nocapture writeonly %3) {
%5 = load i32, i32* @ENOENT
store i32 %5, i32* %3
%6 = load i32, i32* @NSS_STATUS_UNAVAIL
ret i32 %6
}
/* Variables and functions */
int potencia(int, int);
int hiperfatorial(int n) {
  if (n == 1)
    return potencia(n, n);
  return potencia(n, n) * hiperfatorial(n - 1);
}


x86 assembly (clang, -O0):
<hiperfatorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1148 <hiperfatorial+0x28>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <potencia@plt>
mov    %eax,-0x4(%rbp)
jmp    116c <hiperfatorial+0x4c>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <potencia@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <hiperfatorial@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hiperfatorial>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmp    $0x1,%edi
je     1144 <hiperfatorial+0x34>
mov    %edi,%ebx
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
mov    %ebx,%esi
call   1030 <potencia@plt>
add    $0xffffffff,%ebx
imul   %eax,%ebp
cmp    $0x1,%ebx
jne    1130 <hiperfatorial+0x20>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <potencia@plt>
imul   %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @hiperfatorial(i32 %0) {
%2 = icmp eq i32 %0, 1
br i1 %2, label %3, label %7
3: ; preds = %7, %1
%4 = phi i32 [ 1, %1 ], [ %12, %7 ]
%5 = tail call i32 @potencia(i32 1, i32 1)
%6 = mul nsw i32 %5, %4
ret i32 %6
7: ; preds = %1, %7
%8 = phi i32 [ %11, %7 ], [ %0, %1 ]
%9 = phi i32 [ %12, %7 ], [ 1, %1 ]
%10 = tail call i32 @potencia(i32 %8, i32 %8)
%11 = add nsw i32 %8, -1
%12 = mul nsw i32 %10, %9
%13 = icmp eq i32 %11, 1
br i1 %13, label %3, label %7
}
/* Variables and functions */
int /*<<< orphan*/ convey_init_term();
scalar_t__ convey_tls_init();
int ConveyInit(void) {
  static int inited;
  if (!inited) {
    if (convey_tls_init() != 0) {
      return (-1);
    }
    convey_init_term();
    inited = 1;
  }
  return (0);
}


x86 assembly (clang, -O0):
<ConveyInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cmpl   $0x0,0x2f05(%rip)
jne    1163 <ConveyInit+0x43>
mov    $0x0,%al
call   1040 <convey_tls_init@plt>
cmp    $0x0,%rax
je     1152 <ConveyInit+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    116a <ConveyInit+0x4a>
mov    $0x0,%al
call   1030 <convey_init_term@plt>
movl   $0x1,0x2ed1(%rip)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConveyInit>:
push   %rax
xor    %eax,%eax
cmpb   $0x0,0x2f0a(%rip)
jne    1140 <ConveyInit+0x20>
xor    %eax,%eax
call   1040 <convey_tls_init@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
je     1142 <ConveyInit+0x22>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <convey_init_term@plt>
movb   $0x1,0x2ee4(%rip)
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ConveyInit.inited = internal global i32 0
define i32 @ConveyInit() {
%1 = alloca i32
%2 = load i32, i32* @ConveyInit.inited
%3 = icmp ne i32 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = call i64 (...) @convey_tls_init()
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %4
store i32 -1, i32* %1
br label %11
8: ; preds = %4
%9 = call i32 (...) @convey_init_term()
store i32 1, i32* @ConveyInit.inited
br label %10
10: ; preds = %8, %0
store i32 0, i32* %1
br label %11
11: ; preds = %10, %7
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@ConveyInit.inited = internal unnamed_addr global i1 false
define i32 @ConveyInit() {
%1 = load i1, i1* @ConveyInit.inited
br i1 %1, label %7, label %2
2: ; preds = %0
%3 = tail call i64 (...) @convey_tls_init()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @convey_init_term()
store i1 true, i1* @ConveyInit.inited
br label %7
7: ; preds = %0, %5, %2
%8 = phi i32 [ -1, %2 ], [ 0, %5 ], [ 0, %0 ]
ret i32 %8
}
void f6(_Complex double a) {}


x86 assembly (clang, -O0):
<f6>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f6(double %0, double %1) {
%3 = alloca { double, double }
%4 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
store double %0, double* %4
%5 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
store double %1, double* %5
ret void
}

LLVM IR (-O2):
define void @f6(double %0, double %1) {
ret void
}