#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 */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int scanf(char *, float *, float *, char *);
int /*<<< orphan*/ stderr;
int geo2json() {
  float latitude;
  float longitue;
  char info[80];
  int started = 0;
  puts("data=[");
  while (scanf("%f,%f,%79[^\n]", &latitude, &longitue, info) == 3) {
    if (started)
      printf(",\n");
    else
      started = 1;
    if ((latitude < -90.0) || (latitude > 90.0)) {
      fprintf(stderr, "Invalid latitude: %f\n", latitude);
      return 2;
    }
    if (longitue < -180.0 || longitue > 180.0) {
      fprintf(stderr, "Invalid longitude: %f\n", longitue);
      return 2;
    }
    printf("{latitude: %f, longitud: %f, info: '%s'}", latitude, longitue,
           info);
  }
  puts("\n]");
  return 0;
}


x86 assembly (clang, -O0):
<geo2json>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x64(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    -0x60(%rbp),%rcx
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1060 <scanf@plt>
cmp    $0x3,%eax
jne    1281 <geo2json+0x141>
cmpl   $0x0,-0x64(%rbp)
je     1199 <geo2json+0x59>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a0 <geo2json+0x60>
movl   $0x1,-0x64(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe4f(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     11d6 <geo2json+0x96>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe3c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11fc <geo2json+0xbc>
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
movss  -0x8(%rbp),%xmm0
lea    0xe4d(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1294 <geo2json+0x154>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe03(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1232 <geo2json+0xf2>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1258 <geo2json+0x118>
mov    0x2da7(%rip),%rax
mov    (%rax),%edi
movss  -0xc(%rbp),%xmm0
lea    0xe07(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1294 <geo2json+0x154>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    -0x60(%rbp),%rsi
lea    0xdf0(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
jmp    115b <geo2json+0x1b>
lea    0xdaa(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geo2json>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0xebb(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1060 <scanf@plt>
cmp    $0x3,%eax
jne    124d <geo2json+0x10d>
movss  0x8(%rsp),%xmm0
movss  0xe74(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     123b <geo2json+0xfb>
ucomiss 0xe68(%rip),%xmm0
ja     123b <geo2json+0xfb>
lea    0xea9(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xe62(%rip),%r15
lea    0x8(%rsp),%r12
lea    0xc(%rsp),%r13
lea    0xeb5(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm1
movss  0xe2a(%rip),%xmm2
ucomiss %xmm1,%xmm2
ja     125d <geo2json+0x11d>
ucomiss 0xe22(%rip),%xmm1
ja     125d <geo2json+0x11d>
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x2,%al
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbx,%rcx
call   1060 <scanf@plt>
cmp    $0x3,%eax
jne    124d <geo2json+0x10d>
mov    %rbp,%rdi
call   1030 <puts@plt>
movss  0x8(%rsp),%xmm0
movss  0xdd3(%rip),%xmm1
ucomiss %xmm0,%xmm1
ja     123b <geo2json+0xfb>
ucomiss 0xdcb(%rip),%xmm0
jbe    11d0 <geo2json+0x90>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
lea    0xdda(%rip),%rsi
jmp    1270 <geo2json+0x130>
lea    0xdce(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    127a <geo2json+0x13a>
mov    0x2d7c(%rip),%rax
mov    (%rax),%edi
lea    0xdce(%rip),%rsi
movaps %xmm1,%xmm0
call   1050 <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 = [7 x i8] c"data=[\00"
@.str.1 = [14 x i8] c"%f,%f,%79[^\0A]\00"
@.str.2 = [3 x i8] c",\0A\00"
@stderr = global i32 0
@.str.3 = [22 x i8] c"Invalid latitude: %f\0A\00"
@.str.4 = [23 x i8] c"Invalid longitude: %f\0A\00"
@.str.5 = [41 x i8] c"{latitude: %f, longitud: %f, info: '%s'}\00"
@.str.6 = [3 x i8] c"\0A]\00"
define i32 @geo2json() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca [80 x i8]
%5 = alloca i32
store i32 0, i32* %5
%6 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %41, %0
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %3, i8* %8)
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %48
11: ; preds = %7
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %17
16: ; preds = %11
store i32 1, i32* %5
br label %17
17: ; preds = %16, %14
%18 = load float, float* %2
%19 = fpext float %18 to double
%20 = fcmp olt double %19, -9.000000e+01
br i1 %20, label %25, label %21
21: ; preds = %17
%22 = load float, float* %2
%23 = fpext float %22 to double
%24 = fcmp ogt double %23, 9.000000e+01
br i1 %24, label %25, label %29
25: ; preds = %21, %17
%26 = load i32, i32* @stderr
%27 = load float, float* %2
%28 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), float %27)
store i32 2, i32* %1
br label %50
29: ; preds = %21
%30 = load float, float* %3
%31 = fpext float %30 to double
%32 = fcmp olt double %31, -1.800000e+02
br i1 %32, label %37, label %33
33: ; preds = %29
%34 = load float, float* %3
%35 = fpext float %34 to double
%36 = fcmp ogt double %35, 1.800000e+02
br i1 %36, label %37, label %41
37: ; preds = %33, %29
%38 = load i32, i32* @stderr
%39 = load float, float* %3
%40 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), float %39)
store i32 2, i32* %1
br label %50
41: ; preds = %33
%42 = load float, float* %2
%43 = fpext float %42 to double
%44 = load float, float* %3
%45 = fpext float %44 to double
%46 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), double %43, double %45, i8* %46)
br label %7
48: ; preds = %7
%49 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %1
br label %50
50: ; preds = %48, %37, %25
%51 = load i32, i32* %1
ret i32 %51
}

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