#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 *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char **);
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ sscanf(char *, char *, char **, float *);
int valid_cells(FILE *pp) {
  int cnt;
  char s1[80];
  char cdum[80];
  float void_nr, up, down;
  for (cnt = 0; cnt < 6; cnt++)
    fgets(s1, 80, pp);
  sscanf(s1, "%s %f", &cdum, &void_nr);
  up = void_nr + 0.0001;
  down = void_nr - 0.0001;
  printf("Void is now = %.0f\n", void_nr);
  cnt = 0;
  while (fscanf(pp, "%s", &s1) != EOF) {
    if (atof(s1) > up || atof(s1) < down)
      cnt++;
  }
  rewind(pp);
  return cnt;
}


x86 assembly (clang, -O0):
<valid_cells>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jge    11a0 <valid_cells+0x40>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x50,%esi
call   1070 <fgets@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <valid_cells+0x16>
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    0xe56(%rip),%rsi
lea    -0xb4(%rbp),%rcx
call   1080 <sscanf@plt>
movss  -0xb4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xe2e(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xb8(%rbp)
ff
movss  -0xb4(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movsd  0xe0a(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xbc(%rbp)
ff
movss  -0xb4(%rbp),%xmm0
ff
lea    0xdf9(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rdx
lea    0xdf2(%rip),%rsi
call   1060 <fscanf@plt>
mov    0x2dac(%rip),%rcx
cmp    (%rcx),%rax
je     1286 <valid_cells+0x126>
lea    -0x60(%rbp),%rdi
call   1030 <atof@plt>
ucomiss -0xb8(%rbp),%xmm0
ja     1278 <valid_cells+0x118>
lea    -0x60(%rbp),%rdi
call   1030 <atof@plt>
movaps %xmm0,%xmm1
movss  -0xbc(%rbp),%xmm0
ff
ucomiss %xmm1,%xmm0
jbe    1281 <valid_cells+0x121>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1221 <valid_cells+0xc1>
mov    -0x8(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0xc(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_cells>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xb0,%rsp
mov    %rdi,%r15
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %r14,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %r14,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %r14,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %r14,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
mov    %r14,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
lea    0xe32(%rip),%rsi
lea    0x60(%rsp),%rdx
lea    0xc(%rsp),%rcx
mov    %r14,%rdi
call   1080 <sscanf@plt>
movss  0xc(%rsp),%xmm0
lea    0xe19(%rip),%rdi
movss  %xmm0,0x4(%rsp)
call   1040 <printf@plt>
lea    0xe1b(%rip),%rsi
mov    %r15,%rdi
mov    %r14,%rdx
call   1060 <fscanf@plt>
mov    0x2dc7(%rip),%r12
xor    %ebp,%ebp
cmp    (%r12),%rax
je     12a7 <valid_cells+0x147>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdc5(%rip),%xmm1
addsd  %xmm0,%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x4(%rsp)
addsd  0xdb7(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
xor    %ebp,%ebp
lea    0x10(%rsp),%rbx
lea    0xdc1(%rip),%r14
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <atof@plt>
ucomiss 0x4(%rsp),%xmm0
seta   %al
movss  0x8(%rsp),%xmm1
ucomiss %xmm0,%xmm1
seta   %cl
or     %al,%cl
movzbl %cl,%eax
add    %eax,%ebp
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1060 <fscanf@plt>
cmp    (%r12),%rax
jne    1270 <valid_cells+0x110>
mov    %r15,%rdi
call   1050 <rewind@plt>
mov    %ebp,%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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