#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
float atof(char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ printf(char *, float);
int valid_cells(FILE *pp) {
  int cnt;
  char s1[20];
  float void_nr, up, down;
  for (cnt = 0; cnt < 12; cnt++)
    fscanf(pp, "%s", s1);
  void_nr = atof(s1);
  up = void_nr + 0.0001;
  down = void_nr - 0.0001;
  printf("Void is now = %f \n", void_nr);
  cnt = 0;
  while (fscanf(pp, "%s", s1) != EOF) {
    if (atof(s1) > up || atof(s1) < down)
      cnt++;
  }
  return cnt;
}


x86 assembly (clang, -O0):
<valid_cells>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xc,-0xc(%rbp)
jge    116f <valid_cells+0x3f>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xeac(%rip),%rsi
call   1050 <fscanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <valid_cells+0x13>
lea    -0x20(%rbp),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe72(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe54(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x24(%rbp),%xmm0
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xe28(%rip),%rsi
call   1050 <fscanf@plt>
mov    0x2dfc(%rip),%rcx
cmp    (%rcx),%rax
je     1230 <valid_cells+0x100>
lea    -0x20(%rbp),%rdi
call   1030 <atof@plt>
ucomiss -0x28(%rbp),%xmm0
ja     1222 <valid_cells+0xf2>
lea    -0x20(%rbp),%rdi
call   1030 <atof@plt>
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    122b <valid_cells+0xfb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d1 <valid_cells+0xa1>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_cells>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
mov    %rdi,%r12
lea    0xeca(%rip),%r14
lea    0x10(%rsp),%r15
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    %r15,%rdi
call   1030 <atof@plt>
lea    0xe14(%rip),%rdi
movss  %xmm0,0x8(%rsp)
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <fscanf@plt>
mov    0x2dc9(%rip),%r15
xor    %ebp,%ebp
cmp    (%r15),%rax
je     12a6 <valid_cells+0x176>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdc4(%rip),%xmm1
addsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x8(%rsp)
addsd  0xdb6(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
xor    %ebp,%ebp
lea    0x10(%rsp),%rbx
lea    0xda6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <atof@plt>
ucomiss 0x8(%rsp),%xmm0
seta   %al
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
seta   %cl
or     %al,%cl
movzbl %cl,%eax
add    %eax,%ebp
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <fscanf@plt>
cmp    (%r15),%rax
jne    1270 <valid_cells+0x140>
mov    %ebp,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [19 x i8] c"Void is now = %f \0A\00"
@EOF = global i64 0
define i32 @valid_cells(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca [20 x i8]
%5 = alloca float
%6 = alloca float
%7 = alloca float
store i32* %0, i32** %2
store i32 0, i32* %3
br label %8
8: ; preds = %15, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 12
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32*, i32** %2
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%14 = call i64 @fscanf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %11
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %8
18: ; preds = %8
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%20 = call float @atof(i8* %19)
store float %20, float* %5
%21 = load float, float* %5
%22 = fpext float %21 to double
%23 = fadd double %22, 1.000000e-04
%24 = fptrunc double %23 to float
store float %24, float* %6
%25 = load float, float* %5
%26 = fpext float %25 to double
%27 = fsub double %26, 1.000000e-04
%28 = fptrunc double %27 to float
store float %28, float* %7
%29 = load float, float* %5
%30 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), float %29)
store i32 0, i32* %3
br label %31
31: ; preds = %50, %18
%32 = load i32*, i32** %2
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%34 = call i64 @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %33)
%35 = load i64, i64* @EOF
%36 = icmp ne i64 %34, %35
br i1 %36, label %37, label %51
37: ; preds = %31
%38 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%39 = call float @atof(i8* %38)
%40 = load float, float* %6
%41 = fcmp ogt float %39, %40
br i1 %41, label %47, label %42
42: ; preds = %37
%43 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%44 = call float @atof(i8* %43)
%45 = load float, float* %7
%46 = fcmp olt float %44, %45
br i1 %46, label %47, label %50
47: ; preds = %42, %37
%48 = load i32, i32* %3
%49 = add nsw i32 %48, 1
store i32 %49, i32* %3
br label %50
50: ; preds = %47, %42
br label %31
51: ; preds = %31
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [19 x i8] c"Void is now = %f \0A\00"
@EOF = global i64 0
define i32 @valid_cells(i32* nocapture %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%7 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%8 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%9 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%10 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%11 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%12 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%13 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%14 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%15 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%16 = call float @atof(i8* %3)
%17 = fpext float %16 to double
%18 = fadd double %17, 1.000000e-04
%19 = fptrunc double %18 to float
%20 = fadd double %17, -1.000000e-04
%21 = fptrunc double %20 to float
%22 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), float %16)
%23 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%24 = load i64, i64* @EOF
%25 = icmp eq i64 %23, %24
br i1 %25, label %37, label %26
26: ; preds = %1, %26
%27 = phi i32 [ %33, %26 ], [ 0, %1 ]
%28 = call float @atof(i8* %3)
%29 = fcmp ogt float %28, %19
%30 = fcmp olt float %28, %21
%31 = or i1 %29, %30
%32 = zext i1 %31 to i32
%33 = add nuw nsw i32 %27, %32
%34 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%35 = load i64, i64* @EOF
%36 = icmp eq i64 %34, %35
br i1 %36, label %37, label %26
37: ; preds = %26, %1
%38 = phi i32 [ 0, %1 ], [ %33, %26 ]
ret i32 %38
}