xunge/DecIR huggingface dataset:
int xcng(volatile unsigned *addr, int val) {
  asm volatile("xchg %0, %1;" : "+r"(val), "+m"(*addr));
  return val;
}


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

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

LLVM IR (-O0):
define i32 @xcng(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = call i32 asm sideeffect "xchg $0, $1;", "=r,=*m,0,*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %6, i32 %5, i32* elementtype(i32) %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
ret i32 %8
}

LLVM IR (-O2):
define i32 @xcng(i32* %0, i32 %1) {
%3 = tail call i32 asm sideeffect "xchg $0, $1;", "=r,=*m,0,*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %0, i32 %1, i32* elementtype(i32) %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ HASHCRYPT_DriverIRQHandler();
__attribute__((weak)) void HASHCRYPT_IRQHandler(void) {
  HASHCRYPT_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @HASHCRYPT_IRQHandler() {
%1 = call i32 (...) @HASHCRYPT_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @HASHCRYPT_IRQHandler() {
%1 = tail call i32 (...) @HASHCRYPT_DriverIRQHandler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar_fd(int, char);
void ft_putnbr_fd_rec(int fd, unsigned long nbr) {
  char c;
  if (nbr) {
    c = (nbr % 10) + '0';
    ft_putnbr_fd_rec(fd, nbr /= 10);
    ft_putchar_fd(fd, c);
  }
}


x86 assembly (clang, -O0):
<ft_putnbr_fd_rec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117a <ft_putnbr_fd_rec+0x5a>
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
add    $0x30,%rdx
mov    %dl,%al
mov    %al,-0x11(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    %rsi,-0x10(%rbp)
call   1040 <ft_putnbr_fd_rec@plt>
mov    -0x4(%rbp),%edi
movsbl -0x11(%rbp),%esi
call   1030 <ft_putchar_fd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr_fd_rec>:
test   %rsi,%rsi
je     1164 <ft_putnbr_fd_rec+0x44>
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
movabs $0xcccccccccccccccd,%rcx
cc cc cc
mov    %rsi,%rax
mul    %rcx
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
or     $0x30,%bl
mov    %rdx,%rsi
call   1040 <ft_putnbr_fd_rec@plt>
movzbl %bl,%esi
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <ft_putchar_fd@plt>
ret

LLVM IR (-O0):
define void @ft_putnbr_fd_rec(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i8
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %2
%9 = load i64, i64* %4
%10 = urem i64 %9, 10
%11 = add i64 %10, 48
%12 = trunc i64 %11 to i8
store i8 %12, i8* %5
%13 = load i32, i32* %3
%14 = load i64, i64* %4
%15 = udiv i64 %14, 10
store i64 %15, i64* %4
%16 = load i32, i32* %3
%17 = load i8, i8* %5
%18 = call i32 @ft_putchar_fd(i32 %16, i8 signext %17)
br label %19
19: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
define void @ft_putnbr_fd_rec(i32 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %4, label %5
4: ; preds = %2, %5
ret void
5: ; preds = %2
%6 = urem i64 %1, 10
%7 = trunc i64 %6 to i8
%8 = or i8 %7, 48
%9 = udiv i64 %1, 10
tail call void @ft_putnbr_fd_rec(i32 %0, i64 %9)
%10 = tail call i32 @ft_putchar_fd(i32 %0, i8 signext %8)
br label %4
}
/* Variables and functions */
int multiply(int, int);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int a = 5;
  int b = 10;
  int c = multiply(a, b);
  printf("The value of c is: %d", c);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
mov    $0xa,%esi
call   1030 <multiply@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"The value of c is: %d\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 5, i32* %1
store i32 10, i32* %2
%4 = load i32, i32* %1
%5 = load i32, i32* %2
%6 = call i32 @multiply(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"The value of c is: %d\00"
define void @main() {
%1 = tail call i32 @multiply(i32 5, i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
long int fibonacci_hesapla(int girilen_sayi) {
  if (girilen_sayi == 0 || girilen_sayi == 1) {
    return girilen_sayi;
  } else {
    return fibonacci_hesapla(girilen_sayi - 1) +
           fibonacci_hesapla(girilen_sayi - 2);
  }
}


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

x86 assembly (clang, -O2):
<fibonacci_hesapla>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %r14d,%r14d
cmp    $0x2,%edi
jb     1133 <fibonacci_hesapla+0x23>
xchg   %ax,%ax
lea    -0x1(%rbx),%edi
call   1030 <fibonacci_hesapla@plt>
add    $0xfffffffe,%ebx
add    %rax,%r14
cmp    $0x2,%ebx
jae    1120 <fibonacci_hesapla+0x10>
mov    %ebx,%eax
add    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fibonacci_hesapla(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %3, label %8
3: ; preds = %8, %1
%4 = phi i64 [ 0, %1 ], [ %14, %8 ]
%5 = phi i32 [ %0, %1 ], [ %13, %8 ]
%6 = zext i32 %5 to i64
%7 = add nsw i64 %4, %6
ret i64 %7
8: ; preds = %1, %8
%9 = phi i32 [ %13, %8 ], [ %0, %1 ]
%10 = phi i64 [ %14, %8 ], [ 0, %1 ]
%11 = add nsw i32 %9, -1
%12 = tail call i64 @fibonacci_hesapla(i32 %11)
%13 = add nsw i32 %9, -2
%14 = add nsw i64 %12, %10
%15 = icmp ult i32 %13, 2
br i1 %15, label %3, label %8
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *create_temporary_file();
int /*<<< orphan*/ print_file(int /*<<< orphan*/ *);
int /*<<< orphan*/ set_file_position(long, int /*<<< orphan*/ *);
void print_tail(long tail_length, FILE *input) {
  if (input == NULL)
    input = create_temporary_file();
  set_file_position(tail_length, input);
  print_file(input);
}


x86 assembly (clang, -O0):
<print_tail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1156 <print_tail+0x26>
mov    $0x0,%al
call   1050 <create_temporary_file@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <set_file_position@plt>
mov    -0x10(%rbp),%rdi
call   1030 <print_file@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_tail>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
test   %rsi,%rsi
jne    1149 <print_tail+0x19>
xor    %eax,%eax
call   1050 <create_temporary_file@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <set_file_position@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <print_file@plt>

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

LLVM IR (-O2):
define void @print_tail(i64 %0, i32* %1) {
%3 = icmp eq i32* %1, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32* (...) @create_temporary_file()
br label %6
6: ; preds = %4, %2
%7 = phi i32* [ %5, %4 ], [ %1, %2 ]
%8 = tail call i32 @set_file_position(i64 %0, i32* %7)
%9 = tail call i32 @print_file(i32* %7)
ret void
}
/* Type definitions */
struct exfat_de_iter {
  int dummy;
};

/* Variables and functions */
int ENOTSUP;
int read_ahead_first_blocks(struct exfat_de_iter *iter) { return -ENOTSUP; }


x86 assembly (clang, -O0):
<read_ahead_first_blocks>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    0x2ed7(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_ahead_first_blocks>:
mov    0x2ee1(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
%struct.exfat_de_iter = type { i32 }
@ENOTSUP = global i32 0
define i32 @read_ahead_first_blocks(%struct.exfat_de_iter* %0) {
%2 = alloca %struct.exfat_de_iter*
store %struct.exfat_de_iter* %0, %struct.exfat_de_iter** %2
%3 = load i32, i32* @ENOTSUP
%4 = sub nsw i32 0, %3
ret i32 %4
}

LLVM IR (-O2):
%struct.exfat_de_iter = type { i32 }
@ENOTSUP = global i32 0
define i32 @read_ahead_first_blocks(%struct.exfat_de_iter* nocapture readnone %0) {
%2 = load i32, i32* @ENOTSUP
%3 = sub nsw i32 0, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
error() {
  printf("Syntax error\n");
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [14 x i8] c"Syntax error\0A\00"
define i32 @error() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [13 x i8] c"Syntax error\00"
define i32 @error() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ checkMalloc(char *const);
scalar_t__ malloc(int);
int /*<<< orphan*/ strncpy(char *const, char *, int);
char *getTimeMenu(void) {
  char *const menu = (char *)malloc(48 * sizeof(char));
  checkMalloc(menu);
  strncpy(menu,
          "\n1. Days\n"
          "2. Weeks\n"
          "3. Months\n"
          "4. Years\n"
          "0. Back\n\n",
          48);
  return menu;
}


x86 assembly (clang, -O0):
<getTimeMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x30,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <checkMalloc@plt>
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x30,%edx
call   1030 <strncpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTimeMenu>:
push   %rbx
mov    $0x30,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <checkMalloc@plt>
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
mov    $0x30,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"\0A1. Days\0A2. Weeks\0A3. Months\0A4. Years\0A0. Back\0A\0A\00"
define i8* @getTimeMenu() {
%1 = alloca i8*
%2 = call i64 @malloc(i32 48)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @checkMalloc(i8* %4)
%6 = load i8*, i8** %1
%7 = call i32 @strncpy(i8* %6, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 48)
%8 = load i8*, i8** %1
ret i8* %8
}

LLVM IR (-O2):
@.str = [47 x i8] c"\0A1. Days\0A2. Weeks\0A3. Months\0A4. Years\0A0. Back\0A\0A\00"
define i8* @getTimeMenu() {
%1 = tail call i64 @malloc(i32 48)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @checkMalloc(i8* %2)
%4 = tail call i32 @strncpy(i8* %2, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 48)
ret i8* %2
}
void display() {}


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

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

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

LLVM IR (-O2):
define void @display() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ control_c_handler(int /*<<< orphan*/);
void soar_cStopAllAgents(void) { control_c_handler(0); }


x86 assembly (clang, -O0):
<soar_cStopAllAgents>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <control_c_handler@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<soar_cStopAllAgents>:
xor    %edi,%edi
jmp    1030 <control_c_handler@plt>

LLVM IR (-O0):
define void @soar_cStopAllAgents() {
%1 = call i32 @control_c_handler(i32 0)
ret void
}

LLVM IR (-O2):
define void @soar_cStopAllAgents() {
%1 = tail call i32 @control_c_handler(i32 0)
ret void
}
/* Variables and functions */
double fact(int);
double P(int n, int r) { return fact(n) / fact(n - r); }


x86 assembly (clang, -O0):
<P>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <fact@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <fact@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<P>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <fact@plt>
movsd  %xmm0,(%rsp)
sub    %ebx,%ebp
mov    %ebp,%edi
call   1030 <fact@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @P(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 = call double @fact(i32 %5)
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = sub nsw i32 %7, %8
%10 = call double @fact(i32 %9)
%11 = fdiv double %6, %10
ret double %11
}

LLVM IR (-O2):
define double @P(i32 %0, i32 %1) {
%3 = tail call double @fact(i32 %0)
%4 = sub nsw i32 %0, %1
%5 = tail call double @fact(i32 %4)
%6 = fdiv double %3, %5
ret double %6
}
/* Type definitions */
typedef int /*<<< orphan*/ EC_KEY;

/* Variables and functions */
int ECDSA_sign_ex(int, unsigned char const *, int, unsigned char *,
                  unsigned int *, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *);
int ECDSA_sign(int type, const unsigned char *dgst, int dlen,
               unsigned char *sig, unsigned int *siglen, EC_KEY *eckey) {
  return ECDSA_sign_ex(type, dgst, dlen, sig, siglen, NULL, NULL, eckey);
}


x86 assembly (clang, -O0):
<ECDSA_sign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%rax
xor    %r9d,%r9d
movq   $0x0,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <ECDSA_sign_ex@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ECDSA_sign>:
push   %rax
mov    %r9,%rax
xor    %r9d,%r9d
push   %rax
push   $0x0
call   1030 <ECDSA_sign_ex@plt>
add    $0x10,%rsp
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @ECDSA_sign(i32 %0, i8* %1, i32 %2, i8* %3, i32* %4, i32* %5) {
%7 = tail call i32 @ECDSA_sign_ex(i32 %0, i8* %1, i32 %2, i8* %3, i32* %4, i32* null, i32* null, i32* %5)
ret i32 %7
}
void __attribute__((no)) oof() { asm volatile("" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @oof() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
double middleOf(double x, double y) { return x + (y - x) / 2; }


x86 assembly (clang, -O0):
<middleOf>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
movsd  0xedb(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<middleOf>:
subsd  %xmm0,%xmm1
mulsd  0xef4(%rip),%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @middleOf(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = load double, double* %3
%8 = fsub double %6, %7
%9 = fdiv double %8, 2.000000e+00
%10 = fadd double %5, %9
ret double %10
}

LLVM IR (-O2):
define double @middleOf(double %0, double %1) {
%3 = fsub double %1, %0
%4 = fmul double %3, 5.000000e-01
%5 = fadd double %4, %0
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
main() {
  char *p = "Sanfoundry C-Test";
  p[0] = 'a';
  p[1] = 'b';
  printf("%s", p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x61,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x62,0x1(%rax)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xefa(%rip),%rdi
lea    0xee1(%rip),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Sanfoundry C-Test\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i8*
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = getelementptr inbounds i8, i8* %2, i64 0
store i8 97, i8* %3
%4 = load i8*, i8** %1
%5 = getelementptr inbounds i8, i8* %4, i64 1
store i8 98, i8* %5
%6 = load i8*, i8** %1
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Sanfoundry C-Test\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ countVowelsInStrTD();
main() { countVowelsInStrTD(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <countVowelsInStrTD@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @countVowelsInStrTD()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @countVowelsInStrTD()
ret i32 0
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int S_ISREG(int /*<<< orphan*/);
int stat(char const *, struct stat *);
int is_file(const char *path) {
  struct stat buf;
  int err;
  err = stat(path, &buf);
  if (-1 == err) {
    return 0;
  }
  return S_ISREG(buf.st_mode);
}


x86 assembly (clang, -O0):
<is_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
mov    %eax,-0x1c(%rbp)
mov    $0xffffffff,%eax
cmp    -0x1c(%rbp),%eax
jne    1156 <is_file+0x36>
movl   $0x0,-0x4(%rbp)
jmp    1161 <is_file+0x41>
mov    -0x18(%rbp),%edi
call   1040 <S_ISREG@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_file>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
cmp    $0xffffffff,%eax
je     1137 <is_file+0x17>
mov    (%rsp),%edi
pop    %rax
jmp    1040 <S_ISREG@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @is_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @stat(i8* %6, %struct.stat* %4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp eq i32 -1, %8
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 0, i32* %2
br label %15
11: ; preds = %1
%12 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @S_ISREG(i32 %13)
store i32 %14, i32* %2
br label %15
15: ; preds = %11, %10
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @is_file(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @S_ISREG(i32 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ 0, %1 ]
ret i32 %11
}
int fun614() { return 614; }


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

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

LLVM IR (-O0):
define i32 @fun614() {
ret i32 614
}

LLVM IR (-O2):
define i32 @fun614() {
ret i32 614
}
/* Variables and functions */
char *getHelloWorld();
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) { printf("%s", getHelloWorld()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getHelloWorld@plt>
mov    %rax,%rsi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getHelloWorld@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* (...) @getHelloWorld()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
int test_imm_21int32_mem(int *val) {
  return ((*val) & (0x21 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_21int32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0x21,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_21int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 33
%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_21int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 33
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void xk_offset(int fd) {}


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

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

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

LLVM IR (-O2):
define void @xk_offset(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strncmp(char *, char *, int);
int php_ini_check_path(char *option_name, int option_len, char *new_option_name,
                       int new_option_len) {
  if (option_len != (new_option_len - 1)) {
    return 0;
  }
  return !strncmp(option_name, new_option_name, option_len);
}


x86 assembly (clang, -O0):
<php_ini_check_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     1143 <php_ini_check_path+0x33>
movl   $0x0,-0x4(%rbp)
jmp    1163 <php_ini_check_path+0x53>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<php_ini_check_path>:
add    $0xffffffff,%ecx
xor    %eax,%eax
cmp    %esi,%ecx
jne    1135 <php_ini_check_path+0x25>
push   %rax
mov    %esi,%r8d
mov    %rdx,%rsi
mov    %r8d,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @php_ini_check_path(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = add nsw i32 %3, -1
%6 = icmp eq i32 %5, %1
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = tail call i32 @strncmp(i8* %0, i8* %2, i32 %1)
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %4, %7
%12 = phi i32 [ %10, %7 ], [ 0, %4 ]
ret i32 %12
}
void CRYPTO_push_info_(void) {}


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

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

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

LLVM IR (-O2):
define void @CRYPTO_push_info_() {
ret void
}
/* Variables and functions */
int O_CREAT;
int open(char *, int, char *);
int setCheckpointFile(char *file) {
  int fd;
  fd = open("/proc/self/checkpointfile", 1 | O_CREAT, file);
  if (fd == -1) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<setCheckpointFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ed5(%rip),%rax
mov    (%rax),%esi
or     $0x1,%esi
mov    -0x10(%rbp),%rdx
lea    0xecd(%rip),%rdi
call   1030 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1151 <setCheckpointFile+0x41>
movl   $0x0,-0x4(%rbp)
jmp    1158 <setCheckpointFile+0x48>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setCheckpointFile>:
push   %rax
mov    %rdi,%rdx
mov    0x2edd(%rip),%rax
mov    (%rax),%esi
or     $0x1,%esi
lea    0xed9(%rip),%rdi
call   1030 <open@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"/proc/self/checkpointfile\00"
@O_CREAT = global i32 0
define i32 @setCheckpointFile(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i32, i32* @O_CREAT
%6 = or i32 1, %5
%7 = load i8*, i8** %3
%8 = call i32 @open(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 0, i32* %2
br label %13
12: ; preds = %1
store i32 1, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [26 x i8] c"/proc/self/checkpointfile\00"
@O_CREAT = global i32 0
define i32 @setCheckpointFile(i8* %0) {
%2 = load i32, i32* @O_CREAT
%3 = or i32 %2, 1
%4 = tail call i32 @open(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3, i8* %0)
%5 = icmp ne i32 %4, -1
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ return_struct_big_1();
int /*<<< orphan*/ take_struct_big_1(int /*<<< orphan*/);
void test_struct_big_1() { take_struct_big_1(return_struct_big_1()); }


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

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

LLVM IR (-O0):
define void @test_struct_big_1() {
%1 = call i32 (...) @return_struct_big_1()
%2 = call i32 @take_struct_big_1(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_big_1() {
%1 = tail call i32 (...) @return_struct_big_1()
%2 = tail call i32 @take_struct_big_1(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void playmultiplayer() { printf("Play multiplayer game called"); }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"Play multiplayer game called\00"
define void @playmultiplayer() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Play multiplayer game called\00"
define void @playmultiplayer() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *(strchr)(const char *string, int c) {
  for (;;)
    if (*string == c)
      return string;
    else if (!*string++)
      return NULL;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    -0x14(%rbp),%eax
jne    1128 <strchr+0x28>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1157 <strchr+0x57>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
cmpb   $0x0,(%rax)
jne    114d <strchr+0x4d>
movq   $0x0,-0x8(%rbp)
jmp    1157 <strchr+0x57>
jmp    1152 <strchr+0x52>
jmp    110b <strchr+0xb>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rax),%ecx
cmp    %esi,%ecx
je     1121 <strchr+0x21>
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i8* [ %0, %2 ], [ %9, %8 ]
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, %1
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 1
%10 = icmp eq i8 %5, 0
br i1 %10, label %11, label %3
11: ; preds = %8, %3
%12 = phi i8* [ %4, %3 ], [ null, %8 ]
ret i8* %12
}
double difficultyRating(void) { return 4.5; }


x86 assembly (clang, -O0):
<difficultyRating>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @difficultyRating() {
ret double 4.500000e+00
}

LLVM IR (-O2):
define double @difficultyRating() {
ret double 4.500000e+00
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ printf(char *, char const *);
void server_error(int sock, const char *message) {
  close(sock);
  printf("%s\n", message);
}


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

x86 assembly (clang, -O2):
<server_error>:
push   %rbx
mov    %rsi,%rbx
call   1040 <close@plt>
lea    0xed0(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @server_error(i32 %0, i8* %1) {
%3 = tail call i32 @close(i32 %0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ nrf_drv_radio802154_transmitted(int /*<<< orphan*/ *,
                                                   int /*<<< orphan*/,
                                                   int /*<<< orphan*/);
void nrf_drv_radio802154_notify_transmitted(uint8_t *p_ack, int8_t power,
                                            int8_t lqi) {
  nrf_drv_radio802154_transmitted(p_ack, power, lqi);
}


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

x86 assembly (clang, -O2):
<nrf_drv_radio802154_notify_transmitted>:
jmp    1030 <nrf_drv_radio802154_transmitted@plt>

LLVM IR (-O0):
define void @nrf_drv_radio802154_notify_transmitted(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
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @nrf_drv_radio802154_transmitted(i32* %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
define void @nrf_drv_radio802154_notify_transmitted(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @nrf_drv_radio802154_transmitted(i32* %0, i32 %1, i32 %2)
ret void
}
main() {
  int x;
  x = -3 * 0x4000000000000000;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
scalar_t__ CLOCKS_PER_SEC;
unsigned long clock();
double linux_cputime_(void) {
  unsigned long thetime = clock();
  double value = ((double)thetime) / ((double)CLOCKS_PER_SEC);
  return value;
}


x86 assembly (clang, -O0):
<linux_cputime_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <clock@plt>
mov    %rax,-0x8(%rbp)
movaps 0xed6(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xed5(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
mov    0x2e97(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linux_cputime_>:
push   %rax
xor    %eax,%eax
call   1030 <clock@plt>
movq   %rax,%xmm1
punpckldq 0xedb(%rip),%xmm1
subpd  0xee3(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
mov    0x2ea8(%rip),%rax
xorps  %xmm1,%xmm1
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i64 0
define double @linux_cputime_() {
%1 = alloca i64
%2 = alloca double
%3 = call i64 (...) @clock()
store i64 %3, i64* %1
%4 = load i64, i64* %1
%5 = uitofp i64 %4 to double
%6 = load i64, i64* @CLOCKS_PER_SEC
%7 = sitofp i64 %6 to double
%8 = fdiv double %5, %7
store double %8, double* %2
%9 = load double, double* %2
ret double %9
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i64 0
define double @linux_cputime_() {
%1 = tail call i64 (...) @clock()
%2 = uitofp i64 %1 to double
%3 = load i64, i64* @CLOCKS_PER_SEC
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t crc_calc(uint32_t crc, int input_bit) {
  uint32_t d = (input_bit & 1) ? 0xfffffff : 0x0000000;
  uint32_t crc_32 = ((crc >> 31) & 1) ? 0xfffffff : 0x0000000;
  crc <<= 1;
  return crc ^ (d ^ crc_32) & 0x04c11db7;
}


x86 assembly (clang, -O0):
<crc_calc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edx
and    $0x1,%edx
xor    %eax,%eax
mov    $0xfffffff,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edx
sar    $0x1f,%edx
and    $0x1,%edx
xor    %eax,%eax
mov    $0xfffffff,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    -0x10(%rbp),%ecx
and    $0x4c11db7,%ecx
xor    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc_calc>:
and    $0x1,%esi
neg    %esi
and    $0x4c11db7,%esi
lea    (%rdi,%rdi,1),%eax
mov    %edi,%ecx
sar    $0x1f,%ecx
and    $0x4c11db7,%ecx
xor    %ecx,%eax
xor    %esi,%eax
ret

LLVM IR (-O0):
define i32 @crc_calc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = and i32 %7, 1
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 268435455, i32 0
store i32 %11, i32* %5
%12 = load i32, i32* %3
%13 = ashr i32 %12, 31
%14 = and i32 %13, 1
%15 = icmp ne i32 %14, 0
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 268435455, i32 0
store i32 %17, i32* %6
%18 = load i32, i32* %3
%19 = shl i32 %18, 1
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = xor i32 %21, %22
%24 = and i32 %23, 79764919
%25 = xor i32 %20, %24
ret i32 %25
}

LLVM IR (-O2):
define i32 @crc_calc(i32 %0, i32 %1) {
%3 = and i32 %1, 1
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 0, i32 79764919
%6 = icmp slt i32 %0, 0
%7 = select i1 %6, i32 79764919, i32 0
%8 = shl i32 %0, 1
%9 = xor i32 %7, %8
%10 = xor i32 %9, %5
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void myFunc(void) { puts("COOL!"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"COOL!\00"
define void @myFunc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void cnt_heap_memfree(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<cnt_heap_memfree>:
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):
<cnt_heap_memfree>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @cnt_heap_memfree(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 @cnt_heap_memfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int strcmp(char const *const, char const *const);
int qsort_helper(const void *first, const void *second) {
  const char *const *s1;
  const char *const *s2;
  s1 = first;
  s2 = second;
  return (strcmp(*s1, *s2));
}


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

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

LLVM IR (-O0):
define i32 @qsort_helper(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 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %12, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @qsort_helper(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void grpcsharp_channel_args_set_string() {
  fprintf(stderr, "Should never reach here");
  abort();
}


x86 assembly (clang, -O0):
<grpcsharp_channel_args_set_string>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<grpcsharp_channel_args_set_string>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Should never reach here\00"
define void @grpcsharp_channel_args_set_string() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Should never reach here\00"
define void @grpcsharp_channel_args_set_string() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int setbits(int, int, int, int);
int main() { printf("%u\n", setbits(9, 2, 2, 3)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9,%edi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    %edx,%esi
call   1040 <setbits@plt>
mov    %eax,%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x9,%edi
mov    $0x2,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
call   1040 <setbits@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = call i32 @setbits(i32 9, i32 2, i32 2, i32 3)
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define i32 @main() {
%1 = tail call i32 @setbits(i32 9, i32 2, i32 2, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}