#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 */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, float);
int fscanf(int /*<<< orphan*/ *, char *, float *, float *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
int main() {
  float latitude;
  float longitude;
  char info[80];
  int started = 0;
  FILE *in = fopen("data.txt", "r");
  puts("data = [");
  while (fscanf(in, "%f, %f, %79[^\n]", &latitude, &longitude, info) == 3) {
    if (started)
      printf(",\n");
    else
      started = 1;
    if ((latitude < -90) || (latitude > 90)) {
      fprintf(stderr, "Invalid latitude: %f\n", latitude);
      return 2;
    }
    if ((longitude < -180) || (longitude > 180)) {
      fprintf(stderr, "Invalid longitude: %f\n", longitude);
      return 2;
    }
    printf("{latitude: %f, longitude: %f, info: '%s'}", latitude, longitude,
           info);
  }
  puts("\n]");
  fclose(in);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x64(%rbp)
lea    0xe93(%rip),%rdi
lea    0xe95(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x70(%rbp)
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
mov    -0x70(%rbp),%rdi
lea    -0x60(%rbp),%r8
lea    0xe7c(%rip),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1060 <fscanf@plt>
cmp    $0x3,%eax
jne    12a7 <main+0x147>
cmpl   $0x0,-0x64(%rbp)
je     11db <main+0x7b>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11e2 <main+0x82>
movl   $0x1,-0x64(%rbp)
movss  0xe16(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
ja     120a <main+0xaa>
movss  -0x8(%rbp),%xmm0
movss  0xe03(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1230 <main+0xd0>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
movss  -0x8(%rbp),%xmm0
lea    0xe18(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    12c3 <main+0x163>
movss  0xdd0(%rip),%xmm0
ucomiss -0xc(%rbp),%xmm0
ja     1258 <main+0xf8>
movss  -0xc(%rbp),%xmm0
movss  0xdbd(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    127e <main+0x11e>
mov    0x2d81(%rip),%rax
mov    (%rax),%edi
movss  -0xc(%rbp),%xmm0
lea    0xde0(%rip),%rsi
call   1070 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    12c3 <main+0x163>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    -0x60(%rbp),%rsi
lea    0xdc9(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
jmp    1199 <main+0x39>
lea    0xd83(%rip),%rdi
call   1030 <puts@plt>
mov    -0x70(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xe9b(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8d(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    %rbx,%rdi
call   1060 <fscanf@plt>
cmp    $0x3,%eax
jne    128c <main+0x12c>
movss  0x8(%rsp),%xmm0
movss  0xe3b(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     127a <main+0x11a>
ucomiss 0xe2f(%rip),%xmm0
ja     127a <main+0x11a>
lea    0x10(%rsp),%r15
lea    0xe3d(%rip),%r12
lea    0x8(%rsp),%r13
lea    0xc(%rsp),%rbp
lea    0xe93(%rip),%r14
nopl   0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm1
movss  0xdfa(%rip),%xmm2
ucomiss %xmm1,%xmm2
ja     12a4 <main+0x144>
ucomiss 0xdee(%rip),%xmm1
ja     12a4 <main+0x144>
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
lea    0xe2e(%rip),%rdi
mov    %r15,%rsi
mov    $0x2,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
mov    %r15,%r8
call   1060 <fscanf@plt>
cmp    $0x3,%eax
jne    128c <main+0x12c>
mov    %r14,%rdi
call   1030 <puts@plt>
movss  0x8(%rsp),%xmm0
movss  0xd94(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     127a <main+0x11a>
ucomiss 0xd8c(%rip),%xmm0
jbe    1200 <main+0xa0>
mov    0x2d5f(%rip),%rax
mov    (%rax),%edi
lea    0xdaa(%rip),%rsi
jmp    12b7 <main+0x157>
lea    0xd9e(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    12c1 <main+0x161>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
lea    0xd96(%rip),%rsi
movaps %xmm1,%xmm0
call   1070 <fprintf@plt>
mov    $0x2,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"data.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"data = [\00"
@.str.3 = [16 x i8] c"%f, %f, %79[^\0A]\00"
@.str.4 = [3 x i8] c",\0A\00"
@stderr = global i32 0
@.str.5 = [22 x i8] c"Invalid latitude: %f\0A\00"
@.str.6 = [23 x i8] c"Invalid longitude: %f\0A\00"
@.str.7 = [42 x i8] c"{latitude: %f, longitude: %f, info: '%s'}\00"
@.str.8 = [3 x i8] c"\0A]\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca [80 x i8]
%5 = alloca i32
%6 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %5
%7 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %6
%8 = call i32 @puts(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %9
9: ; preds = %40, %0
%10 = load i32*, i32** %6
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%12 = call i32 @fscanf(i32* %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), float* %2, float* %3, i8* %11)
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %47
14: ; preds = %9
%15 = load i32, i32* %5
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %20
19: ; preds = %14
store i32 1, i32* %5
br label %20
20: ; preds = %19, %17
%21 = load float, float* %2
%22 = fcmp olt float %21, -9.000000e+01
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load float, float* %2
%25 = fcmp ogt float %24, 9.000000e+01
br i1 %25, label %26, label %30
26: ; preds = %23, %20
%27 = load i32, i32* @stderr
%28 = load float, float* %2
%29 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), float %28)
store i32 2, i32* %1
br label %51
30: ; preds = %23
%31 = load float, float* %3
%32 = fcmp olt float %31, -1.800000e+02
br i1 %32, label %36, label %33
33: ; preds = %30
%34 = load float, float* %3
%35 = fcmp ogt float %34, 1.800000e+02
br i1 %35, label %36, label %40
36: ; preds = %33, %30
%37 = load i32, i32* @stderr
%38 = load float, float* %3
%39 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), float %38)
store i32 2, i32* %1
br label %51
40: ; preds = %33
%41 = load float, float* %2
%42 = fpext float %41 to double
%43 = load float, float* %3
%44 = fpext float %43 to double
%45 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), double %42, double %44, i8* %45)
br label %9
47: ; preds = %9
%48 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%49 = load i32*, i32** %6
%50 = call i32 @fclose(i32* %49)
store i32 0, i32* %1
br label %51
51: ; preds = %47, %36, %26
%52 = load i32, i32* %1
ret i32 %52
}

LLVM IR (-O2):
@.str = [9 x i8] c"data.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"data = [\00"
@.str.3 = [16 x i8] c"%f, %f, %79[^\0A]\00"
@stderr = global i32 0
@.str.5 = [22 x i8] c"Invalid latitude: %f\0A\00"
@.str.6 = [23 x i8] c"Invalid longitude: %f\0A\00"
@.str.7 = [42 x i8] c"{latitude: %f, longitude: %f, info: '%s'}\00"
@.str.8 = [3 x i8] c"\0A]\00"
@str = [2 x i8] c",\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca [80 x i8]
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%7 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), float* %1, float* %2, i8* %6)
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %41
11: ; preds = %0
%12 = load float, float* %1
%13 = fcmp olt float %12, -9.000000e+01
%14 = fcmp ogt float %12, 9.000000e+01
%15 = or i1 %13, %14
br i1 %15, label %22, label %26
16: ; preds = %35
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%18 = load float, float* %1
%19 = fcmp olt float %18, -9.000000e+01
%20 = fcmp ogt float %18, 9.000000e+01
%21 = or i1 %19, %20
br i1 %21, label %22, label %26
22: ; preds = %16, %11
%23 = phi float [ %12, %11 ], [ %18, %16 ]
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), float %23)
br label %44
26: ; preds = %11, %16
%27 = phi float [ %18, %16 ], [ %12, %11 ]
%28 = load float, float* %2
%29 = fcmp olt float %28, -1.800000e+02
%30 = fcmp ogt float %28, 1.800000e+02
%31 = or i1 %29, %30
br i1 %31, label %32, label %35
32: ; preds = %26
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), float %28)
br label %44
35: ; preds = %26
%36 = fpext float %27 to double
%37 = fpext float %28 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), double %36, double %37, i8* %6)
%39 = call i32 @fscanf(i32* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), float* %1, float* %2, i8* %6)
%40 = icmp eq i32 %39, 3
br i1 %40, label %16, label %41
41: ; preds = %35, %0
%42 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%43 = call i32 @fclose(i32* %7)
br label %44
44: ; preds = %41, %32, %22
%45 = phi i32 [ 2, %22 ], [ 2, %32 ], [ 0, %41 ]
ret i32 %45
}