#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int primo(long);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, long *);
int main(int argc, char const *argv[]) {
  long a = 0;
  do {
    scanf("%li", &a);
    if (a != -1) {
      printf("%d\n", primo(a));
    }
  } while (a != -1);
  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)
movq   $0x0,-0x18(%rbp)
lea    0xeab(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpq   $0xffffffffffffffff,-0x18(%rbp)
je     1180 <main+0x50>
mov    -0x18(%rbp),%rdi
call   1050 <primo@plt>
mov    %eax,%esi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
jmp    1185 <main+0x55>
cmpq   $0xffffffffffffffff,-0x18(%rbp)
jne    114e <main+0x1e>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
lea    0xeb7(%rip),%r14
lea    0x8(%rsp),%rbx
lea    0xeaf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x8(%rsp),%rdi
cmp    $0xffffffffffffffff,%rdi
je     118d <main+0x5d>
call   1050 <primo@plt>
mov    %r15,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
cmpq   $0xffffffffffffffff,0x8(%rsp)
jne    1160 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%li\00"
@.str.1 = [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 i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
br label %7
7: ; preds = %16, %2
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %6)
%9 = load i64, i64* %6
%10 = icmp ne i64 %9, -1
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i64, i64* %6
%13 = call i32 @primo(i64 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %11, %7
br label %16
16: ; preds = %15
%17 = load i64, i64* %6
%18 = icmp ne i64 %17, -1
br i1 %18, label %7, label %19
19: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%li\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 0, i64* %3
br label %5
5: ; preds = %9, %2
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
%7 = load i64, i64* %3
%8 = icmp eq i64 %7, -1
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = call i32 @primo(i64 %7)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = load i64, i64* %3
%13 = icmp eq i64 %12, -1
br i1 %13, label %14, label %5
14: ; preds = %5, %9
ret i32 0
}