xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ food;

/* Variables and functions */
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main() {
  char food[5];
  printf("Enter smth: ");
  fgets(food, sizeof(food), stdin);
  printf("Result: %s\n", food);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x5(%rbp),%rdi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   1040 <fgets@plt>
lea    -0x5(%rbp),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%edx
lea    0xb(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1040 <fgets@plt>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Enter smth: \00"
@stdin = global i32 0
@.str.1 = [12 x i8] c"Result: %s\0A\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 5, i32 %4)
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Enter smth: \00"
@stdin = global i32 0
@.str.1 = [12 x i8] c"Result: %s\0A\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 5, i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
void check_tls(struct context *c) {}


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

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

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

LLVM IR (-O2):
%struct.context = type opaque
define void @check_tls(%struct.context* nocapture %0) {
ret void
}
/* Type definitions */
struct list_ip {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ list_ip_free_callback(struct list_ip *, int,
                                         int /*<<< orphan*/ *);
void list_ip_free(struct list_ip *target) {
  list_ip_free_callback(target, true, NULL);
}


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

x86 assembly (clang, -O2):
<list_ip_free>:
mov    $0x1,%esi
xor    %edx,%edx
jmp    1030 <list_ip_free_callback@plt>

LLVM IR (-O0):
%struct.list_ip = type { i32 }
define void @list_ip_free(%struct.list_ip* %0) {
%2 = alloca %struct.list_ip*
store %struct.list_ip* %0, %struct.list_ip** %2
%3 = load %struct.list_ip*, %struct.list_ip** %2
%4 = call i32 @list_ip_free_callback(%struct.list_ip* %3, i32 1, i32* null)
ret void
}

LLVM IR (-O2):
%struct.list_ip = type { i32 }
define void @list_ip_free(%struct.list_ip* %0) {
%2 = tail call i32 @list_ip_free_callback(%struct.list_ip* %0, i32 1, i32* null)
ret void
}
/* Variables and functions */
scalar_t__ _islower(char);
scalar_t__ _isupper(char);
int _isalpha(char c) { return _isupper(c) || _islower(c); }


x86 assembly (clang, -O0):
<_isalpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <_isupper@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    115c <_isalpha+0x3c>
movsbl -0x1(%rbp),%edi
call   1030 <_islower@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_isalpha>:
push   %rbx
mov    %edi,%ebx
call   1040 <_isupper@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <_isalpha+0x17>
pop    %rbx
ret
movsbl %bl,%edi
call   1030 <_islower@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_isalpha(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @_isupper(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call i64 @_islower(i8 signext %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @_isalpha(i8 signext %0) {
%2 = tail call i64 @_isupper(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @_islower(i8 signext %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
unsigned addval_496(unsigned x) { return x + 3229929097U; }


x86 assembly (clang, -O0):
<addval_496>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc084ce89,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<addval_496>:
lea    -0x3f7b3177(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @addval_496(i32 %0) {
%2 = add i32 %0, -1065038199
ret i32 %2
}
int _IBNbDigits(unsigned long x) {
  int d = 1;
  while (x >= 10) {
    ++d;
    x /= 10;
  }
  return d;
}


x86 assembly (clang, -O0):
<_IBNbDigits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpq   $0xa,-0x8(%rbp)
jb     113a <_IBNbDigits+0x3a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x8(%rbp)
jmp    110f <_IBNbDigits+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_IBNbDigits>:
mov    $0x1,%ecx
cmp    $0xa,%rdi
jb     1136 <_IBNbDigits+0x36>
mov    $0x1,%ecx
movabs $0xcccccccccccccccd,%rsi
cc cc cc
nopw   0x0(%rax,%rax,1)
add    $0x1,%ecx
mov    %rdi,%rax
mul    %rsi
shr    $0x3,%rdx
cmp    $0x63,%rdi
mov    %rdx,%rdi
ja     1120 <_IBNbDigits+0x20>
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @_IBNbDigits(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
store i32 1, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i64, i64* %2
%6 = icmp uge i64 %5, 10
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
store i32 %9, i32* %3
%10 = load i64, i64* %2
%11 = udiv i64 %10, 10
store i64 %11, i64* %2
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @_IBNbDigits(i64 %0) {
%2 = icmp ugt i64 %0, 9
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 1, %1 ]
%5 = phi i64 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = udiv i64 %5, 10
%8 = icmp ugt i64 %5, 99
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 1, %1 ], [ %6, %3 ]
ret i32 %10
}
float Exp10(int n) {
  int i;
  float result = 1;
  for (i = n; i; i--)
    result *= 10;
  return result;
}


x86 assembly (clang, -O0):
<Exp10>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movss  0xef1(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1144 <Exp10+0x44>
movss  0xed8(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    111a <Exp10+0x1a>
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Exp10>:
test   %edi,%edi
je     1134 <Exp10+0x34>
lea    -0x1(%rdi),%eax
mov    %edi,%ecx
and    $0x7,%ecx
je     113d <Exp10+0x3d>
xor    %edx,%edx
movss  0xee8(%rip),%xmm0
movss  0xee4(%rip),%xmm1
mulss  %xmm1,%xmm0
add    $0x1,%edx
cmp    %edx,%ecx
jne    1120 <Exp10+0x20>
sub    %edx,%edi
cmp    $0x7,%eax
jae    114a <Exp10+0x4a>
jmp    1185 <Exp10+0x85>
movss  0xec4(%rip),%xmm0
ret
movss  0xebb(%rip),%xmm0
cmp    $0x7,%eax
jb     1185 <Exp10+0x85>
movss  0xeb2(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
add    $0xfffffff8,%edi
jne    1160 <Exp10+0x60>
ret

LLVM IR (-O0):
define float @Exp10(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
store i32 %0, i32* %2
store float 1.000000e+00, float* %4
%5 = load i32, i32* %2
store i32 %5, i32* %3
br label %6
6: ; preds = %12, %1
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = load float, float* %4
%11 = fmul float %10, 1.000000e+01
store float %11, float* %4
br label %12
12: ; preds = %9
%13 = load i32, i32* %3
%14 = add nsw i32 %13, -1
store i32 %14, i32* %3
br label %6
15: ; preds = %6
%16 = load float, float* %4
ret float %16
}

LLVM IR (-O2):
define float @Exp10(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %33, label %3
3: ; preds = %1
%4 = add i32 %0, -1
%5 = and i32 %0, 7
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %3, %7
%8 = phi float [ %11, %7 ], [ 1.000000e+00, %3 ]
%9 = phi i32 [ %12, %7 ], [ %0, %3 ]
%10 = phi i32 [ %13, %7 ], [ 0, %3 ]
%11 = fmul float %8, 1.000000e+01
%12 = add nsw i32 %9, -1
%13 = add i32 %10, 1
%14 = icmp eq i32 %13, %5
br i1 %14, label %15, label %7
15: ; preds = %7, %3
%16 = phi float [ undef, %3 ], [ %11, %7 ]
%17 = phi float [ 1.000000e+00, %3 ], [ %11, %7 ]
%18 = phi i32 [ %0, %3 ], [ %12, %7 ]
%19 = icmp ult i32 %4, 7
br i1 %19, label %33, label %20
20: ; preds = %15, %20
%21 = phi float [ %30, %20 ], [ %17, %15 ]
%22 = phi i32 [ %31, %20 ], [ %18, %15 ]
%23 = fmul float %21, 1.000000e+01
%24 = fmul float %23, 1.000000e+01
%25 = fmul float %24, 1.000000e+01
%26 = fmul float %25, 1.000000e+01
%27 = fmul float %26, 1.000000e+01
%28 = fmul float %27, 1.000000e+01
%29 = fmul float %28, 1.000000e+01
%30 = fmul float %29, 1.000000e+01
%31 = add nsw i32 %22, -8
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %20
33: ; preds = %15, %20, %1
%34 = phi float [ 1.000000e+00, %1 ], [ %16, %15 ], [ %30, %20 ]
ret float %34
}
int read(int fd, char *buf, int nbytes) {
  (void)fd;
  (void)buf;
  (void)nbytes;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @read(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @read(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ assert(char const *);
char *strdup(char const *);
char *xstrdup(const char *s) {
  char *ptr;
  assert(s);
  ptr = strdup(s);
  if (!ptr)
    abort();
  return ptr;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1164 <xstrdup+0x34>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1050 <strdup@plt>
test   %rax,%rax
je     1148 <xstrdup+0x18>
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @assert(i8* %4)
%6 = load i8*, i8** %2
%7 = call i8* @strdup(i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
define noalias i8* @xstrdup(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i8* @strdup(i8* %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %1
ret i8* %3
}
/* Variables and functions */
int atoi(char *);
char *strchr(char *, char);
int readp1_int(char *line) {
  ;
  line = strchr(line, '(');
  line += sizeof(char);
  char *endvaluepos = strchr(line, ')');
  *endvaluepos = 0;
  return atoi(line);
}


x86 assembly (clang, -O0):
<readp1_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x28,%esi
call   1030 <strchr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x29,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <atoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readp1_int>:
push   %rbx
mov    $0x28,%esi
call   1030 <strchr@plt>
lea    0x1(%rax),%rbx
mov    %rbx,%rdi
mov    $0x29,%esi
call   1030 <strchr@plt>
movb   $0x0,(%rax)
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <atoi@plt>

LLVM IR (-O0):
define i32 @readp1_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strchr(i8* %4, i8 signext 40)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = call i8* @strchr(i8* %8, i8 signext 41)
store i8* %9, i8** %3
%10 = load i8*, i8** %3
store i8 0, i8* %10
%11 = load i8*, i8** %2
%12 = call i32 @atoi(i8* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @readp1_int(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 40)
%3 = getelementptr inbounds i8, i8* %2, i64 1
%4 = tail call i8* @strchr(i8* %3, i8 signext 41)
store i8 0, i8* %4
%5 = tail call i32 @atoi(i8* %3)
ret i32 %5
}
/* Variables and functions */
int strlen(char *);
void chomp(char *str) {
  int i;
  char *c;
  if (*str == '\0')
    return;
  i = strlen(str) - 1;
  c = str + i;
  if (*c == '\n')
    *c = '\0';
}


x86 assembly (clang, -O0):
<chomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1131 <chomp+0x21>
jmp    1166 <chomp+0x56>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    1166 <chomp+0x56>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp>:
push   %rbx
cmpb   $0x0,(%rdi)
je     112c <chomp+0x1c>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    112c <chomp+0x1c>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @chomp(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = tail call i32 @strlen(i8* %0)
%6 = add nsw i32 %5, -1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 10
br i1 %10, label %11, label %12
11: ; preds = %4
store i8 0, i8* %8
br label %12
12: ; preds = %4, %11, %1
ret void
}
/* Variables and functions */
int f(int);
int /*<<< orphan*/ printf(char *, int);
int g(int param1) {
  int g1;
  printf("g(%d)\n", param1);
  g1 = param1;
  if (param1 > 1) {
    g1 = f(param1 - 1);
  }
  return g1;
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1158 <g+0x38>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <f@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
cmp    $0x2,%ebx
jl     1141 <g+0x21>
add    $0xffffffff,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <f@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"g(%d)\0A\00"
define i32 @g(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = add nsw i32 %0, -1
%6 = tail call i32 @f(i32 %5)
br label %7
7: ; preds = %4, %1
%8 = phi i32 [ %6, %4 ], [ %0, %1 ]
ret i32 %8
}
void msg(who, count) char *who;
int count;
{ printf("%s: MESSAGE %d\n", who, count); }


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

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"%s: MESSAGE %d\0A\00"
define void @msg(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void copy4(unsigned char *out, uint32_t const x) {
  out[0] = (unsigned char)(x);
  out[1] = (unsigned char)(x >> 8);
  out[2] = (unsigned char)(x >> 16);
  out[3] = (unsigned char)(x >> 24);
}


x86 assembly (clang, -O0):
<copy4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
sar    $0x18,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy4>:
mov    %esi,(%rdi)
ret

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

LLVM IR (-O2):
define void @copy4(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %1, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %1, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
/* Variables and functions */
double coshf(double);
double cosh(double arg) { return coshf(arg); }


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

x86 assembly (clang, -O2):
<cosh>:
jmp    1030 <coshf@plt>

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

LLVM IR (-O2):
define double @cosh(double %0) {
%2 = tail call double @coshf(double %0)
ret double %2
}
/* Variables and functions */
int gcd(int, int);
unsigned long long solve(int a, int b) {
  int g = 0;
  unsigned long long lcm = 0;
  g = gcd(a, b);
  lcm = (unsigned long long)a * (unsigned long long)b / g;
  return lcm;
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <gcd@plt>
mov    %eax,-0xc(%rbp)
movslq -0x4(%rbp),%rax
movslq -0x8(%rbp),%rcx
imul   %rcx,%rax
movslq -0xc(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <gcd@plt>
mov    %eax,%ecx
movslq %ebp,%rdx
movslq %ebx,%rax
imul   %rdx,%rax
movslq %ecx,%rsi
mov    %rax,%rdx
or     %rsi,%rdx
shr    $0x20,%rdx
je     113e <solve+0x2e>
xor    %edx,%edx
div    %rsi
jmp    1142 <solve+0x32>
xor    %edx,%edx
div    %ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i64 @solve(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
store i64 0, i64* %6
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @gcd(i32 %7, i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = mul i64 %11, %13
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = udiv i64 %14, %16
store i64 %17, i64* %6
%18 = load i64, i64* %6
ret i64 %18
}

LLVM IR (-O2):
define i64 @solve(i32 %0, i32 %1) {
%3 = tail call i32 @gcd(i32 %0, i32 %1)
%4 = sext i32 %0 to i64
%5 = sext i32 %1 to i64
%6 = mul nsw i64 %5, %4
%7 = sext i32 %3 to i64
%8 = udiv i64 %6, %7
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ gcd(int, int);
int main() {
  for (int i = 0; i < 10; ++i) {
    gcd(i, 2 * i + 1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    114f <main+0x3f>
mov    -0x8(%rbp),%edi
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
add    $0x1,%esi
call   1030 <gcd@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <gcd@plt>
mov    $0x1,%edi
mov    $0x3,%esi
call   1030 <gcd@plt>
mov    $0x2,%edi
mov    $0x5,%esi
call   1030 <gcd@plt>
mov    $0x3,%edi
mov    $0x7,%esi
call   1030 <gcd@plt>
mov    $0x4,%edi
mov    $0x9,%esi
call   1030 <gcd@plt>
mov    $0x5,%edi
mov    $0xb,%esi
call   1030 <gcd@plt>
mov    $0x6,%edi
mov    $0xd,%esi
call   1030 <gcd@plt>
mov    $0x7,%edi
mov    $0xf,%esi
call   1030 <gcd@plt>
mov    $0x8,%edi
mov    $0x11,%esi
call   1030 <gcd@plt>
mov    $0x9,%edi
mov    $0x13,%esi
call   1030 <gcd@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @gcd(i32 0, i32 1)
%2 = tail call i32 @gcd(i32 1, i32 3)
%3 = tail call i32 @gcd(i32 2, i32 5)
%4 = tail call i32 @gcd(i32 3, i32 7)
%5 = tail call i32 @gcd(i32 4, i32 9)
%6 = tail call i32 @gcd(i32 5, i32 11)
%7 = tail call i32 @gcd(i32 6, i32 13)
%8 = tail call i32 @gcd(i32 7, i32 15)
%9 = tail call i32 @gcd(i32 8, i32 17)
%10 = tail call i32 @gcd(i32 9, i32 19)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double const, double const, double const);
void glmPrintVector3d(const double v[3]) {
  printf("[%f,%f,%f]", v[0], v[1], v[2]);
}


x86 assembly (clang, -O0):
<glmPrintVector3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm2
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmPrintVector3d>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
movsd  0x10(%rdi),%xmm2
lea    0xedb(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"[%f,%f,%f]\00"
define void @glmPrintVector3d(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 1
%8 = load double, double* %7
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 2
%11 = load double, double* %10
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %5, double %8, double %11)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"[%f,%f,%f]\00"
define void @glmPrintVector3d(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = getelementptr inbounds double, double* %0, i64 2
%6 = load double, double* %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %2, double %4, double %6)
ret void
}
txt_noteon(chan, pitch, vol) {
  prtime();
  printf("Note on, chan=%d pitch=%d vol=%d\n", chan + 1, pitch, vol);
}


x86 assembly (clang, -O0):
<txt_noteon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1040 <prtime@plt>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<txt_noteon>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <prtime@plt>
add    $0x1,%ebx
lea    0xec4(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Note on, chan=%d pitch=%d vol=%d\0A\00"
define i32 @txt_noteon(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = call i32 (...) @prtime()
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11, i32 %12)
%14 = load i32, i32* %4
ret i32 %14
}

LLVM IR (-O2):
@.str = [34 x i8] c"Note on, chan=%d pitch=%d vol=%d\0A\00"
define i32 @txt_noteon(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @prtime()
%5 = add nsw i32 %0, 1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %1, i32 %2)
ret i32 undef
}
/* Variables and functions */
char *oak_malloc(int);
char *chrtostr(char c) {
  char *s = oak_malloc(2);
  *s = c;
  s[1] = 0;
  return s;
}


x86 assembly (clang, -O0):
<chrtostr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x2,%edi
call   1030 <oak_malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x1(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chrtostr>:
push   %rbx
mov    %edi,%ebx
mov    $0x2,%edi
call   1030 <oak_malloc@plt>
mov    %bl,(%rax)
movb   $0x0,0x1(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define i8* @chrtostr(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8*
store i8 %0, i8* %2
%4 = call i8* @oak_malloc(i32 2)
store i8* %4, i8** %3
%5 = load i8, i8* %2
%6 = load i8*, i8** %3
store i8 %5, i8* %6
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8 0, i8* %8
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @chrtostr(i8 signext %0) {
%2 = tail call i8* @oak_malloc(i32 2)
store i8 %0, i8* %2
%3 = getelementptr inbounds i8, i8* %2, i64 1
store i8 0, i8* %3
ret i8* %2
}
/* Type definitions */
struct inode {
  int dummy;
};
struct dentry {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pr_debug(char *, struct dentry *, int);
int vfs_whiteout(struct inode *, struct dentry *);
int ovl_do_whiteout(struct inode *dir, struct dentry *dentry) {
  int err = vfs_whiteout(dir, dentry);
  pr_debug("whiteout(%pd2) = %i\n", dentry, err);
  return err;
}


x86 assembly (clang, -O0):
<ovl_do_whiteout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <vfs_whiteout@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xeb2(%rip),%rdi
call   1040 <pr_debug@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ovl_do_whiteout>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <vfs_whiteout@plt>
mov    %eax,%ebp
lea    0xecc(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <pr_debug@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.inode = type { i32 }
%struct.dentry = type { i32 }
@.str = [21 x i8] c"whiteout(%pd2) = %i\0A\00"
define i32 @ovl_do_whiteout(%struct.inode* %0, %struct.dentry* %1) {
%3 = alloca %struct.inode*
%4 = alloca %struct.dentry*
%5 = alloca i32
store %struct.inode* %0, %struct.inode** %3
store %struct.dentry* %1, %struct.dentry** %4
%6 = load %struct.inode*, %struct.inode** %3
%7 = load %struct.dentry*, %struct.dentry** %4
%8 = call i32 @vfs_whiteout(%struct.inode* %6, %struct.dentry* %7)
store i32 %8, i32* %5
%9 = load %struct.dentry*, %struct.dentry** %4
%10 = load i32, i32* %5
%11 = call i32 @pr_debug(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.dentry* %9, i32 %10)
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
%struct.inode = type { i32 }
%struct.dentry = type { i32 }
@.str = [21 x i8] c"whiteout(%pd2) = %i\0A\00"
define i32 @ovl_do_whiteout(%struct.inode* %0, %struct.dentry* %1) {
%3 = tail call i32 @vfs_whiteout(%struct.inode* %0, %struct.dentry* %1)
%4 = tail call i32 @pr_debug(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %struct.dentry* %1, i32 %3)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *progname) {
  fprintf(stderr, ("Usage: %s [-r] [-t]\n"), progname);
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s [-r] [-t]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s [-r] [-t]\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
void kolibri_add_recent(const char *string, void *p) {}


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

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

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

LLVM IR (-O2):
define void @kolibri_add_recent(i8* nocapture %0, i8* nocapture %1) {
ret void
}
void PDMCritSectLeave(void) {}


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

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

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

LLVM IR (-O2):
define void @PDMCritSectLeave() {
ret void
}
/* Type definitions */
struct fopen_obj {
  int dummy;
};

/* Variables and functions */
int fopen__close(struct fopen_obj *);
int teardown(struct fopen_obj *f) { return fopen__close(f); }


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

x86 assembly (clang, -O2):
<teardown>:
jmp    1030 <fopen__close@plt>

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

LLVM IR (-O2):
%struct.fopen_obj = type { i32 }
define i32 @teardown(%struct.fopen_obj* %0) {
%2 = tail call i32 @fopen__close(%struct.fopen_obj* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ PoiLocationHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void PoiLocationRequestUpdate() { UAVObjRequestUpdate(PoiLocationHandle()); }


x86 assembly (clang, -O0):
<PoiLocationRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <PoiLocationHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PoiLocationRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1030 <PoiLocationHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @PoiLocationRequestUpdate() {
%1 = call i32 (...) @PoiLocationHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @PoiLocationRequestUpdate() {
%1 = tail call i32 (...) @PoiLocationHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int const);
int /*<<< orphan*/ stderr;
void line_notification(const int line_num) {
  fprintf(stderr, "ERROR FOUND ON LINE: %d.\n", line_num);
}


x86 assembly (clang, -O0):
<line_notification>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xed2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<line_notification>:
mov    %edi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [26 x i8] c"ERROR FOUND ON LINE: %d.\0A\00"
define void @line_notification(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @stderr
%4 = load i32, i32* %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"ERROR FOUND ON LINE: %d.\0A\00"
define void @line_notification(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
int f(void) {
  extern int test(void);
  return test();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
call   1030 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
jmp    1030 <test@plt>

LLVM IR (-O0):
define i32 @f() {
%1 = call i32 @test()
ret i32 %1
}

LLVM IR (-O2):
define i32 @f() {
%1 = tail call i32 @test()
ret i32 %1
}
void motion_pin_config(void) {}


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

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

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

LLVM IR (-O2):
define void @motion_pin_config() {
ret void
}
int test_imm_94int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x94 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_94int64_midword_mem>:
testb  $0x94,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_94int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 148
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_94int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 9699328
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned xstrlen(const char *s) {
  unsigned count = 0;
  if (s != 0) {
    while (*s) {
      s++;
      count++;
    }
  }
  return count;
}


x86 assembly (clang, -O0):
<xstrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114b <xstrlen+0x4b>
jmp    111f <xstrlen+0x1f>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <xstrlen+0x46>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <xstrlen+0x1f>
jmp    114b <xstrlen+0x4b>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @xstrlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %10, %6 ], [ 0, %3 ]
%8 = phi i8* [ %9, %6 ], [ %0, %3 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = add i32 %7, 1
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %10, %6 ]
ret i32 %14
}
void bs2000_os_is_not_here() {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @bs2000_os_is_not_here() {
ret void
}
void errput(str) const char *str;
{ write(2, str, strlen(str)); }


x86 assembly (clang, -O0):
<errput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %rax,%rdx
mov    $0x2,%edi
mov    $0x0,%al
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errput>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @errput(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 2, i8* %3, i64 %5)
ret void
}

LLVM IR (-O2):
define void @errput(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 2, i8* %0, i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(int);
void uninitvar_isdigit(void) {
  int i;
  (void)isdigit(i);
}


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

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

LLVM IR (-O0):
define void @uninitvar_isdigit() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @isdigit(i32 %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_isdigit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0xe2() {
  Assert_real((isspace(226) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              1135, ("isspace should be 0 for 0xe2"));
}


x86 assembly (clang, -O0):
<t_isspace_0xe2>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe2,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x46f,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isspace_0xe2>:
push   %rax
mov    $0xe2,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x46f,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0xe2\00"
define void @t_isspace_0xe2() {
%1 = call i64 @isspace(i32 226)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1135, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0xe2\00"
define void @t_isspace_0xe2() {
%1 = tail call i64 @isspace(i32 226)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1135, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
long long build_value(unsigned long long, int);
unsigned long long extract_value(long long, int *);
long long int intSign(long long int x) {
  int sgn;
  unsigned long long int v = extract_value(x, &sgn);
  if (v == 0)
    sgn = 0;
  else
    v = 1;
  return build_value(v, sgn);
}


x86 assembly (clang, -O0):
<intSign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <extract_value@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1154 <intSign+0x34>
movl   $0x0,-0xc(%rbp)
jmp    115c <intSign+0x3c>
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <build_value@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intSign>:
push   %rax
lea    0x4(%rsp),%rsi
call   1040 <extract_value@plt>
test   %rax,%rax
je     113b <intSign+0x1b>
mov    $0x1,%edi
mov    0x4(%rsp),%esi
jmp    1147 <intSign+0x27>
movl   $0x0,0x4(%rsp)
xor    %esi,%esi
xor    %edi,%edi
call   1030 <build_value@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i64 @intSign(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i64
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = call i64 @extract_value(i64 %5, i32* %3)
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %3
br label %11
10: ; preds = %1
store i64 1, i64* %4
br label %11
11: ; preds = %10, %9
%12 = load i64, i64* %4
%13 = load i32, i32* %3
%14 = call i64 @build_value(i64 %12, i32 %13)
ret i64 %14
}

LLVM IR (-O2):
define i64 @intSign(i64 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i64 @extract_value(i64 %0, i32* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = load i32, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %6, %8
%10 = phi i32 [ 0, %8 ], [ %7, %6 ]
%11 = phi i64 [ 0, %8 ], [ 1, %6 ]
%12 = call i64 @build_value(i64 %11, i32 %10)
ret i64 %12
}