#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__ IsReal(char *);
double atof(char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
char *strtok(char *, char *);
int get_real(FILE *fp, double *ret_real) {
  static int in_comment = 0;
  static FILE *internalfp = NULL;
  static char *lineptr = NULL;
  static char stripbuffer[512];
  char buffer[512];
  char *sptr;
  char *stripptr;
  if (fp != NULL) {
    internalfp = fp;
    lineptr = NULL;
  }
  while (1) {
    if (lineptr == NULL) {
      if (fgets(buffer, 512, internalfp) == NULL)
        return 0;
      stripptr = stripbuffer;
      for (sptr = buffer; *sptr; sptr++) {
        if (in_comment) {
          if (*sptr == '*' && *(sptr + 1) == '/') {
            in_comment = 0;
            sptr++;
          }
        } else {
          if (*sptr == '/' && *(sptr + 1) == '*') {
            in_comment = 1;
            sptr++;
          } else {
            *stripptr = *sptr;
            stripptr++;
          }
        }
      }
      *stripptr = '\0';
      lineptr = strtok(stripbuffer, " \t\n");
    }
    while (lineptr != NULL) {
      if (IsReal(lineptr)) {
        *ret_real = atof(lineptr);
        lineptr = strtok(NULL, " \t\n");
        return 1;
      } else
        lineptr = strtok(NULL, " \t\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<get_real>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1174 <get_real+0x34>
mov    -0x10(%rbp),%rax
mov    %rax,0x2eef(%rip)
movq   $0x0,0x2eec(%rip)
jmp    1179 <get_real+0x39>
cmpq   $0x0,0x2edf(%rip)
jne    12e7 <get_real+0x1a7>
lea    -0x220(%rbp),%rdi
mov    0x2ec3(%rip),%rdx
mov    $0x200,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
jne    11b5 <get_real+0x75>
movl   $0x0,-0x4(%rbp)
jmp    1368 <get_real+0x228>
lea    0x2eb4(%rip),%rax
mov    %rax,-0x230(%rbp)
lea    -0x220(%rbp),%rax
mov    %rax,-0x228(%rbp)
mov    -0x228(%rbp),%rax
cmpb   $0x0,(%rax)
je     12c3 <get_real+0x183>
cmpl   $0x0,0x2e68(%rip)
je     1236 <get_real+0xf6>
mov    -0x228(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    1231 <get_real+0xf1>
mov    -0x228(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2f,%eax
jne    1231 <get_real+0xf1>
movl   $0x0,0x2e31(%rip)
mov    -0x228(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x228(%rbp)
jmp    12a7 <get_real+0x167>
mov    -0x228(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    127e <get_real+0x13e>
mov    -0x228(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2a,%eax
jne    127e <get_real+0x13e>
movl   $0x1,0x2de9(%rip)
mov    -0x228(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x228(%rbp)
jmp    12a2 <get_real+0x162>
mov    -0x228(%rbp),%rax
mov    (%rax),%cl
mov    -0x230(%rbp),%rax
mov    %cl,(%rax)
mov    -0x230(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x230(%rbp)
jmp    12a7 <get_real+0x167>
jmp    12ac <get_real+0x16c>
mov    -0x228(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x228(%rbp)
jmp    11d1 <get_real+0x91>
mov    -0x230(%rbp),%rax
movb   $0x0,(%rax)
lea    0x2d9c(%rip),%rdi
lea    0xd25(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,0x2d79(%rip)
jmp    12ec <get_real+0x1ac>
cmpq   $0x0,0x2d6c(%rip)
je     1363 <get_real+0x223>
mov    0x2d5f(%rip),%rdi
call   1060 <IsReal@plt>
cmp    $0x0,%rax
je     1347 <get_real+0x207>
mov    0x2d49(%rip),%rdi
call   1030 <atof@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
mov    %eax,%edi
lea    0xcd1(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,0x2d25(%rip)
movl   $0x1,-0x4(%rbp)
jmp    1368 <get_real+0x228>
xor    %eax,%eax
mov    %eax,%edi
lea    0xcae(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,0x2d02(%rip)
jmp    12ec <get_real+0x1ac>
jmp    1179 <get_real+0x39>
mov    -0x4(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_real>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200,%rsp
mov    %rsi,%r14
test   %rdi,%rdi
je     1173 <get_real+0x33>
mov    %rdi,0x2ef9(%rip)
movq   $0x0,0x2ef6(%rip)
xor    %eax,%eax
test   %rax,%rax
jne    117f <get_real+0x3f>
jmp    11b7 <get_real+0x77>
mov    0x2ee6(%rip),%rax
test   %rax,%rax
je     11b7 <get_real+0x77>
lea    0xe7a(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1060 <IsReal@plt>
test   %rax,%rax
jne    128d <get_real+0x14d>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <strtok@plt>
mov    %rax,0x2eae(%rip)
test   %rax,%rax
jne    1190 <get_real+0x50>
mov    %rsp,%r15
lea    0x2eaf(%rip),%r13
lea    0xe38(%rip),%r12
jmp    11ea <get_real+0xaa>
nopw   0x0(%rax,%rax,1)
movb   $0x0,(%rax)
mov    %r13,%rdi
mov    %r12,%rsi
call   1050 <strtok@plt>
mov    %rax,0x2e7b(%rip)
test   %rax,%rax
jne    117f <get_real+0x3f>
mov    0x2e67(%rip),%rdx
mov    %r15,%rdi
mov    $0x200,%esi
call   1040 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     12b8 <get_real+0x178>
mov    (%rsp),%bl
mov    %r13,%rax
test   %bl,%bl
je     11d0 <get_real+0x90>
mov    0x2e34(%rip),%dl
mov    %r13,%rax
mov    %r15,%rcx
jmp    1244 <get_real+0x104>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %bl,(%rax)
add    $0x1,%rax
xor    %edx,%edx
movzbl 0x1(%rcx),%ebx
add    $0x1,%rcx
test   %bl,%bl
je     11d0 <get_real+0x90>
test   $0x1,%dl
je     1270 <get_real+0x130>
mov    $0x1,%dl
cmp    $0x2a,%bl
jne    1238 <get_real+0xf8>
lea    0x1(%rcx),%rsi
cmpb   $0x2f,0x1(%rcx)
jne    1238 <get_real+0xf8>
movb   $0x0,0x2def(%rip)
xor    %edx,%edx
mov    %rsi,%rcx
jmp    1238 <get_real+0xf8>
nopl   0x0(%rax,%rax,1)
cmp    $0x2f,%bl
jne    1230 <get_real+0xf0>
lea    0x1(%rcx),%rsi
cmpb   $0x2a,0x1(%rcx)
jne    1230 <get_real+0xf0>
movb   $0x1,0x2dca(%rip)
mov    $0x1,%dl
mov    %rsi,%rcx
jmp    1238 <get_real+0xf8>
mov    0x2dcc(%rip),%rdi
call   1030 <atof@plt>
movsd  %xmm0,(%r14)
lea    0xd5b(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
mov    %rax,0x2dad(%rip)
mov    $0x1,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@get_real.in_comment = internal global i32 0
@get_real.internalfp = internal global i32* null
@get_real.lineptr = internal global i8* null
@get_real.stripbuffer = internal global [512 x i8] zeroinitializer
@.str = [4 x i8] c" \09\0A\00"
define i32 @get_real(i32* %0, double* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca double*
%6 = alloca [512 x i8]
%7 = alloca i8*
%8 = alloca i8*
store i32* %0, i32** %4
store double* %1, double** %5
%9 = load i32*, i32** %4
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32*, i32** %4
store i32* %12, i32** @get_real.internalfp
store i8* null, i8** @get_real.lineptr
br label %13
13: ; preds = %11, %2
br label %14
14: ; preds = %13, %91
%15 = load i8*, i8** @get_real.lineptr
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %75
17: ; preds = %14
%18 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%19 = load i32*, i32** @get_real.internalfp
%20 = call i32* @fgets(i8* %18, i32 512, i32* %19)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %23
22: ; preds = %17
store i32 0, i32* %3
br label %92
23: ; preds = %17
store i8* getelementptr inbounds ([512 x i8], [512 x i8]* @get_real.stripbuffer, i64 0, i64 0), i8** %8
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
store i8* %24, i8** %7
br label %25
25: ; preds = %69, %23
%26 = load i8*, i8** %7
%27 = load i8, i8* %26
%28 = icmp ne i8 %27, 0
br i1 %28, label %29, label %72
29: ; preds = %25
%30 = load i32, i32* @get_real.in_comment
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %47
32: ; preds = %29
%33 = load i8*, i8** %7
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 42
br i1 %36, label %37, label %46
37: ; preds = %32
%38 = load i8*, i8** %7
%39 = getelementptr inbounds i8, i8* %38, i64 1
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 47
br i1 %42, label %43, label %46
43: ; preds = %37
store i32 0, i32* @get_real.in_comment
%44 = load i8*, i8** %7
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %7
br label %46
46: ; preds = %43, %37, %32
br label %68
47: ; preds = %29
%48 = load i8*, i8** %7
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 47
br i1 %51, label %52, label %61
52: ; preds = %47
%53 = load i8*, i8** %7
%54 = getelementptr inbounds i8, i8* %53, i64 1
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 42
br i1 %57, label %58, label %61
58: ; preds = %52
store i32 1, i32* @get_real.in_comment
%59 = load i8*, i8** %7
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %7
br label %67
61: ; preds = %52, %47
%62 = load i8*, i8** %7
%63 = load i8, i8* %62
%64 = load i8*, i8** %8
store i8 %63, i8* %64
%65 = load i8*, i8** %8
%66 = getelementptr inbounds i8, i8* %65, i32 1
store i8* %66, i8** %8
br label %67
67: ; preds = %61, %58
br label %68
68: ; preds = %67, %46
br label %69
69: ; preds = %68
%70 = load i8*, i8** %7
%71 = getelementptr inbounds i8, i8* %70, i32 1
store i8* %71, i8** %7
br label %25
72: ; preds = %25
%73 = load i8*, i8** %8
store i8 0, i8* %73
%74 = call i8* @strtok(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @get_real.stripbuffer, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %74, i8** @get_real.lineptr
br label %75
75: ; preds = %72, %14
br label %76
76: ; preds = %90, %75
%77 = load i8*, i8** @get_real.lineptr
%78 = icmp ne i8* %77, null
br i1 %78, label %79, label %91
79: ; preds = %76
%80 = load i8*, i8** @get_real.lineptr
%81 = call i64 @IsReal(i8* %80)
%82 = icmp ne i64 %81, 0
br i1 %82, label %83, label %88
83: ; preds = %79
%84 = load i8*, i8** @get_real.lineptr
%85 = call double @atof(i8* %84)
%86 = load double*, double** %5
store double %85, double* %86
%87 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %87, i8** @get_real.lineptr
store i32 1, i32* %3
br label %92
88: ; preds = %79
%89 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %89, i8** @get_real.lineptr
br label %90
90: ; preds = %88
br label %76
91: ; preds = %76
br label %14
92: ; preds = %83, %22
%93 = load i32, i32* %3
ret i32 %93
}

LLVM IR (-O2):
@get_real.in_comment = internal unnamed_addr global i1 false
@get_real.internalfp = internal unnamed_addr global i32* null
@get_real.lineptr = internal unnamed_addr global i8* null
@get_real.stripbuffer = internal global [512 x i8] zeroinitializer
@.str = [4 x i8] c" \09\0A\00"
define i32 @get_real(i32* %0, double* nocapture writeonly %1) {
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32* %0, null
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = load i8*, i8** @get_real.lineptr
br label %9
8: ; preds = %2
store i32* %0, i32** @get_real.internalfp
store i8* null, i8** @get_real.lineptr
br label %9
9: ; preds = %6, %8
%10 = phi i8* [ %7, %6 ], [ null, %8 ]
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %54
12: ; preds = %64, %9
br label %13
13: ; preds = %12, %50
%14 = load i32*, i32** @get_real.internalfp
%15 = call i32* @fgets(i8* %4, i32 512, i32* %14)
%16 = icmp eq i32* %15, null
br i1 %16, label %67, label %17
17: ; preds = %13
%18 = load i8, i8* %4
%19 = icmp eq i8 %18, 0
br i1 %19, label %50, label %20
20: ; preds = %17
%21 = load i1, i1* @get_real.in_comment
br label %22
22: ; preds = %20, %43
%23 = phi i8 [ %48, %43 ], [ %18, %20 ]
%24 = phi i8* [ %46, %43 ], [ getelementptr inbounds ([512 x i8], [512 x i8]* @get_real.stripbuffer, i64 0, i64 0), %20 ]
%25 = phi i8* [ %47, %43 ], [ %4, %20 ]
%26 = phi i1 [ %44, %43 ], [ %21, %20 ]
br i1 %26, label %27, label %34
27: ; preds = %22
%28 = icmp eq i8 %23, 42
br i1 %28, label %29, label %43
29: ; preds = %27
%30 = getelementptr inbounds i8, i8* %25, i64 1
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 47
br i1 %32, label %33, label %43
33: ; preds = %29
store i1 false, i1* @get_real.in_comment
br label %43
34: ; preds = %22
%35 = icmp eq i8 %23, 47
br i1 %35, label %36, label %41
36: ; preds = %34
%37 = getelementptr inbounds i8, i8* %25, i64 1
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 42
br i1 %39, label %40, label %41
40: ; preds = %36
store i1 true, i1* @get_real.in_comment
br label %43
41: ; preds = %36, %34
store i8 %23, i8* %24
%42 = getelementptr inbounds i8, i8* %24, i64 1
br label %43
43: ; preds = %33, %29, %27, %41, %40
%44 = phi i1 [ false, %33 ], [ true, %29 ], [ true, %27 ], [ true, %40 ], [ false, %41 ]
%45 = phi i8* [ %30, %33 ], [ %25, %29 ], [ %25, %27 ], [ %37, %40 ], [ %25, %41 ]
%46 = phi i8* [ %24, %33 ], [ %24, %29 ], [ %24, %27 ], [ %24, %40 ], [ %42, %41 ]
%47 = getelementptr inbounds i8, i8* %45, i64 1
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 0
br i1 %49, label %50, label %22
50: ; preds = %43, %17
%51 = phi i8* [ getelementptr inbounds ([512 x i8], [512 x i8]* @get_real.stripbuffer, i64 0, i64 0), %17 ], [ %46, %43 ]
store i8 0, i8* %51
%52 = call i8* @strtok(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @get_real.stripbuffer, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %52, i8** @get_real.lineptr
%53 = icmp eq i8* %52, null
br i1 %53, label %13, label %54
54: ; preds = %50, %9
%55 = phi i8* [ %10, %9 ], [ %52, %50 ]
br label %56
56: ; preds = %54, %64
%57 = phi i8* [ %65, %64 ], [ %55, %54 ]
%58 = call i64 @IsReal(i8* %57)
%59 = icmp eq i64 %58, 0
br i1 %59, label %64, label %60
60: ; preds = %56
%61 = load i8*, i8** @get_real.lineptr
%62 = call double @atof(i8* %61)
store double %62, double* %1
%63 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %63, i8** @get_real.lineptr
br label %67
64: ; preds = %56
%65 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %65, i8** @get_real.lineptr
%66 = icmp eq i8* %65, null
br i1 %66, label %12, label %56
67: ; preds = %13, %60
%68 = phi i32 [ 1, %60 ], [ 0, %13 ]
ret i32 %68
}