xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage(char *argv0) {
  printf("%s: tests direct I/O\n", argv0);
  printf("-d <seconds>:          sets duration to <seconds>\n");
  printf("-h:                    this help\n");
  printf("-p <pages>:            sets number of pages to allocate\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf1a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
lea    0xf18(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"%s: tests direct I/O\0A\00"
@.str.1 = [51 x i8] c"-d <seconds>: sets duration to <seconds>\0A\00"
@.str.2 = [34 x i8] c"-h: this help\0A\00"
@.str.3 = [57 x i8] c"-p <pages>: sets number of pages to allocate\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s: tests direct I/O\0A\00"
@str = [50 x i8] c"-d <seconds>: sets duration to <seconds>\00"
@str.4 = [33 x i8] c"-h: this help\00"
@str.5 = [56 x i8] c"-p <pages>: sets number of pages to allocate\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.4, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.5, i64 0, i64 0))
ret void
}
/* Type definitions */
struct vector {
  int dummy;
};

/* Variables and functions */
struct vector *vector_init_size(int);
struct vector *vector_init() {
  return vector_init_size(8);
}


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

x86 assembly (clang, -O2):
<vector_init>:
mov    $0x8,%edi
jmp    1030 <vector_init_size@plt>

LLVM IR (-O0):
%struct.vector = type { i32 }
define %struct.vector* @vector_init() {
%1 = call %struct.vector* @vector_init_size(i32 8)
ret %struct.vector* %1
}

LLVM IR (-O2):
%struct.vector = type { i32 }
define %struct.vector* @vector_init() {
%1 = tail call %struct.vector* @vector_init_size(i32 8)
ret %struct.vector* %1
}
/* Type definitions */
struct em8051 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
int disasm_movx_indir_dptr_a(struct em8051 *aCPU, int aPosition,
                             char *aBuffer) {
  sprintf(aBuffer, "MOVX  @DPTR, A");
  return 1;
}


x86 assembly (clang, -O0):
<disasm_movx_indir_dptr_a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xed2(%rip),%rsi
call   1030 <sprintf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disasm_movx_indir_dptr_a>:
movabs $0x41202c52545044,%rax
mov    %rax,0x7(%rdx)
movabs $0x4440202058564f4d,%rax
20 40 44
mov    %rax,(%rdx)
mov    $0x1,%eax
ret

LLVM IR (-O0):
%struct.em8051 = type { i32 }
@.str = [15 x i8] c"MOVX @DPTR, A\00"
define i32 @disasm_movx_indir_dptr_a(%struct.em8051* %0, i32 %1, i8* %2) {
%4 = alloca %struct.em8051*
%5 = alloca i32
%6 = alloca i8*
store %struct.em8051* %0, %struct.em8051** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
%struct.em8051 = type { i32 }
@.str = [15 x i8] c"MOVX @DPTR, A\00"
define i32 @disasm_movx_indir_dptr_a(%struct.em8051* nocapture readnone %0, i32 %1, i8* nocapture writeonly %2) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(15) %2, i8* align 1 dereferenceable(15) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 15, i1 false)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *malloc(size_t);
int /*<<< orphan*/ perror(char *);
void *checked_malloc(size_t bytes) {
  void *m = malloc(bytes);
  if (!m) {
    perror("Malloc failed");
    abort();
  }
  return m;
}


x86 assembly (clang, -O0):
<checked_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1167 <checked_malloc+0x37>
lea    0xea5(%rip),%rdi
call   1050 <perror@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_malloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <checked_malloc+0xd>
pop    %rcx
ret
lea    0xebc(%rip),%rdi
call   1050 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Malloc failed\00"
define i8* @checked_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [14 x i8] c"Malloc failed\00"
define noalias i8* @checked_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ fd_spi_sync_tx1(int, int);
int /*<<< orphan*/ fd_w25q16dw_wait_while_busy();
void fd_w25q16dw_sleep(void) {
  fd_w25q16dw_wait_while_busy();
  fd_spi_sync_tx1(((0 << 16) | 0), 0xb9);
}


x86 assembly (clang, -O0):
<fd_w25q16dw_sleep>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <fd_w25q16dw_wait_while_busy@plt>
xor    %edi,%edi
mov    $0xb9,%esi
call   1030 <fd_spi_sync_tx1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd_w25q16dw_sleep>:
push   %rax
xor    %eax,%eax
call   1040 <fd_w25q16dw_wait_while_busy@plt>
xor    %edi,%edi
mov    $0xb9,%esi
pop    %rax
jmp    1030 <fd_spi_sync_tx1@plt>

LLVM IR (-O0):
define void @fd_w25q16dw_sleep() {
%1 = call i32 (...) @fd_w25q16dw_wait_while_busy()
%2 = call i32 @fd_spi_sync_tx1(i32 0, i32 185)
ret void
}

LLVM IR (-O2):
define void @fd_w25q16dw_sleep() {
%1 = tail call i32 (...) @fd_w25q16dw_wait_while_busy()
%2 = tail call i32 @fd_spi_sync_tx1(i32 0, i32 185)
ret void
}
/* Variables and functions */
int exp(float);
int sqrt(float);
float fncend(float x) { return (float)(exp(-x) / sqrt(x)); }


x86 assembly (clang, -O0):
<fncend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
call   1030 <exp@plt>
mov    %eax,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fncend>:
push   %rbx
sub    $0x10,%rsp
movaps %xmm0,%xmm1
movaps %xmm0,(%rsp)
movaps 0xecd(%rip),%xmm0
xorps  %xmm1,%xmm0
call   1030 <exp@plt>
mov    %eax,%ebx
movaps (%rsp),%xmm0
call   1040 <sqrt@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @fncend(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fneg float %3
%5 = call i32 @exp(float %4)
%6 = load float, float* %2
%7 = call i32 @sqrt(float %6)
%8 = sdiv i32 %5, %7
%9 = sitofp i32 %8 to float
ret float %9
}

LLVM IR (-O2):
define float @fncend(float %0) {
%2 = fneg float %0
%3 = tail call i32 @exp(float %2)
%4 = tail call i32 @sqrt(float %0)
%5 = sdiv i32 %3, %4
%6 = sitofp i32 %5 to float
ret float %6
}
/* Variables and functions */
scalar_t__ write(int, char *, int);
void ft_putchar(char c) {
  if (write(1, &c, 1)) {
  };
}


x86 assembly (clang, -O0):
<ft_putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edx
lea    -0x1(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
cmp    $0x0,%rax
je     113d <ft_putchar+0x2d>
jmp    113d <ft_putchar+0x2d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putchar>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @ft_putchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i64 @write(i32 1, i8* %2, i32 1)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %6
6: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @ft_putchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i64 @write(i32 1, i8* %2, i32 1)
ret void
}
float f5(float x, int y) { return x * y; }


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<f5>:
cvtsi2ss %edi,%xmm1
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @f5(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
store float %0, float* %3
store i32 %1, i32* %4
%5 = load float, float* %3
%6 = load i32, i32* %4
%7 = sitofp i32 %6 to float
%8 = fmul float %5, %7
ret float %8
}

LLVM IR (-O2):
define float @f5(float %0, i32 %1) {
%3 = sitofp i32 %1 to float
%4 = fmul float %3, %0
ret float %4
}
int match_get_color() {
  extern volatile int match_color;
  return match_color;
}


x86 assembly (clang, -O0):
<match_get_color>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@match_color = external global i32
define i32 @match_get_color() {
%1 = load volatile i32, i32* @match_color
ret i32 %1
}

LLVM IR (-O2):
@match_color = external global i32
define i32 @match_get_color() {
%1 = load volatile i32, i32* @match_color
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ identities();
int /*<<< orphan*/ srand48(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  srand48(time(NULL));
  identities();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <time@plt>
mov    %eax,%edi
call   1040 <srand48@plt>
xor    %eax,%eax
call   1050 <identities@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @time(i32* null)
%3 = call i32 @srand48(i32 %2)
%4 = call i32 (...) @identities()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand48(i32 %1)
%3 = tail call i32 (...) @identities()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fwrite(int *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void test_fwrite() {
  int n = 0;
  fwrite(&n, sizeof(int), 1, stdout);
  assert(n == 0);
}


x86 assembly (clang, -O0):
<test_fwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%ecx
lea    -0x4(%rbp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <fwrite@plt>
cmpl   $0x0,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_fwrite>:
push   %rax
movl   $0x0,0x4(%rsp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%ecx
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
call   1040 <fwrite@plt>
xor    %edi,%edi
cmpl   $0x0,0x4(%rsp)
sete   %dil
call   1030 <assert@plt>
pop    %rax
ret

LLVM IR (-O0):
@stdout = global i32 0
define void @test_fwrite() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stdout
%3 = call i32 @fwrite(i32* %1, i32 4, i32 1, i32 %2)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @test_fwrite() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = load i32, i32* @stdout
%4 = call i32 @fwrite(i32* %1, i32 4, i32 1, i32 %3)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printMeter100Needle(int);
void printLightingVolumeNeedle(int volume) {
  printMeter100Needle(volume);
  return;
}


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

x86 assembly (clang, -O2):
<printLightingVolumeNeedle>:
jmp    1030 <printMeter100Needle@plt>

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

LLVM IR (-O2):
define void @printLightingVolumeNeedle(i32 %0) {
%2 = tail call i32 @printMeter100Needle(i32 %0)
ret void
}
int neiin0(int a) { return -(a != 0); }


x86 assembly (clang, -O0):
<neiin0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<neiin0>:
neg    %edi
sbb    %eax,%eax
ret

LLVM IR (-O0):
define i32 @neiin0(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i32
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @neiin0(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fb_write(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ putc(char);
int /*<<< orphan*/ strlen(char const *);
void puts(const char *str) {
  fb_write(str, strlen(str));
  putc('\n');
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1050 <fb_write@plt>
mov    $0xa,%edi
call   1040 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <fb_write@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1040 <putc@plt>

LLVM IR (-O0):
define void @puts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @fb_write(i8* %3, i32 %5)
%7 = call i32 @putc(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @puts(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @fb_write(i8* %0, i32 %2)
%4 = tail call i32 @putc(i8 signext 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char a[100];
  scanf("%s", a);
  printf("%s\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xed4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}
char bar(const char *ptr, int off) { return ptr[off + 1]; }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
movslq %esi,%rax
mov    0x1(%rax,%rdi,1),%al
ret

LLVM IR (-O0):
define signext i8 @bar(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8, i8* %9
ret i8 %10
}

LLVM IR (-O2):
define signext i8 @bar(i8* nocapture %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
ret i8 %6
}
int MPI_Finalize(void) { return 1; }


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

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

LLVM IR (-O0):
define i32 @MPI_Finalize() {
ret i32 1
}

LLVM IR (-O2):
define i32 @MPI_Finalize() {
ret i32 1
}
/* Variables and functions */
int f(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%d\n", f(10));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @f(i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
unsigned xrop3_93_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~S;
  stk2 = T | stk3;
  stk1 = D & stk2;
  stk1 = ~stk1;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_93_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_93_1_1>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%edx
shl    $0x8,%edx
mov    %edi,%eax
xor    $0xff,%eax
or     %esi,%eax
or     %ecx,%eax
or     %edx,%eax
not    %eax
or     %edi,%esi
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_93_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = xor i32 %23, -1
store i32 %24, i32* %10
%25 = load i32, i32* %7
%26 = load i32, i32* %10
%27 = or i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %5
%29 = load i32, i32* %9
%30 = and i32 %28, %29
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = xor i32 %31, -1
store i32 %32, i32* %8
%33 = load i32, i32* %8
%34 = load i32, i32* %6
%35 = xor i32 %34, -1
%36 = and i32 %33, %35
%37 = load i32, i32* %7
%38 = xor i32 %37, -1
%39 = and i32 %36, %38
%40 = load i32, i32* %5
%41 = load i32, i32* %6
%42 = and i32 %40, %41
%43 = or i32 %39, %42
%44 = load i32, i32* %5
%45 = load i32, i32* %7
%46 = and i32 %44, %45
%47 = or i32 %43, %46
ret i32 %47
}

LLVM IR (-O2):
define i32 @xrop3_93_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = xor i32 %3, 255
%8 = or i32 %7, %5
%9 = or i32 %8, %4
%10 = or i32 %9, %6
%11 = xor i32 %10, -1
%12 = or i8 %1, %0
%13 = zext i8 %12 to i32
%14 = or i32 %13, %11
ret i32 %14
}
int calcola_numero_eur(int tipo_eur) {
  if (tipo_eur == 15) {
    return 2;
  } else if (tipo_eur == 16) {
    return 10;
  } else if (tipo_eur == 17) {
    return 15;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<calcola_numero_eur>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
jne    111d <calcola_numero_eur+0x1d>
movl   $0x2,-0x4(%rbp)
jmp    1150 <calcola_numero_eur+0x50>
cmpl   $0x10,-0x8(%rbp)
jne    1133 <calcola_numero_eur+0x33>
movl   $0xa,-0x4(%rbp)
jmp    1150 <calcola_numero_eur+0x50>
cmpl   $0x11,-0x8(%rbp)
jne    1149 <calcola_numero_eur+0x49>
movl   $0xf,-0x4(%rbp)
jmp    1150 <calcola_numero_eur+0x50>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcola_numero_eur>:
add    $0xfffffff1,%edi
mov    $0x1,%eax
cmp    $0x2,%edi
ja     111a <calcola_numero_eur+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

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

LLVM IR (-O2):
@switch.table.calcola_numero_eur = [3 x i32] [i32 2, i32 10, i32 15]
define i32 @calcola_numero_eur(i32 %0) {
%2 = add i32 %0, -15
%3 = icmp ult i32 %2, 3
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.calcola_numero_eur, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 1, %1 ]
ret i32 %9
}
void dv3_sub(double *a, double *b) {
  a[0] -= b[0];
  a[1] -= b[1];
  a[2] -= b[2];
}


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

x86 assembly (clang, -O2):
<dv3_sub>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
subsd  (%rsi),%xmm0
movsd  %xmm0,(%rdi)
subsd  0x8(%rsi),%xmm1
movsd  %xmm1,0x8(%rdi)
movsd  0x10(%rdi),%xmm0
subsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x10(%rdi)
ret

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

LLVM IR (-O2):
define void @dv3_sub(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = load double, double* %0
%5 = fsub double %4, %3
store double %5, double* %0
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = fsub double %9, %7
store double %10, double* %8
%11 = getelementptr inbounds double, double* %1, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %0, i64 2
%14 = load double, double* %13
%15 = fsub double %14, %12
store double %15, double* %13
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cls() { printf("\e[1;1H\e[2J"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[1;1H\1B[2J\00"
define void @cls() {
%1 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[1;1H\1B[2J\00"
define void @cls() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
int SNDDMA_LockBuffer(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @SNDDMA_LockBuffer() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ japi_setrows(int, int);
void j_setrows(int arg0, int arg1) { japi_setrows(arg0, arg1); }


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

x86 assembly (clang, -O2):
<j_setrows>:
jmp    1030 <japi_setrows@plt>

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

LLVM IR (-O2):
define void @j_setrows(i32 %0, i32 %1) {
%3 = tail call i32 @japi_setrows(i32 %0, i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __off64_t;

/* Variables and functions */
int /*<<< orphan*/ dll_lseeki64(int, int /*<<< orphan*/, int);
__off64_t __wrap_lseek64(int fildes, __off64_t offset, int whence) {
  __off64_t seekRes = dll_lseeki64(fildes, offset, whence);
  return seekRes;
}


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

x86 assembly (clang, -O2):
<__wrap_lseek64>:
jmp    1030 <dll_lseeki64@plt>

LLVM IR (-O0):
define i32 @__wrap_lseek64(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @dll_lseeki64(i32 %8, i32 %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
ret i32 %12
}

LLVM IR (-O2):
define i32 @__wrap_lseek64(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @dll_lseeki64(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
short test_74_2(short *mem) { return __atomic_fetch_nand(mem + 0, -1, 4); }


x86 assembly (clang, -O0):
<test_74_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movw   $0xffff,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    %cx,-0x10(%rbp)
mov    (%rax),%ax
mov    %ax,-0xe(%rbp)
mov    -0xe(%rbp),%ax
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%dx
mov    %dx,%si
mov    %ax,%dx
mov    %edx,-0x28(%rbp)
and    %esi,%edx
mov    %edx,-0x24(%rbp)
not    %edx
mov    %edx,-0x20(%rbp)
lock cmpxchg %dx,(%rcx)
sete   %cl
mov    %ax,-0x1a(%rbp)
test   $0x1,%cl
mov    %ax,-0xe(%rbp)
jne    1162 <test_74_2+0x62>
jmp    1125 <test_74_2+0x25>
mov    -0x1a(%rbp),%ax
mov    %ax,-0xc(%rbp)
movswl -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_74_2>:
movzwl (%rdi),%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%ecx
not    %ecx
lock cmpxchg %cx,(%rdi)
jne    1110 <test_74_2+0x10>
ret

LLVM IR (-O0):
define signext i16 @test_74_2(i16* %0) {
%2 = alloca i16*
%3 = alloca i16
%4 = alloca i16
store i16* %0, i16** %2
%5 = load i16*, i16** %2
%6 = getelementptr inbounds i16, i16* %5, i64 0
store i16 -1, i16* %3
%7 = load i16, i16* %3
%8 = atomicrmw nand i16* %6, i16 %7 acq_rel
store i16 %8, i16* %4
%9 = load i16, i16* %4
ret i16 %9
}

LLVM IR (-O2):
define signext i16 @test_74_2(i16* nocapture %0) {
%2 = atomicrmw nand i16* %0, i16 -1 acq_rel
ret i16 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t convolve_id(uint8_t *image_chunk, int size) {
  return image_chunk[size * size / 2];
}


x86 assembly (clang, -O0):
<convolve_id>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convolve_id>:
imul   %esi,%esi
shr    %esi
mov    (%rdi,%rsi,4),%eax
ret

LLVM IR (-O0):
define i32 @convolve_id(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = mul nsw i32 %6, %7
%9 = sdiv i32 %8, 2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %5, i64 %10
%12 = load i32, i32* %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @convolve_id(i32* nocapture %0, i32 %1) {
%3 = mul nsw i32 %1, %1
%4 = lshr i32 %3, 1
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
ret i32 %7
}
double gerarNA(int multiplicador, int semente, int incremento, int mod) {
  semente = (multiplicador * semente + incremento) % mod;
  return semente;
}


x86 assembly (clang, -O0):
<gerarNA>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %edx,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<gerarNA>:
imul   %esi,%edi
lea    (%rdi,%rdx,1),%eax
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm0
ret

LLVM IR (-O0):
define double @gerarNA(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = mul nsw i32 %9, %10
%12 = load i32, i32* %7
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %8
%15 = srem i32 %13, %14
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = sitofp i32 %16 to double
ret double %17
}

LLVM IR (-O2):
define double @gerarNA(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = mul nsw i32 %1, %0
%6 = add nsw i32 %5, %2
%7 = srem i32 %6, %3
%8 = sitofp i32 %7 to double
ret double %8
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ TIOCGPGRP;
scalar_t__ _ioctl(int, int /*<<< orphan*/, int *);
pid_t tcgetpgrp(int fd) {
  int s;
  if (_ioctl(fd, TIOCGPGRP, &s) < 0)
    return ((pid_t)-1);
  return ((pid_t)s);
}


x86 assembly (clang, -O0):
<tcgetpgrp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdx
call   1030 <_ioctl@plt>
cmp    $0x0,%rax
jge    1146 <tcgetpgrp+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    114c <tcgetpgrp+0x3c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcgetpgrp>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
call   1030 <_ioctl@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
js     1135 <tcgetpgrp+0x25>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@TIOCGPGRP = global i32 0
define i32 @tcgetpgrp(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @TIOCGPGRP
%5 = call i64 @_ioctl(i32 %0, i32 %4, i32* %2)
%6 = icmp slt i64 %5, 0
%7 = load i32, i32* %2
%8 = select i1 %6, i32 -1, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ dbg_break();
void gdb_arch_write_byte(void) { dbg_break(); }


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

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

LLVM IR (-O0):
define void @gdb_arch_write_byte() {
%1 = call i32 (...) @dbg_break()
ret void
}

LLVM IR (-O2):
define void @gdb_arch_write_byte() {
%1 = tail call i32 (...) @dbg_break()
ret void
}
/* Variables and functions */
int biscDrive(int /*<<< orphan*/, int /*<<< orphan*/);
int biscDriveStop(void) { return biscDrive(0, 0); }


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

x86 assembly (clang, -O2):
<biscDriveStop>:
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <biscDrive@plt>

LLVM IR (-O0):
define i32 @biscDriveStop() {
%1 = call i32 @biscDrive(i32 0, i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @biscDriveStop() {
%1 = tail call i32 @biscDrive(i32 0, i32 0)
ret i32 %1
}
int main() {
  int a = 10 + 10;
  int b = 1 + 2 + 3 + 4 + 5;
  if (b - 2 != 6 + 7) {
    goto ERROR;
  }
  if (10 * 2 != a) {
    goto ERROR;
  }
  return (0);
ERROR:
  return (-1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0x8(%rbp)
movl   $0xf,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
cmp    $0xd,%eax
je     112d <main+0x2d>
jmp    114c <main+0x4c>
mov    $0x14,%eax
cmp    -0x8(%rbp),%eax
je     1140 <main+0x40>
jmp    114c <main+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1153 <main+0x53>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%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
%3 = alloca i32
store i32 0, i32* %1
store i32 20, i32* %2
store i32 15, i32* %3
%4 = load i32, i32* %3
%5 = sub nsw i32 %4, 2
%6 = icmp ne i32 %5, 13
br i1 %6, label %7, label %8
7: ; preds = %0
br label %13
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp ne i32 20, %9
br i1 %10, label %11, label %12
11: ; preds = %8
br label %13
12: ; preds = %8
store i32 0, i32* %1
br label %14
13: ; preds = %11, %7
store i32 -1, i32* %1
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef char const uint32_t;

/* Variables and functions */
uint32_t read_uint32(const void *u) {
  const char *b = (const char *)u;
  return (b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24));
}


x86 assembly (clang, -O0):
<read_uint32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x10(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
movsbl 0x2(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%rcx
movsbl 0x3(%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_uint32>:
mov    (%rdi),%al
ret

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

LLVM IR (-O2):
define signext i8 @read_uint32(i8* nocapture %0) {
%2 = load i8, i8* %0
ret i8 %2
}
/* Variables and functions */
int /*<<< orphan*/ jos_init();
int /*<<< orphan*/ jos_sleep();
int /*<<< orphan*/ jos_start();
int /*<<< orphan*/ task1_init();
int /*<<< orphan*/ task2_init();
int main(void) {
  jos_init();
  task1_init();
  task2_init();
  jos_start();
  while (1) {
    jos_sleep();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <jos_init@plt>
mov    $0x0,%al
call   1050 <task1_init@plt>
mov    $0x0,%al
call   1060 <task2_init@plt>
mov    $0x0,%al
call   1040 <jos_start@plt>
mov    $0x0,%al
call   1070 <jos_sleep@plt>
jmp    117b <main+0x2b>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <jos_init@plt>
xor    %eax,%eax
call   1050 <task1_init@plt>
xor    %eax,%eax
call   1060 <task2_init@plt>
xor    %eax,%eax
call   1040 <jos_start@plt>
nopl   (%rax)
xor    %eax,%eax
call   1070 <jos_sleep@plt>
jmp    1170 <main+0x20>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @jos_init()
%3 = call i32 (...) @task1_init()
%4 = call i32 (...) @task2_init()
%5 = call i32 (...) @jos_start()
br label %6
6: ; preds = %0, %6
%7 = call i32 (...) @jos_sleep()
br label %6
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @jos_init()
%2 = tail call i32 (...) @task1_init()
%3 = tail call i32 (...) @task2_init()
%4 = tail call i32 (...) @jos_start()
br label %5
5: ; preds = %0, %5
%6 = tail call i32 (...) @jos_sleep()
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(int);
void g() {
  void *p = malloc(4000);
  free(p);
}


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

x86 assembly (clang, -O2):
<g>:
push   %rax
mov    $0xfa0,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @g() {
%1 = tail call dereferenceable_or_null(4000) i8* @malloc(i32 4000)
%2 = tail call i32 @free(i8* %1)
ret void
}
/* Type definitions */
struct iwreq {
  int /*<<< orphan*/ ifr_name;
};

/* Variables and functions */
int /*<<< orphan*/ IFNAMSIZ;
int ioctl(int, int, struct iwreq *);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int iw_get_ext(int skfd, char *ifname, int request, struct iwreq *pwrq) {
  strncpy(pwrq->ifr_name, ifname, IFNAMSIZ);
  return (ioctl(skfd, request, pwrq));
}


x86 assembly (clang, -O0):
<iw_get_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
call   1030 <strncpy@plt>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1040 <ioctl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iw_get_ext>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%rbx
mov    %edx,%r14d
mov    %edi,%ebp
mov    (%rcx),%edi
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
call   1030 <strncpy@plt>
mov    %ebp,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
%struct.iwreq = type { i32 }
@IFNAMSIZ = global i32 0
define i32 @iw_get_ext(i32 %0, i8* %1, i32 %2, %struct.iwreq* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.iwreq*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store %struct.iwreq* %3, %struct.iwreq** %8
%9 = load %struct.iwreq*, %struct.iwreq** %8
%10 = getelementptr inbounds %struct.iwreq, %struct.iwreq* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = load i8*, i8** %6
%13 = load i32, i32* @IFNAMSIZ
%14 = call i32 @strncpy(i32 %11, i8* %12, i32 %13)
%15 = load i32, i32* %5
%16 = load i32, i32* %7
%17 = load %struct.iwreq*, %struct.iwreq** %8
%18 = call i32 @ioctl(i32 %15, i32 %16, %struct.iwreq* %17)
ret i32 %18
}

LLVM IR (-O2):
%struct.iwreq = type { i32 }
@IFNAMSIZ = global i32 0
define i32 @iw_get_ext(i32 %0, i8* %1, i32 %2, %struct.iwreq* %3) {
%5 = getelementptr inbounds %struct.iwreq, %struct.iwreq* %3, i64 0, i32 0
%6 = load i32, i32* %5
%7 = load i32, i32* @IFNAMSIZ
%8 = tail call i32 @strncpy(i32 %6, i8* %1, i32 %7)
%9 = tail call i32 @ioctl(i32 %0, i32 %2, %struct.iwreq* %3)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void braf_displayInfo(void) {
  printf("braf - a Brainfuck interpreter\n");
  printf("Copyright (C) 2015 Kenneth Cu, Bea Santiago, Sean Ballais, Ivan "
         "Puayap\n");
  printf("Version 0.01a\n");
}


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

x86 assembly (clang, -O2):
<braf_displayInfo>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
lea    0xf36(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"braf - a Brainfuck interpreter\0A\00"
@.str.1 = [72 x i8] c"Copyright (C) 2015 Kenneth Cu, Bea Santiago, Sean Ballais, Ivan Puayap\0A\00"
@.str.2 = [15 x i8] c"Version 0.01a\0A\00"
define void @braf_displayInfo() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"braf - a Brainfuck interpreter\00"
@str.3 = [71 x i8] c"Copyright (C) 2015 Kenneth Cu, Bea Santiago, Sean Ballais, Ivan Puayap\00"
@str.4 = [14 x i8] c"Version 0.01a\00"
define void @braf_displayInfo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
ret void
}
int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offset,
                  int len, int dtype) {
  return 0;
}


x86 assembly (clang, -O0):
<dbg_leb_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ubifs_info = type opaque
define i32 @dbg_leb_write(%struct.ubifs_info* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca %struct.ubifs_info*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store %struct.ubifs_info* %0, %struct.ubifs_info** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
ret i32 0
}

LLVM IR (-O2):
%struct.ubifs_info = type opaque
define i32 @dbg_leb_write(%struct.ubifs_info* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i32 %3, i32 %4, i32 %5) {
ret i32 0
}