xunge/DecIR huggingface dataset:
/* Type definitions */
struct tm {
  int dummy;
};
typedef int /*<<< orphan*/ r;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ strftime(char *, int, char *, struct tm *);
char *fmt_iso8601(struct tm *tmp) {
  char buf[80];
  strftime(buf, sizeof(buf), "%FT%H:%M:%S%z", tmp);
  static char r[80];
  snprintf(r, sizeof(r), "%s\n", buf);
  return r;
}


x86 assembly (clang, -O0):
<fmt_iso8601>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x50,%esi
lea    0xec0(%rip),%rdx
call   1040 <strftime@plt>
lea    -0x60(%rbp),%rcx
lea    0x2ef0(%rip),%rdi
mov    $0x50,%esi
lea    0xeb2(%rip),%rdx
call   1030 <snprintf@plt>
lea    0x2ed8(%rip),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmt_iso8601>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%rcx
lea    0xecf(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x50,%esi
call   1040 <strftime@plt>
lea    0x2ef8(%rip),%rbx
lea    0xebf(%rip),%rdx
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r14,%rcx
call   1030 <snprintf@plt>
mov    %rbx,%rax
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [14 x i8] c"%FT%H:%M:%S%z\00"
@fmt_iso8601.r = internal global [80 x i8] zeroinitializer
@.str.1 = [4 x i8] c"%s\0A\00"
define i8* @fmt_iso8601(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca [80 x i8]
store %struct.tm* %0, %struct.tm** %2
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%5 = load %struct.tm*, %struct.tm** %2
%6 = call i32 @strftime(i8* %4, i32 80, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %struct.tm* %5)
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%8 = call i32 @snprintf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @fmt_iso8601.r, i64 0, i64 0), i32 80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @fmt_iso8601.r, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [14 x i8] c"%FT%H:%M:%S%z\00"
@fmt_iso8601.r = internal global [80 x i8] zeroinitializer
@.str.1 = [4 x i8] c"%s\0A\00"
define i8* @fmt_iso8601(%struct.tm* %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = call i32 @strftime(i8* %3, i32 80, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %struct.tm* %0)
%5 = call i32 @snprintf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @fmt_iso8601.r, i64 0, i64 0), i32 80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i8* getelementptr inbounds ([80 x i8], [80 x i8]* @fmt_iso8601.r, i64 0, i64 0)
}
int gca_search_char(const void *aa, void *bb) {
  const char a = *(const char *)aa;
  const char b = *(char *)bb;
  return (((a) > (b)) - ((b) > (a)));
}


x86 assembly (clang, -O0):
<gca_search_char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x12(%rbp)
movsbl -0x11(%rbp),%eax
movsbl -0x12(%rbp),%ecx
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
movsbl -0x12(%rbp),%ecx
movsbl -0x11(%rbp),%edx
cmp    %edx,%ecx
setg   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gca_search_char>:
mov    (%rdi),%cl
mov    (%rsi),%dl
xor    %eax,%eax
xor    %esi,%esi
cmp    %dl,%cl
setg   %al
setl   %sil
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @gca_search_char(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
store i8 %8, i8* %5
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
store i8 %10, i8* %6
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
%15 = icmp sgt i32 %12, %14
%16 = zext i1 %15 to i32
%17 = load i8, i8* %6
%18 = sext i8 %17 to i32
%19 = load i8, i8* %5
%20 = sext i8 %19 to i32
%21 = icmp sgt i32 %18, %20
%22 = zext i1 %21 to i32
%23 = sub nsw i32 %16, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @gca_search_char(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp sgt i8 %3, %4
%6 = zext i1 %5 to i32
%7 = icmp sgt i8 %4, %3
%8 = sext i1 %7 to i32
%9 = add nsw i32 %8, %6
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
char *integrity_bay_to_str(int bay, char *str) {
  if (bay == -1)
    return "n/a";
  sprintf(str, "%d", bay);
  return str;
}


x86 assembly (clang, -O0):
<integrity_bay_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    1139 <integrity_bay_to_str+0x29>
lea    0xed0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1154 <integrity_bay_to_str+0x44>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xebd(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integrity_bay_to_str>:
push   %rbx
cmp    $0xffffffff,%edi
je     112c <integrity_bay_to_str+0x1c>
mov    %rsi,%rbx
mov    %edi,%edx
lea    0xee2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
jmp    1133 <integrity_bay_to_str+0x23>
lea    0xecd(%rip),%rbx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"n/a\00"
@.str.1 = [3 x i8] c"%d\00"
define i8* @integrity_bay_to_str(i32 %0, i8* writeonly %1) {
%3 = icmp eq i32 %0, -1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %2, %4
%7 = phi i8* [ %1, %4 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %2 ]
ret i8* %7
}
int num_five_divisors(int num) {
  int count;
  if (num <= 0) {
    return (0);
  }
  count = 0;
  while ((num % 5) == 0) {
    ++count;
    num /= 5;
  }
  return (count);
}


x86 assembly (clang, -O0):
<num_five_divisors>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     111d <num_five_divisors+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    115a <num_five_divisors+0x5a>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1154 <num_five_divisors+0x54>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1124 <num_five_divisors+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_five_divisors>:
xor    %eax,%eax
test   %edi,%edi
jle    115e <num_five_divisors+0x5e>
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x21,%rdx
add    %esi,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ecx
jne    115e <num_five_divisors+0x5e>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%eax
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rdi
add    %ecx,%edi
imul   $0xcccccccd,%edi,%ecx
add    $0x19999999,%ecx
cmp    $0x33333333,%ecx
jb     1130 <num_five_divisors+0x30>
ret

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

LLVM IR (-O2):
define i32 @num_five_divisors(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = srem i32 %0, 5
%4 = icmp eq i32 %3, 0
%5 = and i1 %2, %4
br i1 %5, label %6, label %13
6: ; preds = %1, %6
%7 = phi i32 [ %9, %6 ], [ 0, %1 ]
%8 = phi i32 [ %10, %6 ], [ %0, %1 ]
%9 = add nuw nsw i32 %7, 1
%10 = sdiv i32 %8, 5
%11 = srem i32 %10, 5
%12 = icmp eq i32 %11, 0
br i1 %12, label %6, label %13
13: ; preds = %6, %1
%14 = phi i32 [ 0, %1 ], [ %9, %6 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M361_f(char *s) {
  debug("M361_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M361_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M361_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M361_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M361_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M361_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M361_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int check_scanned_votes();
int main(void) {
  bool ret;
  ret = check_scanned_votes();
  if (ret) {
    return 0;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <check_scanned_votes@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113f <main+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1146 <main+0x36>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <check_scanned_votes@plt>
cmp    $0x1,%eax
sbb    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @check_scanned_votes()
%2 = icmp eq i32 %1, 0
%3 = sext i1 %2 to i32
ret i32 %3
}
void TcpCommandClientDestroy(const void *handle) {}


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

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

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

LLVM IR (-O2):
define void @TcpCommandClientDestroy(i8* nocapture %0) {
ret void
}
unsigned long long average(unsigned long long a, unsigned long long b) {
  return (a / 2) + (b / 2) + (a & b & 1ull);
}


x86 assembly (clang, -O0):
<average>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    -0x10(%rbp),%rcx
shr    $0x1,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%rcx
and    -0x10(%rbp),%rcx
and    $0x1,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<average>:
mov    %rdi,%rcx
shr    %rcx
and    %esi,%edi
mov    %rsi,%rax
shr    %rax
add    %rcx,%rax
and    $0x1,%edi
add    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @average(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = udiv i64 %5, 2
%7 = load i64, i64* %4
%8 = udiv i64 %7, 2
%9 = add i64 %6, %8
%10 = load i64, i64* %3
%11 = load i64, i64* %4
%12 = and i64 %10, %11
%13 = and i64 %12, 1
%14 = add i64 %9, %13
ret i64 %14
}

LLVM IR (-O2):
define i64 @average(i64 %0, i64 %1) {
%3 = lshr i64 %0, 1
%4 = lshr i64 %1, 1
%5 = add nuw i64 %4, %3
%6 = and i64 %0, 1
%7 = and i64 %6, %1
%8 = add nuw i64 %5, %7
ret i64 %8
}
/* Variables and functions */
int rand();
unsigned int random_seq(void) {
  return (rand() << 16) ^ (rand() << 8) ^ rand() ^ (rand() >> 8);
}


x86 assembly (clang, -O0):
<random_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
shl    $0x10,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
shl    $0x8,%ecx
xor    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,%ecx
mov    -0x4(%rbp),%eax
sar    $0x8,%ecx
xor    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_seq>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
xor    %ebx,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
sar    $0x8,%eax
xor    %ebx,%eax
xor    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @random_seq() {
%1 = call i32 (...) @rand()
%2 = shl i32 %1, 16
%3 = call i32 (...) @rand()
%4 = shl i32 %3, 8
%5 = xor i32 %2, %4
%6 = call i32 (...) @rand()
%7 = xor i32 %5, %6
%8 = call i32 (...) @rand()
%9 = ashr i32 %8, 8
%10 = xor i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @random_seq() {
%1 = tail call i32 (...) @rand()
%2 = shl i32 %1, 16
%3 = tail call i32 (...) @rand()
%4 = shl i32 %3, 8
%5 = xor i32 %4, %2
%6 = tail call i32 (...) @rand()
%7 = xor i32 %5, %6
%8 = tail call i32 (...) @rand()
%9 = ashr i32 %8, 8
%10 = xor i32 %7, %9
ret i32 %10
}
/* Type definitions */
struct terminal_t {
  int dummy;
};
struct parm_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ move_cursor(struct terminal_t *, int, int /*<<< orphan*/);
int sum(struct parm_t *);
void curs_up(struct terminal_t *term, struct parm_t *parm) {
  int num = sum(parm);
  if (num <= 0)
    num = 1;
  move_cursor(term, -num, 0);
}


x86 assembly (clang, -O0):
<curs_up>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <sum@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     114d <curs_up+0x2d>
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
sub    -0x14(%rbp),%esi
xor    %edx,%edx
call   1040 <move_cursor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curs_up>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <sum@plt>
test   %eax,%eax
mov    $0x1,%esi
cmovg  %eax,%esi
neg    %esi
mov    %rbx,%rdi
xor    %edx,%edx
pop    %rbx
jmp    1040 <move_cursor@plt>

LLVM IR (-O0):
%struct.terminal_t = type { i32 }
%struct.parm_t = type { i32 }
define void @curs_up(%struct.terminal_t* %0, %struct.parm_t* %1) {
%3 = alloca %struct.terminal_t*
%4 = alloca %struct.parm_t*
%5 = alloca i32
store %struct.terminal_t* %0, %struct.terminal_t** %3
store %struct.parm_t* %1, %struct.parm_t** %4
%6 = load %struct.parm_t*, %struct.parm_t** %4
%7 = call i32 @sum(%struct.parm_t* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp sle i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 1, i32* %5
br label %11
11: ; preds = %10, %2
%12 = load %struct.terminal_t*, %struct.terminal_t** %3
%13 = load i32, i32* %5
%14 = sub nsw i32 0, %13
%15 = call i32 @move_cursor(%struct.terminal_t* %12, i32 %14, i32 0)
ret void
}

LLVM IR (-O2):
%struct.terminal_t = type { i32 }
%struct.parm_t = type { i32 }
define void @curs_up(%struct.terminal_t* %0, %struct.parm_t* %1) {
%3 = tail call i32 @sum(%struct.parm_t* %1)
%4 = icmp sgt i32 %3, 1
%5 = select i1 %4, i32 %3, i32 1
%6 = sub nsw i32 0, %5
%7 = tail call i32 @move_cursor(%struct.terminal_t* %0, i32 %6, i32 0)
ret void
}
/* Type definitions */
struct resource {
  int dummy;
};
struct pci_dev {
  int dummy;
};

/* Variables and functions */
int resource_alignment(struct resource *);
int pci_resource_alignment(struct pci_dev *dev, struct resource *res) {
  return resource_alignment(res);
}


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

x86 assembly (clang, -O2):
<pci_resource_alignment>:
mov    %rsi,%rdi
jmp    1030 <resource_alignment@plt>

LLVM IR (-O0):
%struct.pci_dev = type { i32 }
%struct.resource = type { i32 }
define i32 @pci_resource_alignment(%struct.pci_dev* %0, %struct.resource* %1) {
%3 = alloca %struct.pci_dev*
%4 = alloca %struct.resource*
store %struct.pci_dev* %0, %struct.pci_dev** %3
store %struct.resource* %1, %struct.resource** %4
%5 = load %struct.resource*, %struct.resource** %4
%6 = call i32 @resource_alignment(%struct.resource* %5)
ret i32 %6
}

LLVM IR (-O2):
%struct.pci_dev = type { i32 }
%struct.resource = type { i32 }
define i32 @pci_resource_alignment(%struct.pci_dev* nocapture readnone %0, %struct.resource* %1) {
%3 = tail call i32 @resource_alignment(%struct.resource* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ outb(unsigned char, unsigned char);
void pnp_write_config(unsigned char port, unsigned char value,
                      unsigned char reg) {
  outb(reg, port);
  outb(value, port + 1);
}


x86 assembly (clang, -O0):
<pnp_write_config>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
movzbl %al,%edi
movzbl -0x1(%rbp),%esi
call   1030 <outb@plt>
mov    -0x2(%rbp),%cl
movzbl -0x1(%rbp),%eax
add    $0x1,%eax
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pnp_write_config>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
mov    %edx,%edi
mov    %ebx,%esi
call   1030 <outb@plt>
lea    0x1(%rbx),%eax
movzbl %al,%esi
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @pnp_write_config(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = load i8, i8* %6
%8 = load i8, i8* %4
%9 = call i32 @outb(i8 zeroext %7, i8 zeroext %8)
%10 = load i8, i8* %5
%11 = load i8, i8* %4
%12 = zext i8 %11 to i32
%13 = add nsw i32 %12, 1
%14 = trunc i32 %13 to i8
%15 = call i32 @outb(i8 zeroext %10, i8 zeroext %14)
ret void
}

LLVM IR (-O2):
define void @pnp_write_config(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = tail call i32 @outb(i8 zeroext %2, i8 zeroext %0)
%5 = add i8 %0, 1
%6 = tail call i32 @outb(i8 zeroext %1, i8 zeroext %5)
ret void
}
char *update_path(char *path, char *key) { return path; }


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

x86 assembly (clang, -O2):
<update_path>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @update_path(i8* readnone returned %0, i8* nocapture readnone %1) {
ret i8* %0
}
unsigned char two() { return 2; }


x86 assembly (clang, -O0):
<two>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<two>:
mov    $0x2,%al
ret

LLVM IR (-O0):
define zeroext i8 @two() {
ret i8 2
}

LLVM IR (-O2):
define zeroext i8 @two() {
ret i8 2
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ EACCES;
int /*<<< orphan*/ errno;
int mkdir(const char *path, mode_t mode) {
  (void)path;
  (void)mode;
  errno = EACCES;
  return -1;
}


x86 assembly (clang, -O0):
<mkdir>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebd(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkdir>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EACCES = global i32 0
@errno = global i32 0
define i32 @mkdir(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 = load i32, i32* @EACCES
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EACCES = global i32 0
@errno = global i32 0
define i32 @mkdir(i8* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @EACCES
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
scalar_t__ rb_isalpha(int);
scalar_t__ rb_isdigit(int);
int rb_isalnum(int c) { return rb_isalpha(c) || rb_isdigit(c); }


x86 assembly (clang, -O0):
<rb_isalnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <rb_isalpha@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1157 <rb_isalnum+0x37>
mov    -0x4(%rbp),%edi
call   1040 <rb_isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @rb_isalnum(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @rb_isalpha(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i64 @rb_isdigit(i32 %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 @rb_isalnum(i32 %0) {
%2 = tail call i64 @rb_isalpha(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @rb_isdigit(i32 %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
}
int has_char(char *src, const char c) {
  int i = 0;
  while (src[i] != '\0') {
    if (src[i] == c) {
      return 1;
    }
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<has_char>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115c <has_char+0x5c>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    114e <has_char+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1163 <has_char+0x63>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1115 <has_char+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_char>:
mov    (%rdi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1120 <has_char+0x20>
add    $0x1,%rdi
nopl   0x0(%rax)
cmp    %sil,%cl
je     1121 <has_char+0x21>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <has_char+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @has_char(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %14, label %9
5: ; preds = %9
%6 = getelementptr inbounds i8, i8* %0, i64 %13
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %2, %5
%10 = phi i64 [ %13, %5 ], [ 0, %2 ]
%11 = phi i8 [ %7, %5 ], [ %3, %2 ]
%12 = icmp eq i8 %11, %1
%13 = add nuw i64 %10, 1
br i1 %12, label %14, label %5
14: ; preds = %9, %5, %2
%15 = phi i32 [ 0, %2 ], [ 0, %5 ], [ 1, %9 ]
ret i32 %15
}
/* Variables and functions */
size_t rb_scan_args_var_idx(char const *);
int rb_scan_args_f_var(const char *fmt) {
  return (fmt[rb_scan_args_var_idx(fmt)] == '*');
}


x86 assembly (clang, -O0):
<rb_scan_args_f_var>:
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   1030 <rb_scan_args_var_idx@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
movsbl (%rax,%rcx,1),%eax
cmp    $0x2a,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rb_scan_args_f_var>:
push   %rbx
mov    %rdi,%rbx
call   1030 <rb_scan_args_var_idx@plt>
xor    %ecx,%ecx
cmpb   $0x2a,(%rbx,%rax,1)
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rb_scan_args_f_var(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @rb_scan_args_var_idx(i8* %4)
%6 = getelementptr inbounds i8, i8* %3, i64 %5
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 42
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @rb_scan_args_f_var(i8* %0) {
%2 = tail call i64 @rb_scan_args_var_idx(i8* %0)
%3 = getelementptr inbounds i8, i8* %0, i64 %2
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 42
%6 = zext i1 %5 to i32
ret i32 %6
}
void picolcd_exit_backlight(struct picolcd_data *data) {}


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

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

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

LLVM IR (-O2):
%struct.picolcd_data = type opaque
define void @picolcd_exit_backlight(%struct.picolcd_data* nocapture %0) {
ret void
}
char m_toupper(char ch) {
  if (ch > 96)
    return ch - 32;
  else
    return ch;
}


x86 assembly (clang, -O0):
<m_toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x60,%eax
jle    1126 <m_toupper+0x26>
movsbl -0x2(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x1(%rbp)
jmp    112c <m_toupper+0x2c>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_toupper>:
lea    -0x20(%rdi),%eax
cmp    $0x61,%dil
movzbl %al,%eax
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @m_toupper(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sgt i32 %5, 96
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 32
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
br label %14
12: ; preds = %1
%13 = load i8, i8* %3
store i8 %13, i8* %2
br label %14
14: ; preds = %12, %7
%15 = load i8, i8* %2
ret i8 %15
}

LLVM IR (-O2):
define signext i8 @m_toupper(i8 signext %0) {
%2 = icmp sgt i8 %0, 96
%3 = add i8 %0, -32
%4 = select i1 %2, i8 %3, i8 %0
ret i8 %4
}
const char *orph_get_description(void) {
  return "Create a directory named orph_test_dir_pid, where "
         "pid is the process id.  Within that directory, "
         "create files and keep them open and unlink them. "
         "Create as many files as possible until the file system is "
         "full or the maximum allowed open files is reached. "
         "If a sleep value is specified, the process sleeps. "
         "The sleep value is given by the -p or --sleep option, "
         "otherwise it defaults to 0. "
         "Sleep is specified in milliseconds. "
         "Then close the files. "
         "If a repeat count is specified, then the task repeats "
         "that number of times. "
         "The repeat count is given by the -n or --repeat option, "
         "otherwise it defaults to 1. "
         "A repeat count of zero repeats forever. "
         "Finally remove the directory.";
}


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

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

LLVM IR (-O0):
@.str = [676 x i8] c"Create a directory named orph_test_dir_pid, where pid is the process id. Within that directory, create files and keep them open and unlink them. Create as many files as possible until the file system is full or the maximum allowed open files is reached. If a sleep value is specified, the process sleeps. The sleep value is given by the -p or --sleep option, otherwise it defaults to 0. Sleep is specified in milliseconds. Then close the files. If a repeat count is specified, then the task repeats that number of times. The repeat count is given by the -n or --repeat option, otherwise it defaults to 1. A repeat count of zero repeats forever. Finally remove the directory.\00"
define i8* @orph_get_description() {
ret i8* getelementptr inbounds ([676 x i8], [676 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [676 x i8] c"Create a directory named orph_test_dir_pid, where pid is the process id. Within that directory, create files and keep them open and unlink them. Create as many files as possible until the file system is full or the maximum allowed open files is reached. If a sleep value is specified, the process sleeps. The sleep value is given by the -p or --sleep option, otherwise it defaults to 0. Sleep is specified in milliseconds. Then close the files. If a repeat count is specified, then the task repeats that number of times. The repeat count is given by the -n or --repeat option, otherwise it defaults to 1. A repeat count of zero repeats forever. Finally remove the directory.\00"
define i8* @orph_get_description() {
ret i8* getelementptr inbounds ([676 x i8], [676 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
void should_fail() { f(-1); }


x86 assembly (clang, -O0):
<should_fail>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
call   1030 <f@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<should_fail>:
mov    $0xffffffff,%edi
jmp    1030 <f@plt>

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

LLVM IR (-O2):
define void @should_fail() {
%1 = tail call i32 @f(i32 -1)
ret void
}
int SvnRev() { return 47; }


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

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

LLVM IR (-O0):
define i32 @SvnRev() {
ret i32 47
}

LLVM IR (-O2):
define i32 @SvnRev() {
ret i32 47
}
double rad2deg(double radians) {
  return (180.0 / 3.1415926535897932384626433832795028841971) * radians;
}


x86 assembly (clang, -O0):
<rad2deg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rad2deg>:
mulsd  0xef8(%rip),%xmm0
ret

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

LLVM IR (-O2):
define double @rad2deg(double %0) {
%2 = fmul double %0, 0x404CA5DC1A63C1F8
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void UPnPFragmentedSendNotify_Destroy(void *data) { free(data); }


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

x86 assembly (clang, -O2):
<UPnPFragmentedSendNotify_Destroy>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @UPnPFragmentedSendNotify_Destroy(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ Set_CCR_Color(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ Set_RGB_LED(int /*<<< orphan*/ *);
void Set_RGB_LED_Color(uint32_t color) {
  uint16_t ccr[3];
  Set_CCR_Color(color, ccr);
  Set_RGB_LED(ccr);
}


x86 assembly (clang, -O0):
<Set_RGB_LED_Color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <Set_CCR_Color@plt>
lea    -0x10(%rbp),%rdi
call   1030 <Set_RGB_LED@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Set_RGB_LED_Color>:
push   %rbx
sub    $0x10,%rsp
lea    0x4(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <Set_CCR_Color@plt>
mov    %rbx,%rdi
call   1030 <Set_RGB_LED@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @Set_RGB_LED_Color(i32 %0) {
%2 = alloca i32
%3 = alloca [3 x i32]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%6 = call i32 @Set_CCR_Color(i32 %4, i32* %5)
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %3, i64 0, i64 0
%8 = call i32 @Set_RGB_LED(i32* %7)
ret void
}

LLVM IR (-O2):
define void @Set_RGB_LED_Color(i32 %0) {
%2 = alloca [3 x i32]
%3 = bitcast [3 x i32]* %2 to i8*
%4 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%5 = call i32 @Set_CCR_Color(i32 %0, i32* %4)
%6 = call i32 @Set_RGB_LED(i32* %4)
ret void
}
/* Variables and functions */
void *calloc(unsigned long, int);
int /*<<< orphan*/ free(void *);
void f4(int i) {
  unsigned long j;
  j = 10;
  if (i > 0) {
    void *ptr = calloc(j, i);
    free(ptr);
  }
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0xa,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1156 <f4+0x36>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
test   %edi,%edi
jle    113a <f4+0x1a>
push   %rax
mov    %edi,%esi
mov    $0xa,%edi
call   1040 <calloc@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @f4(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i8*
store i32 %0, i32* %2
store i64 10, i64* %3
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i64, i64* %3
%9 = load i32, i32* %2
%10 = call i8* @calloc(i64 %8, i32 %9)
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = call i32 @free(i8* %11)
br label %13
13: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
define void @f4(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i8* @calloc(i64 10, i32 %0)
%5 = tail call i32 @free(i8* %4)
br label %6
6: ; preds = %3, %1
ret void
}
/* Type definitions */
struct svc_req {
  int dummy;
};
struct rpc_msg {
  int dummy;
};
typedef enum auth_stat { ____Placeholder_auth_stat } auth_stat;

/* Variables and functions */
int AUTH_REJECTEDCRED;
enum auth_stat _svcauth_short(struct svc_req *rqst, struct rpc_msg *msg) {
  return AUTH_REJECTEDCRED;
}


x86 assembly (clang, -O0):
<_svcauth_short>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_svcauth_short>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.svc_req = type { i32 }
%struct.rpc_msg = type { i32 }
@AUTH_REJECTEDCRED = global i32 0
define i32 @_svcauth_short(%struct.svc_req* %0, %struct.rpc_msg* %1) {
%3 = alloca %struct.svc_req*
%4 = alloca %struct.rpc_msg*
store %struct.svc_req* %0, %struct.svc_req** %3
store %struct.rpc_msg* %1, %struct.rpc_msg** %4
%5 = load i32, i32* @AUTH_REJECTEDCRED
ret i32 %5
}

LLVM IR (-O2):
%struct.svc_req = type { i32 }
%struct.rpc_msg = type { i32 }
@AUTH_REJECTEDCRED = global i32 0
define i32 @_svcauth_short(%struct.svc_req* nocapture readnone %0, %struct.rpc_msg* nocapture readnone %1) {
%3 = load i32, i32* @AUTH_REJECTEDCRED
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void print_err(char *item, char *val) {
  fprintf(stderr, "Invalid value '%s' for item '%s'!\n", val, item);
}


x86 assembly (clang, -O0):
<print_err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xec8(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_err>:
mov    %rsi,%rdx
mov    %rdi,%rcx
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
lea    0xeda(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Invalid value '%s' for item '%s'!\0A\00"
define void @print_err(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %4
%7 = load i8*, i8** %3
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Invalid value '%s' for item '%s'!\0A\00"
define void @print_err(i8* %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ ungetc(int, int /*<<< orphan*/ *);
void skip_line(FILE *in) {
  int c;
  while ((c = fgetc(in)) != EOF && c != '\n')
    ;
  ungetc(c, in);
}


x86 assembly (clang, -O0):
<skip_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
mov    0x2ea5(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xd(%rbp)
je     1158 <skip_line+0x38>
cmpl   $0xa,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1168 <skip_line+0x48>
jmp    116d <skip_line+0x4d>
jmp    112c <skip_line+0xc>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <ungetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_line>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eba(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%eax
je     1142 <skip_line+0x22>
cmp    (%r14),%eax
jne    1130 <skip_line+0x10>
mov    %eax,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <ungetc@plt>

LLVM IR (-O0):
@EOF = global i32 0
define void @skip_line(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
br label %4
4: ; preds = %14, %1
%5 = load i32*, i32** %2
%6 = call i32 @fgetc(i32* %5)
store i32 %6, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 10
br label %12
12: ; preds = %9, %4
%13 = phi i1 [ false, %4 ], [ %11, %9 ]
br i1 %13, label %14, label %15
14: ; preds = %12
br label %4
15: ; preds = %12
%16 = load i32, i32* %3
%17 = load i32*, i32** %2
%18 = call i32 @ungetc(i32 %16, i32* %17)
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @skip_line(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
%6 = icmp ne i32 %3, 10
%7 = and i1 %6, %5
br i1 %7, label %2, label %8
8: ; preds = %2
%9 = tail call i32 @ungetc(i32 %3, i32* %0)
ret void
}
void wo_dead_local_store() {
  char not_dead[] = "Not Dead Local Store of some chars.";
  return;
}


x86 assembly (clang, -O0):
<wo_dead_local_store>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xedd(%rip),%rsi
mov    $0x24,%edx
call   1030 <memcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.wo_dead_local_store.not_dead = [36 x i8] c"Not Dead Local Store of some chars.\00"
define void @wo_dead_local_store() {
%1 = alloca [36 x i8]
%2 = bitcast [36 x i8]* %1 to i8*
ret void
}

LLVM IR (-O2):
define void @wo_dead_local_store() {
ret void
}
int dsi_init_platform_driver(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @dsi_init_platform_driver() {
ret i32 0
}
/* Type definitions */
struct rbtree {
  int dummy;
};

/* Variables and functions */
void *rb_find(struct rbtree *, void *);
void *rb_findi(struct rbtree *rb, int key) {
  return rb_find(rb, ((void *)(intptr_t)(key)));
}


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

x86 assembly (clang, -O2):
<rb_findi>:
movslq %esi,%rsi
jmp    1030 <rb_find@plt>

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

LLVM IR (-O2):
%struct.rbtree = type { i32 }
define i8* @rb_findi(%struct.rbtree* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = inttoptr i64 %3 to i8*
%5 = tail call i8* @rb_find(%struct.rbtree* %0, i8* %4)
ret i8* %5
}
int func4_in_obj(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @func4_in_obj() {
ret i32 0
}
void RTBase64EncodedLength(void) {}


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

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

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

LLVM IR (-O2):
define void @RTBase64EncodedLength() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ raise(int /*<<< orphan*/);
void terminating_signal_handler(int sig) { raise(SIGKILL); }


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

x86 assembly (clang, -O2):
<terminating_signal_handler>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <raise@plt>

LLVM IR (-O0):
@SIGKILL = global i32 0
define void @terminating_signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @SIGKILL
%4 = call i32 @raise(i32 %3)
ret void
}

LLVM IR (-O2):
@SIGKILL = global i32 0
define void @terminating_signal_handler(i32 %0) {
%2 = load i32, i32* @SIGKILL
%3 = tail call i32 @raise(i32 %2)
ret void
}
int clickplc_exe_EndOfInterrupt_enc(void *obj, unsigned char *stream) {
  int encsize = 4;
  stream[0] = 0x00;
  stream[1] = 0x82;
  stream[2] = 0xff;
  stream[3] = 0xff;
  return (encsize);
}


x86 assembly (clang, -O0):
<clickplc_exe_EndOfInterrupt_enc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movb   $0x82,0x1(%rax)
mov    -0x10(%rbp),%rax
movb   $0xff,0x2(%rax)
mov    -0x10(%rbp),%rax
movb   $0xff,0x3(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clickplc_exe_EndOfInterrupt_enc>:
movl   $0xffff8200,(%rsi)
mov    $0x4,%eax
ret

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

LLVM IR (-O2):
define i32 @clickplc_exe_EndOfInterrupt_enc(i8* nocapture readnone %0, i8* nocapture writeonly %1) {
store i8 0, i8* %1
%3 = getelementptr inbounds i8, i8* %1, i64 1
store i8 -126, i8* %3
%4 = getelementptr inbounds i8, i8* %1, i64 2
store i8 -1, i8* %4
%5 = getelementptr inbounds i8, i8* %1, i64 3
store i8 -1, i8* %5
ret i32 4
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t swap16(uint16_t x) { return (x << 8) | (x >> 8); }


x86 assembly (clang, -O0):
<swap16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap16>:
mov    %edi,%eax
shl    $0x8,%eax
sar    $0x8,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @swap16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = load i32, i32* %2
%6 = ashr i32 %5, 8
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @swap16(i32 %0) {
%2 = shl i32 %0, 8
%3 = ashr i32 %0, 8
%4 = or i32 %2, %3
ret i32 %4
}