xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ uart_send_byte(char);
void uart_send_word(char *string) {
  while (*string != '\0') {
    uart_send_byte(*string);
    string++;
  }
}


x86 assembly (clang, -O0):
<uart_send_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <uart_send_word+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <uart_send_byte@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <uart_send_word+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_send_word>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <uart_send_word+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <uart_send_byte@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <uart_send_word+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @uart_send_word(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @uart_send_byte(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
int useit(val) {
  static int usedval;
  usedval = val;
  return val + sum_upto(0);
}


x86 assembly (clang, -O0):
<useit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,0x2f08(%rip)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
xor    %edi,%edi
mov    $0x0,%al
call   1030 <sum_upto@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<useit>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
xor    %eax,%eax
call   1030 <sum_upto@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@useit.usedval = internal global i32 0
define i32 @useit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
store i32 %3, i32* @useit.usedval
%4 = load i32, i32* %2
%5 = call i32 (i32, ...) bitcast (i32 (...)* @sum_upto to i32 (i32, ...)*)(i32 0)
%6 = add nsw i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @useit(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @sum_upto to i32 (i32, ...)*)(i32 0)
%3 = add nsw i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int squareOf(int);
int main(void) {
  printf("square of 10: %d\n", squareOf(10));
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"square of 10: %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @squareOf(i32 10)
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"square of 10: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @squareOf(i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
unsigned long long mult_sum(int, unsigned long long);
unsigned long long const_time(unsigned long long max) {
  unsigned long long three_sum;
  unsigned long long five_sum;
  unsigned long long common_sum;
  max -= 1;
  three_sum = mult_sum(3, max);
  five_sum = mult_sum(5, max);
  common_sum = mult_sum(3 * 5, max);
  return three_sum + five_sum - common_sum;
}


x86 assembly (clang, -O0):
<const_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x3,%edi
call   1030 <mult_sum@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x5,%edi
call   1030 <mult_sum@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0xf,%edi
call   1030 <mult_sum@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
sub    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<const_time>:
push   %r15
push   %r14
push   %rbx
lea    -0x1(%rdi),%r15
mov    $0x3,%edi
mov    %r15,%rsi
call   1030 <mult_sum@plt>
mov    %rax,%r14
mov    $0x5,%edi
mov    %r15,%rsi
call   1030 <mult_sum@plt>
mov    %rax,%rbx
mov    $0xf,%edi
mov    %r15,%rsi
call   1030 <mult_sum@plt>
add    %r14,%rbx
sub    %rax,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @const_time(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %2
%6 = load i64, i64* %2
%7 = sub i64 %6, 1
store i64 %7, i64* %2
%8 = load i64, i64* %2
%9 = call i64 @mult_sum(i32 3, i64 %8)
store i64 %9, i64* %3
%10 = load i64, i64* %2
%11 = call i64 @mult_sum(i32 5, i64 %10)
store i64 %11, i64* %4
%12 = load i64, i64* %2
%13 = call i64 @mult_sum(i32 15, i64 %12)
store i64 %13, i64* %5
%14 = load i64, i64* %3
%15 = load i64, i64* %4
%16 = add i64 %14, %15
%17 = load i64, i64* %5
%18 = sub i64 %16, %17
ret i64 %18
}

LLVM IR (-O2):
define i64 @const_time(i64 %0) {
%2 = add i64 %0, -1
%3 = tail call i64 @mult_sum(i32 3, i64 %2)
%4 = tail call i64 @mult_sum(i32 5, i64 %2)
%5 = tail call i64 @mult_sum(i32 15, i64 %2)
%6 = add i64 %4, %3
%7 = sub i64 %6, %5
ret i64 %7
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
int same_sgn(int64_t a, int64_t b) {
  if (a >= 0 && b >= 0)
    return 1;
  if (a < 0 && b < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<same_sgn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jl     112e <same_sgn+0x2e>
cmpq   $0x0,-0x18(%rbp)
jl     112e <same_sgn+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1157 <same_sgn+0x57>
cmpq   $0x0,-0x10(%rbp)
jge    1150 <same_sgn+0x50>
cmpq   $0x0,-0x18(%rbp)
jge    1150 <same_sgn+0x50>
movl   $0xffffffff,-0x4(%rbp)
jmp    1157 <same_sgn+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<same_sgn>:
mov    %rsi,%rcx
and    %rdi,%rcx
sar    $0x3f,%rcx
or     %rdi,%rsi
mov    $0x1,%eax
cmovs  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @same_sgn(i64 %0, i64 %1) {
%3 = or i64 %1, %0
%4 = icmp sgt i64 %3, -1
%5 = and i64 %1, %0
%6 = ashr i64 %5, 63
%7 = trunc i64 %6 to i32
%8 = select i1 %4, i32 1, i32 %7
ret i32 %8
}
/* Variables and functions */
unsigned char *xsalsa12_encrypt(unsigned char *, size_t *,
                                unsigned char const *, size_t,
                                unsigned char const *, unsigned char const *);
unsigned char *crypt_encrypt_xsalsa12(unsigned char *out, size_t *out_len,
                                      const unsigned char *in, size_t in_len,
                                      const unsigned char *nonce,
                                      const unsigned char *key) {
  return xsalsa12_encrypt(out, out_len, in, in_len, nonce, key);
}


x86 assembly (clang, -O0):
<crypt_encrypt_xsalsa12>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <xsalsa12_encrypt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypt_encrypt_xsalsa12>:
jmp    1030 <xsalsa12_encrypt@plt>

LLVM IR (-O0):
define i8* @crypt_encrypt_xsalsa12(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i64*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %7
store i64* %1, i64** %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i8*, i8** %7
%14 = load i64*, i64** %8
%15 = load i8*, i8** %9
%16 = load i64, i64* %10
%17 = load i8*, i8** %11
%18 = load i8*, i8** %12
%19 = call i8* @xsalsa12_encrypt(i8* %13, i64* %14, i8* %15, i64 %16, i8* %17, i8* %18)
ret i8* %19
}

LLVM IR (-O2):
define i8* @crypt_encrypt_xsalsa12(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5) {
%7 = tail call i8* @xsalsa12_encrypt(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5)
ret i8* %7
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ foo(int);
int main(int argc, char *argv[]) {
  int n = 4096;
  if (argc > 1)
    n = atoi(argv[1]);
  foo(n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1000,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1157 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <foo@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %edi,%eax
mov    $0x1000,%edi
cmp    $0x2,%eax
jl     1138 <main+0x18>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%edi
call   1030 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ 4096, %2 ]
%10 = tail call i32 @foo(i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ nl_oom();
char *strchr(char *, char);
char *strdup(char *);
char *nl_nid_addr(char *nid) {
  char *addr, *p;
  if (!(addr = strdup(nid)))
    nl_oom();
  if ((p = strchr(addr, '@')))
    *p = '\0';
  return addr;
}


x86 assembly (clang, -O0):
<nl_nid_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    115a <nl_nid_addr+0x2a>
mov    $0x0,%al
call   1030 <nl_oom@plt>
mov    -0x10(%rbp),%rdi
mov    $0x40,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     117d <nl_nid_addr+0x4d>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nl_nid_addr>:
push   %rbx
call   1050 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1145 <nl_nid_addr+0x15>
xor    %eax,%eax
call   1030 <nl_oom@plt>
mov    %rbx,%rdi
mov    $0x40,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     115a <nl_nid_addr+0x2a>
movb   $0x0,(%rax)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @nl_nid_addr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strdup(i8* %5)
store i8* %6, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 (...) @nl_oom()
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
%12 = call i8* @strchr(i8* %11, i8 signext 64)
store i8* %12, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = load i8*, i8** %4
store i8 0, i8* %15
br label %16
16: ; preds = %14, %10
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
define i8* @nl_nid_addr(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @nl_oom()
br label %6
6: ; preds = %4, %1
%7 = tail call i8* @strchr(i8* dereferenceable(1) %2, i8 signext 64)
%8 = icmp eq i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %6
store i8 0, i8* %7
br label %10
10: ; preds = %9, %6
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ rdu(char *);
int main(int argc, char *argv[]) {
  if (argc == 1)
    rdu(".");
  else
    while (--argc)
      rdu(*++argv);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1151 <main+0x31>
lea    0xeb9(%rip),%rdi
call   1030 <rdu@plt>
jmp    118a <main+0x6a>
jmp    1156 <main+0x36>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1185 <main+0x65>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
call   1030 <rdu@plt>
jmp    1156 <main+0x36>
jmp    118a <main+0x6a>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x1,%edi
jne    113d <main+0x1d>
lea    0xecf(%rip),%rdi
call   1030 <rdu@plt>
xor    %edi,%edi
call   1040 <exit@plt>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <rdu@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1150 <main+0x30>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @rdu(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %21
10: ; preds = %2
br label %11
11: ; preds = %15, %10
%12 = load i32, i32* %4
%13 = add nsw i32 %12, -1
store i32 %13, i32* %4
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i32 1
store i8** %17, i8*** %5
%18 = load i8*, i8** %17
%19 = call i32 @rdu(i8* %18)
br label %11
20: ; preds = %11
br label %21
21: ; preds = %20, %8
%22 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = add nsw i32 %0, -1
br label %8
6: ; preds = %2
%7 = tail call i32 @rdu(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %16
8: ; preds = %4, %8
%9 = phi i32 [ %14, %8 ], [ %5, %4 ]
%10 = phi i8** [ %11, %8 ], [ %1, %4 ]
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @rdu(i8* %12)
%14 = add nsw i32 %9, -1
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %8
16: ; preds = %8, %6
%17 = tail call i32 @exit(i32 0)
unreachable
}
double berechne_durchmesser_kreis(double radius) {
  double durchmesser = radius * 2;
  return durchmesser;
}


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

x86 assembly (clang, -O2):
<berechne_durchmesser_kreis>:
addsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @berechne_durchmesser_kreis(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fmul double %4, 2.000000e+00
store double %5, double* %3
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
define double @berechne_durchmesser_kreis(double %0) {
%2 = fmul double %0, 2.000000e+00
ret double %2
}
float test_tgammaf(float x) { return __builtin_tgammaf(x); }


x86 assembly (clang, -O0):
<test_tgammaf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <tgammaf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_tgammaf>:
jmp    1030 <tgammaf@plt>

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

LLVM IR (-O2):
define float @test_tgammaf(float %0) {
%2 = tail call float @tgammaf(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  assert(2 < 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
double pow_(double, int);
int /*<<< orphan*/ printf(char *, int, double, double);
double root(int, double);
int main() {
  int n = 15;
  double x = pow_(3.14159, 15);
  printf("root(%d, %g) = %g\n", n, x, root(n, x));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf,-0x8(%rbp)
movsd  0xeb2(%rip),%xmm0
mov    $0xf,%edi
call   1040 <pow_@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
call   1050 <root@plt>
mov    -0x1c(%rbp),%esi
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xec7(%rip),%xmm0
mov    $0xf,%edi
call   1040 <pow_@plt>
movsd  %xmm0,(%rsp)
mov    $0xf,%edi
call   1050 <root@plt>
movaps %xmm0,%xmm1
lea    0xeac(%rip),%rdi
mov    $0xf,%esi
movsd  (%rsp),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"root(%d, %g) = %g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
store i32 0, i32* %1
store i32 15, i32* %2
%4 = call double @pow_(double 3.141590e+00, i32 15)
store double %4, double* %3
%5 = load i32, i32* %2
%6 = load double, double* %3
%7 = load i32, i32* %2
%8 = load double, double* %3
%9 = call double @root(i32 %7, double %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %5, double %6, double %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"root(%d, %g) = %g\0A\00"
define i32 @main() {
%1 = tail call double @pow_(double 3.141590e+00, i32 15)
%2 = tail call double @root(i32 15, double %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 15, double %1, double %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ heapify(int *, int, int);
void build_heap(int *arr, int heap_size) {
  for (int i = heap_size / 2; i >= 0; i--) {
    heapify(arr, i, heap_size);
  }
}


x86 assembly (clang, -O0):
<build_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1154 <build_heap+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <heapify@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <build_heap+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_heap>:
push   %rbp
push   %r14
push   %rbx
cmp    $0xffffffff,%esi
jl     1141 <build_heap+0x31>
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%ebp
shr    $0x1f,%ebp
add    %esi,%ebp
sar    %ebp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <heapify@plt>
add    $0xffffffff,%ebp
jb     1130 <build_heap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @build_heap(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, -2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = sdiv i32 %1, 2
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i32 [ %10, %7 ], [ %5, %4 ]
%9 = tail call i32 @heapify(i32* %0, i32 %8, i32 %1)
%10 = add nsw i32 %8, -1
%11 = icmp eq i32 %8, 0
br i1 %11, label %6, label %7
}
ISR(TIMER1_COMPA_vect) {
  DEBUG("ISR "
        "TIMER1_COMPA"
        " occured");
}


x86 assembly (clang, -O0):
<ISR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <DEBUG@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ISR>:
lea    0xee9(%rip),%rdi
xor    %eax,%eax
jmp    1030 <DEBUG@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"ISR TIMER1_COMPA occured\00"
define i32 @ISR(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
@.str = [25 x i8] c"ISR TIMER1_COMPA occured\00"
define i32 @ISR(i32 %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @DEBUG to i32 (i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ encrypt(char *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main() {
  char msg[80];
  while (fgets(msg, 79, stdin)) {
    encrypt(msg);
    printf("%s", msg);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
mov    0x2e9e(%rip),%rax
mov    (%rax),%edx
mov    $0x4f,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     117e <main+0x4e>
lea    -0x60(%rbp),%rdi
call   1040 <encrypt@plt>
lea    -0x60(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0xf>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    0x2ea8(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rdi
mov    $0x4f,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1188 <main+0x58>
mov    %rsp,%rbx
lea    0xea1(%rip),%r14
nop
mov    %rbx,%rdi
call   1040 <encrypt@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x4f,%esi
call   1050 <fgets@plt>
test   %rax,%rax
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %8, %0
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i64 @fgets(i8* %4, i32 79, i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%10 = call i32 @encrypt(i8* %9)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %3
13: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i64 @fgets(i8* %2, i32 79, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = call i32 @encrypt(i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%9 = load i32, i32* @stdin
%10 = call i64 @fgets(i8* %2, i32 79, i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %6, %0
ret i32 0
}
void yy_1_ValueNqStar(char *yytext, int yyleng) {
  ;
  ;
}


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

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

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

LLVM IR (-O2):
define void @yy_1_ValueNqStar(i8* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double testlib_read_float(int /*<<< orphan*/ *);
double testlib_read_real(FILE *__stream) {
  return testlib_read_float(__stream);
}


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

x86 assembly (clang, -O2):
<testlib_read_real>:
jmp    1030 <testlib_read_float@plt>

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

LLVM IR (-O2):
define double @testlib_read_real(i32* %0) {
%2 = tail call double @testlib_read_float(i32* %0)
ret double %2
}
/* Variables and functions */
int atoi(char *);
int _d_parse_int(char *v, int l, void *s) {
  *(int *)s = atoi(v);
  return 0;
}


x86 assembly (clang, -O0):
<_d_parse_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_d_parse_int>:
push   %rbx
mov    %rdx,%rbx
call   1030 <atoi@plt>
mov    %eax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @_d_parse_int(i8* nocapture %0, i32 %1, i8* nocapture writeonly %2) {
%4 = tail call i32 @atoi(i8* %0)
%5 = bitcast i8* %2 to i32*
store i32 %4, i32* %5
ret i32 0
}
/* Variables and functions */
int raise(int);
int dpl_throw_error() { return raise(40); }


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

x86 assembly (clang, -O2):
<dpl_throw_error>:
mov    $0x28,%edi
jmp    1030 <raise@plt>

LLVM IR (-O0):
define i32 @dpl_throw_error() {
%1 = call i32 @raise(i32 40)
ret i32 %1
}

LLVM IR (-O2):
define i32 @dpl_throw_error() {
%1 = tail call i32 @raise(i32 40)
ret i32 %1
}
int imax(a, b)
int a, b;
{ return (a > b ? a : b); }


x86 assembly (clang, -O0):
<imax>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <imax+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <imax+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @imax(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @imax(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void shrfunc(void) { printf("in shrfunc\n"); }


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"in shrfunc\00"
define void @shrfunc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
void update_rect(__attribute__((unused)) int x1, __attribute__((unused)) int y1,
                 __attribute__((unused)) int x2,
                 __attribute__((unused)) int y2) {}


x86 assembly (clang, -O0):
<update_rect>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @update_rect(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret void
}

LLVM IR (-O2):
define void @update_rect(i32 %0, i32 %1, i32 %2, i32 %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ OPER_AY_PI_16();
int /*<<< orphan*/ m68ki_set_ccr(int /*<<< orphan*/);
void m68k_op_move_16_toc_pi(void) { m68ki_set_ccr(OPER_AY_PI_16()); }


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

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

LLVM IR (-O0):
define void @m68k_op_move_16_toc_pi() {
%1 = call i32 (...) @OPER_AY_PI_16()
%2 = call i32 @m68ki_set_ccr(i32 %1)
ret void
}

LLVM IR (-O2):
define void @m68k_op_move_16_toc_pi() {
%1 = tail call i32 (...) @OPER_AY_PI_16()
%2 = tail call i32 @m68ki_set_ccr(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void thread_sleep() { exit(1); }


x86 assembly (clang, -O0):
<thread_sleep>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<thread_sleep>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @thread_sleep() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @thread_sleep() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ __bitmap_and(unsigned long *, unsigned long const *,
                                unsigned long const *, int);
void bitmap_and(unsigned long *dst, const unsigned long *src1,
                const unsigned long *src2, int nbits) {
  if (nbits <= ((int)sizeof(unsigned long) * 8))
    *dst = *src1 & *src2;
  else
    __bitmap_and(dst, src1, src2, nbits);
}


x86 assembly (clang, -O0):
<bitmap_and>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x40,-0x1c(%rbp)
jg     114b <bitmap_and+0x3b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
and    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    115f <bitmap_and+0x4f>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <__bitmap_and@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_and>:
cmp    $0x40,%ecx
jg     111f <bitmap_and+0xf>
mov    (%rdx),%rax
and    (%rsi),%rax
mov    %rax,(%rdi)
ret
jmp    1030 <__bitmap_and@plt>

LLVM IR (-O0):
define void @bitmap_and(i64* %0, i64* %1, i64* %2, i32 %3) {
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i32
store i64* %0, i64** %5
store i64* %1, i64** %6
store i64* %2, i64** %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = icmp sle i32 %9, 64
br i1 %10, label %11, label %18
11: ; preds = %4
%12 = load i64*, i64** %6
%13 = load i64, i64* %12
%14 = load i64*, i64** %7
%15 = load i64, i64* %14
%16 = and i64 %13, %15
%17 = load i64*, i64** %5
store i64 %16, i64* %17
br label %24
18: ; preds = %4
%19 = load i64*, i64** %5
%20 = load i64*, i64** %6
%21 = load i64*, i64** %7
%22 = load i32, i32* %8
%23 = call i32 @__bitmap_and(i64* %19, i64* %20, i64* %21, i32 %22)
br label %24
24: ; preds = %18, %11
ret void
}

LLVM IR (-O2):
define void @bitmap_and(i64* %0, i64* %1, i64* %2, i32 %3) {
%5 = icmp slt i32 %3, 65
br i1 %5, label %6, label %10
6: ; preds = %4
%7 = load i64, i64* %1
%8 = load i64, i64* %2
%9 = and i64 %8, %7
store i64 %9, i64* %0
br label %12
10: ; preds = %4
%11 = tail call i32 @__bitmap_and(i64* %0, i64* %1, i64* %2, i32 %3)
br label %12
12: ; preds = %10, %6
ret void
}
float EvenSum(int n) {
  float sum = 0;
  int i = 0;
  for (i = 2; i <= n; i += 2) {
    sum = sum + (float)1 / (float)i;
  }
  return sum;
}


x86 assembly (clang, -O0):
<EvenSum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1156 <EvenSum+0x56>
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm2
movss  0xec5(%rip),%xmm1
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    111d <EvenSum+0x1d>
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<EvenSum>:
xorps  %xmm0,%xmm0
cmp    $0x2,%edi
jl     1139 <EvenSum+0x39>
xorps  %xmm0,%xmm0
mov    $0x2,%eax
movss  0xee8(%rip),%xmm1
nopl   0x0(%rax,%rax,1)
xorps  %xmm2,%xmm2
cvtsi2ss %eax,%xmm2
movaps %xmm1,%xmm3
divss  %xmm2,%xmm3
addss  %xmm3,%xmm0
add    $0x2,%eax
cmp    %edi,%eax
jle    1120 <EvenSum+0x20>
ret

LLVM IR (-O0):
define float @EvenSum(i32 %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
store i32 %0, i32* %2
store float 0.000000e+00, float* %3
store i32 0, i32* %4
store i32 2, i32* %4
br label %5
5: ; preds = %15, %1
%6 = load i32, i32* %4
%7 = load i32, i32* %2
%8 = icmp sle i32 %6, %7
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = load float, float* %3
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to float
%13 = fdiv float 1.000000e+00, %12
%14 = fadd float %10, %13
store float %14, float* %3
br label %15
15: ; preds = %9
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 2
store i32 %17, i32* %4
br label %5
18: ; preds = %5
%19 = load float, float* %3
ret float %19
}

LLVM IR (-O2):
define float @EvenSum(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 2, %1 ]
%5 = phi float [ %8, %3 ], [ 0.000000e+00, %1 ]
%6 = sitofp i32 %4 to float
%7 = fdiv float 1.000000e+00, %6
%8 = fadd float %5, %7
%9 = add nuw nsw i32 %4, 2
%10 = icmp sgt i32 %9, %0
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi float [ 0.000000e+00, %1 ], [ %8, %3 ]
ret float %12
}
/* Variables and functions */
int getpid();
int hl_sys_getpid() { return getpid(); }


x86 assembly (clang, -O0):
<hl_sys_getpid>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getpid@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hl_sys_getpid>:
xor    %eax,%eax
jmp    1030 <getpid@plt>

LLVM IR (-O0):
define i32 @hl_sys_getpid() {
%1 = call i32 (...) @getpid()
ret i32 %1
}

LLVM IR (-O2):
define i32 @hl_sys_getpid() {
%1 = tail call i32 (...) @getpid()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int len(char **);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char str[20];
  printf("Enter string: ");
  gets(str);
  printf("Length of string: %d", len(&str));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <len@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Enter string: \00"
@.str.1 = [21 x i8] c"Length of string: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = bitcast [20 x i8]* %2 to i8**
%7 = call i32 @len(i8** %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Enter string: \00"
@.str.1 = [21 x i8] c"Length of string: %d\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = bitcast [20 x i8]* %1 to i8**
%6 = call i32 @len(i8** %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ C();
int /*<<< orphan*/ S();
int /*<<< orphan*/ WP();
int /*<<< orphan*/ eat(int);
int /*<<< orphan*/ printf(char *);
void W() {
  printf("W -> if(C){S}W'\n");
  eat(11);
  eat(17);
  C();
  eat(18);
  eat(19);
  S();
  eat(20);
  WP();
}


x86 assembly (clang, -O0):
<W>:
push   %rbp
mov    %rsp,%rbp
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    $0xb,%edi
call   1030 <eat@plt>
mov    $0x11,%edi
call   1030 <eat@plt>
mov    $0x0,%al
call   1050 <C@plt>
mov    $0x12,%edi
call   1030 <eat@plt>
mov    $0x13,%edi
call   1030 <eat@plt>
mov    $0x0,%al
call   1070 <S@plt>
mov    $0x14,%edi
call   1030 <eat@plt>
mov    $0x0,%al
call   1060 <WP@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<W>:
push   %rax
lea    0xea8(%rip),%rdi
call   1040 <puts@plt>
mov    $0xb,%edi
call   1030 <eat@plt>
mov    $0x11,%edi
call   1030 <eat@plt>
xor    %eax,%eax
call   1050 <C@plt>
mov    $0x12,%edi
call   1030 <eat@plt>
mov    $0x13,%edi
call   1030 <eat@plt>
xor    %eax,%eax
call   1070 <S@plt>
mov    $0x14,%edi
call   1030 <eat@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <WP@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"W -> if(C){S}W'\0A\00"
define void @W() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @eat(i32 11)
%3 = call i32 @eat(i32 17)
%4 = call i32 (...) @C()
%5 = call i32 @eat(i32 18)
%6 = call i32 @eat(i32 19)
%7 = call i32 (...) @S()
%8 = call i32 @eat(i32 20)
%9 = call i32 (...) @WP()
ret void
}

LLVM IR (-O2):
@str = [16 x i8] c"W -> if(C){S}W'\00"
define void @W() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @eat(i32 11)
%3 = tail call i32 @eat(i32 17)
%4 = tail call i32 (...) @C()
%5 = tail call i32 @eat(i32 18)
%6 = tail call i32 @eat(i32 19)
%7 = tail call i32 (...) @S()
%8 = tail call i32 @eat(i32 20)
%9 = tail call i32 (...) @WP()
ret void
}
void sys_open_midi(int nmidiindev, int *midiindev, int nmidioutdev,
                   int *midioutdev, int enable) {}


x86 assembly (clang, -O0):
<sys_open_midi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @sys_open_midi(i32 %0, i32* %1, i32 %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i32 %4, i32* %10
ret void
}

LLVM IR (-O2):
define void @sys_open_midi(i32 %0, i32* nocapture %1, i32 %2, i32* nocapture %3, i32 %4) {
ret void
}
void mouse_click_at(int _x, int _y, int _button) {}


x86 assembly (clang, -O0):
<mouse_click_at>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @mouse_click_at(i32 %0, i32 %1, i32 %2) {
ret void
}
void flip_long(void *w) {
  unsigned char *v = (unsigned char *)w;
  unsigned char x;
  x = v[0];
  v[0] = v[3];
  v[3] = x;
  x = v[1];
  v[1] = v[2];
  v[2] = x;
}


x86 assembly (clang, -O0):
<flip_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x11(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<flip_long>:
mov    (%rdi),%al
mov    0x3(%rdi),%cl
mov    %cl,(%rdi)
mov    %al,0x3(%rdi)
rolw   $0x8,0x1(%rdi)
ret

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

LLVM IR (-O2):
define void @flip_long(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 3
%4 = load i8, i8* %3
store i8 %4, i8* %0
store i8 %2, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %0, i64 2
%8 = load i8, i8* %7
store i8 %8, i8* %5
store i8 %6, i8* %7
ret void
}
int test_imm_6Euint8_reg(unsigned char val) {
  return ((val) & (0x6E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Euint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0x6e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_6Euint8_reg>:
test   $0x6e,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_6Euint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 110
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char letter, b;
  scanf("%c", &letter);
  b = 'a' + 'z' - letter;
  printf("%c", b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x1(%rbp),%ecx
mov    $0xdb,%eax
sub    %ecx,%eax
mov    %al,-0x2(%rbp)
lea    0xeb3(%rip),%rdi
movsbl -0x2(%rbp),%esi
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),%rbx
lea    0xf(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    $0xdb,%al
sub    0xf(%rsp),%al
movsbl %al,%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i8
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = load i8, i8* %1
%5 = sext i8 %4 to i32
%6 = sub nsw i32 219, %5
%7 = trunc i32 %6 to i8
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = load i8, i8* %1
%4 = sub i8 -37, %3
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %4)
ret i32 0
}