#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 */
char EOF;
char getchar();
int is_prime(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, float *);
int main() {
  float num;
  int error = 0;
  char charAfterFloat;
  if (scanf("%f", &num)) {
    charAfterFloat = getchar();
    if (!((charAfterFloat == '\n') || (charAfterFloat == EOF)) ||
        ((int)num != num))
      error = 1;
  } else
    error = 1;
  if (error)
    printf("-1");
  else
    printf("%d", is_prime((int)num));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
cmp    $0x0,%rax
je     11c7 <main+0x87>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0xa,%eax
je     119d <main+0x5d>
movsbl -0xd(%rbp),%eax
mov    0x2e56(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11bb <main+0x7b>
cvttss2si -0x8(%rbp),%eax
cvtsi2ss %eax,%xmm0
ucomiss -0x8(%rbp),%xmm0
jne    11bb <main+0x7b>
jp     11bb <main+0x7b>
jmp    11c2 <main+0x82>
movl   $0x1,-0xc(%rbp)
jmp    11ce <main+0x8e>
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11eb <main+0xab>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1205 <main+0xc5>
cvttss2si -0x8(%rbp),%edi
call   1050 <is_prime@plt>
mov    %eax,%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
test   %rax,%rax
je     1181 <main+0x41>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%al
je     116d <main+0x2d>
mov    0x2e7f(%rip),%rcx
cmp    (%rcx),%al
jne    1181 <main+0x41>
movss  0x4(%rsp),%xmm0
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1181 <main+0x41>
jnp    1193 <main+0x53>
lea    0xe7b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
cvttss2si %xmm0,%edi
call   1050 <is_prime@plt>
lea    0xe63(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    118f <main+0x4f>

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@EOF = global i8 0
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %3
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %26
7: ; preds = %0
%8 = call signext i8 (...) @getchar()
store i8 %8, i8* %4
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 10
br i1 %11, label %18, label %12
12: ; preds = %7
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
%15 = load i8, i8* @EOF
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %14, %16
br i1 %17, label %18, label %24
18: ; preds = %12, %7
%19 = load float, float* %2
%20 = fptosi float %19 to i32
%21 = sitofp i32 %20 to float
%22 = load float, float* %2
%23 = fcmp une float %21, %22
br i1 %23, label %24, label %25
24: ; preds = %18, %12
store i32 1, i32* %3
br label %25
25: ; preds = %24, %18
br label %27
26: ; preds = %0
store i32 1, i32* %3
br label %27
27: ; preds = %26, %25
%28 = load i32, i32* %3
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %37
32: ; preds = %27
%33 = load float, float* %2
%34 = fptosi float %33 to i32
%35 = call i32 @is_prime(i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %32, %30
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@EOF = global i8 0
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %0
%6 = call signext i8 (...) @getchar()
%7 = icmp eq i8 %6, 10
%8 = load i8, i8* @EOF
%9 = icmp eq i8 %6, %8
%10 = select i1 %7, i1 true, i1 %9
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = load float, float* %1
%13 = fptosi float %12 to i32
%14 = sitofp i32 %13 to float
%15 = fcmp une float %12, %14
br i1 %15, label %16, label %18
16: ; preds = %11, %5, %0
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %21
18: ; preds = %11
%19 = call i32 @is_prime(i32 %13)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %16
ret i32 0
}