xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ munmap(void *, unsigned long long);
void gt4_munmap(const unsigned char *cdata, unsigned long long csize) {
  munmap((void *)cdata, csize);
}


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

x86 assembly (clang, -O2):
<gt4_munmap>:
jmp    1030 <munmap@plt>

LLVM IR (-O0):
define void @gt4_munmap(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @munmap(i8* %5, i64 %6)
ret void
}

LLVM IR (-O2):
define void @gt4_munmap(i8* %0, i64 %1) {
%3 = tail call i32 @munmap(i8* %0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void fault(int n) {
  fprintf(stderr, "fault %d\n", n);
  exit(1);
}


x86 assembly (clang, -O0):
<fault>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fault>:
push   %rax
mov    %edi,%edx
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [10 x i8] c"fault %d\0A\00"
define void @fault(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ ISR_UART_Rx_ClearPending();
int /*<<< orphan*/ UART_1_rx_ClearInterrupt();
void ISR_UART_Rx_Interrupt(void) {
  ISR_UART_Rx_ClearPending();
  UART_1_rx_ClearInterrupt();
}


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

x86 assembly (clang, -O2):
<ISR_UART_Rx_Interrupt>:
push   %rax
xor    %eax,%eax
call   1040 <ISR_UART_Rx_ClearPending@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <UART_1_rx_ClearInterrupt@plt>

LLVM IR (-O0):
define void @ISR_UART_Rx_Interrupt() {
%1 = call i32 (...) @ISR_UART_Rx_ClearPending()
%2 = call i32 (...) @UART_1_rx_ClearInterrupt()
ret void
}

LLVM IR (-O2):
define void @ISR_UART_Rx_Interrupt() {
%1 = tail call i32 (...) @ISR_UART_Rx_ClearPending()
%2 = tail call i32 (...) @UART_1_rx_ClearInterrupt()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0x99() {
  Assert_real((isodigit(153) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isodigit.c",
              770, ("isodigit should be 0 for 0x99"));
}


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

x86 assembly (clang, -O2):
<t_isodigit_0x99>:
push   %rax
mov    $0x99,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x302,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

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

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0x99\00"
define void @t_isodigit_0x99() {
%1 = tail call i64 @isodigit(i32 153)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 770, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ matmul(char *, int, int, int, double, double *,
                          double const *, double, double *);
int /*<<< orphan*/ xyz2enu(double const *, double *);
extern void ecef2enu(const double *pos, const double *r, double *e) {
  double E[9];
  xyz2enu(pos, E);
  matmul("NN", 3, 1, 3, 1.0, E, r, 0.0, e);
}


x86 assembly (clang, -O0):
<ecef2enu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <xyz2enu@plt>
lea    -0x60(%rbp),%r8
mov    -0x10(%rbp),%r9
mov    -0x18(%rbp),%rax
lea    0xeb4(%rip),%rdi
mov    $0x3,%ecx
mov    $0x1,%edx
movsd  0xe9a(%rip),%xmm0
xorps  %xmm1,%xmm1
mov    %ecx,%esi
mov    %rax,(%rsp)
call   1040 <matmul@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecef2enu>:
push   %r15
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
lea    0x10(%rsp),%r15
mov    %r15,%rsi
call   1030 <xyz2enu@plt>
mov    %rbx,(%rsp)
lea    0xec1(%rip),%rdi
movsd  0xeb1(%rip),%xmm0
xorps  %xmm1,%xmm1
mov    $0x3,%esi
mov    $0x1,%edx
mov    $0x3,%ecx
mov    %r15,%r8
mov    %r14,%r9
call   1040 <matmul@plt>
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"NN\00"
define void @ecef2enu(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca [9 x double]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load double*, double** %4
%9 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 0
%10 = call i32 @xyz2enu(double* %8, double* %9)
%11 = getelementptr inbounds [9 x double], [9 x double]* %7, i64 0, i64 0
%12 = load double*, double** %5
%13 = load double*, double** %6
%14 = call i32 @matmul(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 3, i32 1, i32 3, double 1.000000e+00, double* %11, double* %12, double 0.000000e+00, double* %13)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"NN\00"
define void @ecef2enu(double* %0, double* %1, double* %2) {
%4 = alloca [9 x double]
%5 = bitcast [9 x double]* %4 to i8*
%6 = getelementptr inbounds [9 x double], [9 x double]* %4, i64 0, i64 0
%7 = call i32 @xyz2enu(double* %0, double* %6)
%8 = call i32 @matmul(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 3, i32 1, i32 3, double 1.000000e+00, double* %6, double* %1, double 0.000000e+00, double* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
char *refstr_alloc(size_t);
size_t strlen(char const *);
const char *refstrdup(const char *str) {
  char *r;
  size_t len;
  if (!str)
    return NULL;
  len = strlen(str);
  r = refstr_alloc(len);
  if (r)
    memcpy(r, str, len);
  return r;
}


x86 assembly (clang, -O0):
<refstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <refstrdup+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1192 <refstrdup+0x62>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <refstr_alloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     118a <refstrdup+0x5a>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<refstrdup>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1165 <refstrdup+0x35>
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1050 <refstr_alloc@plt>
test   %rax,%rax
je     1165 <refstrdup+0x35>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
jmp    1167 <refstrdup+0x37>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @refstrdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = tail call i8* @refstr_alloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %4)
br label %9
9: ; preds = %3, %7, %1
%10 = phi i8* [ null, %1 ], [ %5, %7 ], [ null, %3 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ showArray(int *);
int main(void) {
  int primes[] = {2, 3, 5, 7, 11, 13};
  showArray(&primes[2]);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
add    $0x8,%rdi
call   1030 <showArray@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee5(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <showArray@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.primes = [6 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11, i32 13]
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
store i32 0, i32* %1
%3 = bitcast [6 x i32]* %2 to i8*
%4 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 2
%5 = call i32 @showArray(i32* %4)
%6 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.primes = [6 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11, i32 13]
define i32 @main() {
%1 = alloca [6 x i32]
%2 = bitcast [6 x i32]* %1 to i8*
%3 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 2
%4 = call i32 @showArray(i32* %3)
%5 = call i32 (...) @getchar()
ret i32 0
}
const char *rcsid(const char *p) {
  return rcsid(p = "@(#)$File: magic.c,v 1.54 2008/07/25 23:30:32 rrt Exp $");
}


x86 assembly (clang, -O0):
<rcsid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xed2(%rip),%rdi
call   1030 <rcsid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rcsid>:
jmp    1100 <rcsid>

LLVM IR (-O0):
@.str = [56 x i8] c"@(#)$File: magic.c,v 1.54 2008/07/25 23:30:32 rrt Exp $\00"
define i8* @rcsid(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
store i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = call i8* @rcsid(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
ret i8* %3
}

LLVM IR (-O2):
define noalias i8* @rcsid(i8* nocapture readnone %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long atol(int /*<<< orphan*/);
int /*<<< orphan*/ findLine(int /*<<< orphan*/ *, char *);
long parselast(FILE *plr_file) { return atol(findLine(plr_file, "Last:")); }


x86 assembly (clang, -O0):
<parselast>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <findLine@plt>
mov    %eax,%edi
call   1030 <atol@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parselast>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <findLine@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <atol@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Last:\00"
define i64 @parselast(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @findLine(i32* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i64 @atol(i32 %4)
ret i64 %5
}

LLVM IR (-O2):
@.str = [6 x i8] c"Last:\00"
define i64 @parselast(i32* %0) {
%2 = tail call i32 @findLine(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @atol(i32 %2)
ret i64 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SYS_kill;
int syscall(int /*<<< orphan*/, int /*<<< orphan*/, int, int /*<<< orphan*/);
int kill2(pid_t pid, int sig) { return syscall(SYS_kill, pid, sig, 0); }


x86 assembly (clang, -O0):
<kill2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
xor    %ecx,%ecx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kill2>:
mov    %esi,%edx
mov    %edi,%esi
mov    0x2edd(%rip),%rax
mov    (%rax),%edi
xor    %ecx,%ecx
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@SYS_kill = global i32 0
define i32 @kill2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @SYS_kill
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @syscall(i32 %5, i32 %6, i32 %7, i32 0)
ret i32 %8
}

LLVM IR (-O2):
@SYS_kill = global i32 0
define i32 @kill2(i32 %0, i32 %1) {
%3 = load i32, i32* @SYS_kill
%4 = tail call i32 @syscall(i32 %3, i32 %0, i32 %1, i32 0)
ret i32 %4
}
void testInsertionOfTheVertexInGraph() {}


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

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

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

LLVM IR (-O2):
define void @testInsertionOfTheVertexInGraph() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void handleSpeedUp() { printf(" ----- <SpeedUp> -----> "); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c" ----- <SpeedUp> -----> \00"
define void @handleSpeedUp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c" ----- <SpeedUp> -----> \00"
define void @handleSpeedUp() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ kprintf(char *, int);
void isrHandle21() { kprintf("ISR %d.\n", 21); }


x86 assembly (clang, -O0):
<isrHandle21>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x15,%esi
call   1030 <kprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<isrHandle21>:
lea    0xee9(%rip),%rdi
mov    $0x15,%esi
jmp    1030 <kprintf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle21() {
%1 = call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 21)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle21() {
%1 = tail call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 21)
ret void
}
double dropoff(double x, double y, double d) {
  double d2 = (x * x + y * y) / (d * d);
  if (d2 < 1.0) {
    double v = (1 - d2);
    return v * v;
  } else {
    return 0.0;
  }
}


x86 assembly (clang, -O0):
<dropoff>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xeb6(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    117b <dropoff+0x7b>
movsd  0xea3(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1183 <dropoff+0x83>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dropoff>:
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm2
divsd  %xmm2,%xmm0
movsd  0xee4(%rip),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm2
cmpltsd %xmm1,%xmm0
andpd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @dropoff(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%10 = load double, double* %5
%11 = load double, double* %5
%12 = load double, double* %6
%13 = load double, double* %6
%14 = fmul double %12, %13
%15 = call double @llvm.fmuladd.f64(double %10, double %11, double %14)
%16 = load double, double* %7
%17 = load double, double* %7
%18 = fmul double %16, %17
%19 = fdiv double %15, %18
store double %19, double* %8
%20 = load double, double* %8
%21 = fcmp olt double %20, 1.000000e+00
br i1 %21, label %22, label %28
22: ; preds = %3
%23 = load double, double* %8
%24 = fsub double 1.000000e+00, %23
store double %24, double* %9
%25 = load double, double* %9
%26 = load double, double* %9
%27 = fmul double %25, %26
store double %27, double* %4
br label %29
28: ; preds = %3
store double 0.000000e+00, double* %4
br label %29
29: ; preds = %28, %22
%30 = load double, double* %4
ret double %30
}

LLVM IR (-O2):
define double @dropoff(double %0, double %1, double %2) {
%4 = fmul double %1, %1
%5 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %4)
%6 = fmul double %2, %2
%7 = fdiv double %5, %6
%8 = fcmp olt double %7, 1.000000e+00
%9 = fsub double 1.000000e+00, %7
%10 = fmul double %9, %9
%11 = select i1 %8, double %10, double 0.000000e+00
ret double %11
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;
typedef int portnum;

/* Variables and functions */
int tubeRead(int);
uint8_t portin(uint16_t portnum) {
  if ((((portnum)&0xFFF1) == 0x0080)) {
    return tubeRead(((portnum >> 1) & 0x0007));
  }
  return 0xFF;
}


x86 assembly (clang, -O0):
<portin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xfff1,%eax
cmp    $0x80,%eax
jne    1144 <portin+0x34>
mov    -0x8(%rbp),%edi
sar    $0x1,%edi
and    $0x7,%edi
call   1030 <tubeRead@plt>
mov    %eax,-0x4(%rbp)
jmp    114b <portin+0x3b>
movl   $0xff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<portin>:
mov    %edi,%eax
and    $0xfff1,%eax
cmp    $0x80,%eax
jne    1128 <portin+0x18>
shr    %edi
and    $0x7,%edi
jmp    1030 <tubeRead@plt>
mov    $0xff,%eax
ret

LLVM IR (-O0):
define i32 @portin(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 65521
%6 = icmp eq i32 %5, 128
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* %3
%9 = ashr i32 %8, 1
%10 = and i32 %9, 7
%11 = call i32 @tubeRead(i32 %10)
store i32 %11, i32* %2
br label %13
12: ; preds = %1
store i32 255, i32* %2
br label %13
13: ; preds = %12, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @portin(i32 %0) {
%2 = and i32 %0, 65521
%3 = icmp eq i32 %2, 128
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = lshr i32 %0, 1
%6 = and i32 %5, 7
%7 = tail call i32 @tubeRead(i32 %6)
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 255, %1 ]
ret i32 %9
}
char *ckuitoa(n)
unsigned int n;
{
  unsigned long nn;
  nn = n;
  return (ckultoa(nn));
}


x86 assembly (clang, -O0):
<ckuitoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <ckultoa@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ckuitoa>:
push   %rax
mov    %edi,%edi
xor    %eax,%eax
call   1030 <ckultoa@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @ckuitoa(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = call i32 (i64, ...) bitcast (i32 (...)* @ckultoa to i32 (i64, ...)*)(i64 %6)
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i8*
ret i8* %9
}

LLVM IR (-O2):
define i8* @ckuitoa(i32 %0) {
%2 = zext i32 %0 to i64
%3 = tail call i32 (i64, ...) bitcast (i32 (...)* @ckultoa to i32 (i64, ...)*)(i64 %2)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
ret i8* %5
}
void ScaleARGBFilterCols_Any_NEON() {}


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

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

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

LLVM IR (-O2):
define void @ScaleARGBFilterCols_Any_NEON() {
ret void
}
/* Variables and functions */
scalar_t__ medmeddev_short(int, short *);
short MAD_short(int n, short *data) {
  return (short)(1.483 * ((double)medmeddev_short(n, data)));
}


x86 assembly (clang, -O0):
<MAD_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <medmeddev_short@plt>
cvtsi2sd %rax,%xmm0
movsd  0xec8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MAD_short>:
push   %rax
call   1030 <medmeddev_short@plt>
cvtsi2sd %rax,%xmm0
mulsd  0xedd(%rip),%xmm0
cvttsd2si %xmm0,%eax
pop    %rcx
ret

LLVM IR (-O0):
define signext i16 @MAD_short(i32 %0, i16* %1) {
%3 = alloca i32
%4 = alloca i16*
store i32 %0, i32* %3
store i16* %1, i16** %4
%5 = load i32, i32* %3
%6 = load i16*, i16** %4
%7 = call i64 @medmeddev_short(i32 %5, i16* %6)
%8 = sitofp i64 %7 to double
%9 = fmul double 1.483000e+00, %8
%10 = fptosi double %9 to i16
ret i16 %10
}

LLVM IR (-O2):
define signext i16 @MAD_short(i32 %0, i16* %1) {
%3 = tail call i64 @medmeddev_short(i32 %0, i16* %1)
%4 = sitofp i64 %3 to double
%5 = fmul double %4, 1.483000e+00
%6 = fptosi double %5 to i16
ret i16 %6
}
int test_imm_E5uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xE5 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E5uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 229
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void _M2_ldtoa_init(void) {}


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

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

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

LLVM IR (-O2):
define void @_M2_ldtoa_init() {
ret void
}
void i2d_X509(void) {}


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

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

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

LLVM IR (-O2):
define void @i2d_X509() {
ret void
}
/* Variables and functions */
int putchar(int);
int outchar(int c) { return (putchar(c & 0177)); }


x86 assembly (clang, -O0):
<outchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
and    $0x7f,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outchar>:
and    $0x7f,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define i32 @outchar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 127
%5 = call i32 @putchar(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @outchar(i32 %0) {
%2 = and i32 %0, 127
%3 = tail call i32 @putchar(i32 %2)
ret i32 %3
}
int main(void) {
  printf("asm inside\n");
  int a = 10, b;
  asm("movl %1, %%eax;"
      "movl %%eax, %0;"
      "std;"
      "cld;"
      : "=r"(b)
      : "r"(a)
      : "%eax");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    %ecx,%eax
mov    %eax,%ecx
std
cld
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"asm inside\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 10, i32* %2
%5 = load i32, i32* %2
%6 = call i32 asm "movl $1, %eax;movl %eax, $0;std;cld;", "=r,r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32 %5)
store i32 %6, i32* %3
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"asm inside\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 asm "movl $1, %eax;movl %eax, $0;std;cld;", "=r,r,~{eax},~{dirflag},~{fpsr},~{flags}"(i32 10)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ volatile uint32_t;

/* Variables and functions */
uint32_t mmio_read(uint32_t reg) { return *(volatile uint32_t *)reg; }


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

x86 assembly (clang, -O2):
<mmio_read>:
mov    %rdi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
mov    (%rax),%rax
ret

LLVM IR (-O0):
define i64 @mmio_read(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
ret i64 %5
}

LLVM IR (-O2):
define i64 @mmio_read(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ f();
int main() {
  int y;
  int *p;
  y = 10;
  f();
  y += 7;
  y = *p & 10;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
mov    -0x8(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0xa,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
store i32 10, i32* %2
%4 = call i32 (...) @f()
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 7
store i32 %6, i32* %2
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = and i32 %8, 10
store i32 %9, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
ret i32 0
}
long cross_product(long x1, long y1, long x2, long y2) {
  return ((x1 * y2) - (y1 * x2));
}


x86 assembly (clang, -O0):
<cross_product>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
imul   -0x18(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cross_product>:
mov    %rdi,%rax
imul   %rcx,%rax
imul   %rdx,%rsi
sub    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @cross_product(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %5
%10 = load i64, i64* %8
%11 = mul nsw i64 %9, %10
%12 = load i64, i64* %6
%13 = load i64, i64* %7
%14 = mul nsw i64 %12, %13
%15 = sub nsw i64 %11, %14
ret i64 %15
}

LLVM IR (-O2):
define i64 @cross_product(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = mul nsw i64 %3, %0
%6 = mul nsw i64 %2, %1
%7 = sub nsw i64 %5, %6
ret i64 %7
}
/* Type definitions */
struct sleeptimer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_sleeptimer_dequeue(struct sleeptimer *);
int /*<<< orphan*/ timer_lock();
int /*<<< orphan*/ timer_unlock();
void sleeptimer_dequeue(struct sleeptimer *timer) {
  timer_lock();
  do_sleeptimer_dequeue(timer);
  timer_unlock();
}


x86 assembly (clang, -O0):
<sleeptimer_dequeue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <timer_lock@plt>
mov    -0x8(%rbp),%rdi
call   1040 <do_sleeptimer_dequeue@plt>
mov    $0x0,%al
call   1030 <timer_unlock@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleeptimer_dequeue>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <timer_lock@plt>
mov    %rbx,%rdi
call   1040 <do_sleeptimer_dequeue@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <timer_unlock@plt>

LLVM IR (-O0):
%struct.sleeptimer = type { i32 }
define void @sleeptimer_dequeue(%struct.sleeptimer* %0) {
%2 = alloca %struct.sleeptimer*
store %struct.sleeptimer* %0, %struct.sleeptimer** %2
%3 = call i32 (...) @timer_lock()
%4 = load %struct.sleeptimer*, %struct.sleeptimer** %2
%5 = call i32 @do_sleeptimer_dequeue(%struct.sleeptimer* %4)
%6 = call i32 (...) @timer_unlock()
ret void
}

LLVM IR (-O2):
%struct.sleeptimer = type { i32 }
define void @sleeptimer_dequeue(%struct.sleeptimer* %0) {
%2 = tail call i32 (...) @timer_lock()
%3 = tail call i32 @do_sleeptimer_dequeue(%struct.sleeptimer* %0)
%4 = tail call i32 (...) @timer_unlock()
ret void
}
main() { int i; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%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
ret i32 0
}

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

/* Variables and functions */
scalar_t__ block_get(struct block const *, char *);
const char *block_name(const struct block *block) {
  return block_get(block, "name") ?: "<unknown>";
}


x86 assembly (clang, -O0):
<block_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <block_get@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1147 <block_name+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1157 <block_name+0x47>
lea    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1157 <block_name+0x47>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<block_name>:
push   %rax
lea    0xee8(%rip),%rsi
call   1030 <block_get@plt>
test   %rax,%rax
lea    0xede(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.block = type { i32 }
@.str = [5 x i8] c"name\00"
@.str.1 = [10 x i8] c"<unknown>\00"
define i8* @block_name(%struct.block* %0) {
%2 = alloca %struct.block*
store %struct.block* %0, %struct.block** %2
%3 = load %struct.block*, %struct.block** %2
%4 = call i64 @block_get(%struct.block* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = inttoptr i64 %4 to i8*
br label %9
8: ; preds = %1
br label %9
9: ; preds = %8, %6
%10 = phi i8* [ %7, %6 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), %8 ]
ret i8* %10
}

LLVM IR (-O2):
%struct.block = type { i32 }
@.str = [5 x i8] c"name\00"
@.str.1 = [10 x i8] c"<unknown>\00"
define i8* @block_name(%struct.block* %0) {
%2 = tail call i64 @block_get(%struct.block* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
%4 = inttoptr i64 %2 to i8*
%5 = select i1 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %4
ret i8* %5
}
/* Variables and functions */
int drv_end_tag(int);
extern int drv_attribute_close(int p) { return drv_end_tag(p); }


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

x86 assembly (clang, -O2):
<drv_attribute_close>:
jmp    1030 <drv_end_tag@plt>

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

LLVM IR (-O2):
define i32 @drv_attribute_close(i32 %0) {
%2 = tail call i32 @drv_end_tag(i32 %0)
ret i32 %2
}
/* Variables and functions */
int func_int(int, int, int, int);
int func_str() {
  int a = 1, b = 2;
  int ret;
  ret = func_int(a, a, b, b);
  return ret;
}


x86 assembly (clang, -O0):
<func_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1030 <func_int@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_str>:
mov    $0x1,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x2,%ecx
jmp    1030 <func_int@plt>

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

LLVM IR (-O2):
define i32 @func_str() {
%1 = tail call i32 @func_int(i32 1, i32 1, i32 2, i32 2)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_pdispatch_is_pending() {
  printf("NOT IMPLEMENTED:"
         "pa_pdispatch_is_pending"
         "\n");
}


x86 assembly (clang, -O0):
<pa_pdispatch_is_pending>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [41 x i8] c"NOT IMPLEMENTED:pa_pdispatch_is_pending\0A\00"
define i32 @pa_pdispatch_is_pending() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [40 x i8] c"NOT IMPLEMENTED:pa_pdispatch_is_pending\00"
define i32 @pa_pdispatch_is_pending() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
unsigned int lookup_gpio_by_key(char const *);
unsigned int lookup_gpio_by_name(char const *);
int get_gpio_number(const char *key, unsigned int *gpio) {
  *gpio = lookup_gpio_by_key(key);
  if (!*gpio) {
    *gpio = lookup_gpio_by_name(key);
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_gpio_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <lookup_gpio_by_key@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    115f <get_gpio_number+0x3f>
mov    -0x8(%rbp),%rdi
call   1030 <lookup_gpio_by_name@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_gpio_number>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <lookup_gpio_by_key@plt>
mov    %eax,(%r14)
test   %eax,%eax
jne    1141 <get_gpio_number+0x21>
mov    %rbx,%rdi
call   1030 <lookup_gpio_by_name@plt>
mov    %eax,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @get_gpio_number(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = call i32 @lookup_gpio_by_key(i8* %5)
%7 = load i32*, i32** %4
store i32 %6, i32* %7
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = call i32 @lookup_gpio_by_name(i8* %12)
%14 = load i32*, i32** %4
store i32 %13, i32* %14
br label %15
15: ; preds = %11, %2
ret i32 0
}

LLVM IR (-O2):
define i32 @get_gpio_number(i8* %0, i32* nocapture writeonly %1) {
%3 = tail call i32 @lookup_gpio_by_key(i8* %0)
store i32 %3, i32* %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @lookup_gpio_by_name(i8* %0)
store i32 %6, i32* %1
br label %7
7: ; preds = %5, %2
ret i32 0
}
int do_final_chat(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @do_final_chat() {
ret i32 0
}
int INDEX(int ipd_port) {
  if (ipd_port < 32)
    return ipd_port & 15;
  else
    return ipd_port & 3;
}


x86 assembly (clang, -O0):
<INDEX>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    111f <INDEX+0x1f>
mov    -0x8(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
jmp    1128 <INDEX+0x28>
mov    -0x8(%rbp),%eax
and    $0x3,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<INDEX>:
cmp    $0x20,%edi
mov    $0xf,%ecx
mov    $0x3,%eax
cmovl  %ecx,%eax
and    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @INDEX(i32 %0) {
%2 = icmp slt i32 %0, 32
%3 = select i1 %2, i32 15, i32 3
%4 = and i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void bad(unsigned int v1, unsigned int v2) {
  printf("%u\n",
         1631381461u * (((v2 - 1273463329u <= v1 - 1273463329u) ? v2 : v1) -
                        1273463329u) +
             121322179u);
}


x86 assembly (clang, -O0):
<bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x4be78221,%eax
mov    -0x4(%rbp),%ecx
sub    $0x4be78221,%ecx
cmp    %ecx,%eax
ja     1142 <bad+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <bad+0x38>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x4be78221,%eax
imul   $0x613ce7d5,%eax,%esi
add    $0x73b3ac3,%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bad>:
lea    -0x4be78221(%rsi),%eax
lea    -0x4be78221(%rdi),%ecx
cmp    %ecx,%eax
cmova  %edi,%esi
imul   $0x613ce7d5,%esi,%esi
add    $0xf8742e4e,%esi
lea    0xecc(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%u\0A\00"
define void @bad(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 = sub i32 %5, 1273463329
%7 = load i32, i32* %3
%8 = sub i32 %7, 1273463329
%9 = icmp ule i32 %6, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %14
12: ; preds = %2
%13 = load i32, i32* %3
br label %14
14: ; preds = %12, %10
%15 = phi i32 [ %11, %10 ], [ %13, %12 ]
%16 = sub i32 %15, 1273463329
%17 = mul i32 1631381461, %16
%18 = add i32 %17, 121322179
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
define void @bad(i32 %0, i32 %1) {
%3 = add i32 %1, -1273463329
%4 = add i32 %0, -1273463329
%5 = icmp ugt i32 %3, %4
%6 = select i1 %5, i32 %0, i32 %1
%7 = mul i32 %6, 1631381461
%8 = add i32 %7, -126603698
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ Get_Sched_Priority_MinMax(int *, int *);
int /*<<< orphan*/ create_thread_with_priority(char *, int /*<<< orphan*/);
int /*<<< orphan*/ pthread_join(int /*<<< orphan*/, int /*<<< orphan*/ *);
int main() {
  int sched_min, sched_max;
  Get_Sched_Priority_MinMax(&sched_min, &sched_max);
  pthread_t tid = create_thread_with_priority((char *)"Sample_Priority", 0);
  pthread_join(tid, NULL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <Get_Sched_Priority_MinMax@plt>
lea    0xead(%rip),%rdi
xor    %esi,%esi
call   1030 <create_thread_with_priority@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <pthread_join@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <Get_Sched_Priority_MinMax@plt>
lea    0xebb(%rip),%rdi
xor    %esi,%esi
call   1030 <create_thread_with_priority@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1050 <pthread_join@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Sample_Priority\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @Get_Sched_Priority_MinMax(i32* %2, i32* %3)
%6 = call i32 @create_thread_with_priority(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = call i32 @pthread_join(i32 %7, i32* null)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Sample_Priority\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @Get_Sched_Priority_MinMax(i32* %1, i32* %2)
%6 = call i32 @create_thread_with_priority(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0)
%7 = call i32 @pthread_join(i32 %6, i32* null)
ret i32 0
}
void asn1_enc_free(void) {}


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

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

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

LLVM IR (-O2):
define void @asn1_enc_free() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int i = 0;
  while (1) {
    i++;
    printf("%d\n", i);
  }
  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   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
jmp    112d <main+0x1d>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
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 0, i32* %6
br label %7
7: ; preds = %2, %7
%8 = load i32, i32* %6
%9 = add nsw i32 %8, 1
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %7
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 0, %2 ], [ %5, %3 ]
%5 = add nuw nsw i32 %4, 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %3
}
/* Variables and functions */
int ENODEV;
int qpnp_pon_is_lpk(void) { return -ENODEV; }


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

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

LLVM IR (-O0):
@ENODEV = global i32 0
define i32 @qpnp_pon_is_lpk() {
%1 = load i32, i32* @ENODEV
%2 = sub nsw i32 0, %1
ret i32 %2
}

LLVM IR (-O2):
@ENODEV = global i32 0
define i32 @qpnp_pon_is_lpk() {
%1 = load i32, i32* @ENODEV
%2 = sub nsw i32 0, %1
ret i32 %2
}