#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 */
double M_PI;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ isdigit(char);
int /*<<< orphan*/ stderr;
int get_lambda0(char grid_zone[4], double *lambda0) {
  unsigned int zone_long;
  unsigned char zone_lat;
  if (!isdigit(grid_zone[0]) || !isdigit(grid_zone[1])) {
    fprintf(stderr, "Invalid grid zone format: [%s]\n", grid_zone);
    return (-1);
  }
  zone_long = (grid_zone[0] - '0') * 10 + (grid_zone[1] - '0');
  zone_lat = grid_zone[2];
  switch (zone_lat) {
  case 'A':
  case 'B':
  case 'Y':
  case 'Z':
    *lambda0 = 0;
    return (0);
    break;
  case 'V':
    switch (zone_long) {
    case 31:
      *lambda0 = 1.5 * M_PI / 180.0;
      return (0);
      break;
    case 32:
      *lambda0 = 7.5 * M_PI / 180.0;
      return (0);
      break;
      break;
    }
  case 'X':
    switch (zone_long) {
    case 31:
      *lambda0 = 4.5 * M_PI / 180.0;
      return (0);
      break;
    case 33:
      *lambda0 = 15 * M_PI / 180.0;
      return (0);
      break;
    case 35:
      *lambda0 = 27 * M_PI / 180.0;
      return (0);
      break;
    case 37:
      *lambda0 = 37.5 * M_PI / 180.0;
      return (0);
      break;
    case 32:
    case 34:
    case 36:
      fprintf(stderr, "Zone %02d%c does not exist!\n", zone_long, zone_lat);
      return (-1);
      break;
    }
    break;
  }
  *lambda0 = ((zone_long - 1) * 6.0 + (-180.0) + 3.0) * M_PI / 180.0;
  return (0);
}


x86 assembly (clang, -O0):
<get_lambda0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
je     115b <get_lambda0+0x3b>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1182 <get_lambda0+0x62>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xefd(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1418 <get_lambda0+0x2f8>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
movsbl 0x1(%rax),%ecx
mov    %ecx,%eax
mov    %edx,%ecx
lea    -0x210(%rax,%rcx,2),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x1d(%rbp)
movzbl -0x1d(%rbp),%eax
mov    %eax,-0x24(%rbp)
add    $0xffffffbf,%eax
sub    $0x2,%eax
jb     11f8 <get_lambda0+0xd8>
jmp    11c2 <get_lambda0+0xa2>
mov    -0x24(%rbp),%eax
sub    $0x56,%eax
je     120f <get_lambda0+0xef>
jmp    11d3 <get_lambda0+0xb3>
mov    -0x24(%rbp),%eax
sub    $0x58,%eax
je     129f <get_lambda0+0x17f>
jmp    11e4 <get_lambda0+0xc4>
mov    -0x24(%rbp),%eax
add    $0xffffffa7,%eax
sub    $0x1,%eax
ja     13c3 <get_lambda0+0x2a3>
jmp    11f8 <get_lambda0+0xd8>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1418 <get_lambda0+0x2f8>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x1f,%eax
je     1234 <get_lambda0+0x114>
jmp    1223 <get_lambda0+0x103>
mov    -0x28(%rbp),%eax
sub    $0x20,%eax
je     1267 <get_lambda0+0x147>
jmp    129a <get_lambda0+0x17a>
movsd  0xdd4(%rip),%xmm0
mov    0x2da5(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xdb1(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1418 <get_lambda0+0x2f8>
movsd  0xd99(%rip),%xmm0
mov    0x2d72(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xd7e(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1418 <get_lambda0+0x2f8>
jmp    129f <get_lambda0+0x17f>
mov    -0x1c(%rbp),%eax
add    $0xffffffe1,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x6,%eax
ja     13be <get_lambda0+0x29e>
mov    -0x30(%rbp),%rax
lea    0xd91(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xd60(%rip),%xmm0
mov    0x2d11(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xd1d(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1418 <get_lambda0+0x2f8>
movsd  0xd25(%rip),%xmm0
mov    0x2cde(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xcea(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1418 <get_lambda0+0x2f8>
movsd  0xcea(%rip),%xmm0
mov    0x2cab(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xcb7(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1418 <get_lambda0+0x2f8>
movsd  0xcaf(%rip),%xmm0
mov    0x2c78(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xc84(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1418 <get_lambda0+0x2f8>
mov    0x2c3d(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
movzbl -0x1d(%rbp),%ecx
lea    0xce1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1418 <get_lambda0+0x2f8>
jmp    13c3 <get_lambda0+0x2a3>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
cvtsi2sd %rax,%xmm0
movsd  0xc6a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc66(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xc4a(%rip),%xmm1
addsd  %xmm1,%xmm0
mov    0x2bef(%rip),%rax
mulsd  (%rax),%xmm0
movsd  0xbfb(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_lambda0>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     117c <get_lambda0+0x5c>
movsbl 0x1(%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     117c <get_lambda0+0x5c>
movsbl (%rbx),%eax
lea    (%rax,%rax,4),%eax
movsbl 0x1(%rbx),%edx
lea    (%rdx,%rax,2),%esi
movzbl 0x2(%rbx),%ecx
lea    -0x41(%rcx),%edi
cmp    $0x19,%dil
ja     121e <get_lambda0+0xfe>
movzbl %dil,%edi
mov    $0x3000003,%ebx
bt     %rdi,%rbx
jae    11a0 <get_lambda0+0x80>
movq   $0x0,(%r14)
jmp    1259 <get_lambda0+0x139>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
lea    0xefc(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    125b <get_lambda0+0x13b>
cmp    $0x15,%rdi
je     11dc <get_lambda0+0xbc>
cmp    $0x17,%rdi
jne    121e <get_lambda0+0xfe>
lea    -0x22f(%rsi),%edi
cmp    $0x6,%edi
ja     121e <get_lambda0+0xfe>
lea    0xe92(%rip),%rsi
movslq (%rsi,%rdi,4),%rdi
add    %rsi,%rdi
jmp    *%rdi
mov    0x2e1a(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xe26(%rip),%xmm0
jmp    124c <get_lambda0+0x12c>
lea    -0x22f(%rsi),%edi
cmp    $0x6,%edi
ja     121e <get_lambda0+0xfe>
lea    0xe7e(%rip),%rsi
movslq (%rsi,%rdi,4),%rdi
add    %rsi,%rdi
jmp    *%rdi
lea    (%rdx,%rax,2),%edx
add    $0xfffffdf0,%edx
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
lea    0xe98(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    125b <get_lambda0+0x13b>
add    $0xfffffdef,%esi
cvtsi2sd %rsi,%xmm0
mulsd  0xe07(%rip),%xmm0
addsd  0xe07(%rip),%xmm0
addsd  0xe07(%rip),%xmm0
mov    0x2da0(%rip),%rax
mulsd  (%rax),%xmm0
divsd  0xdb4(%rip),%xmm0
movsd  %xmm0,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2d7e(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xdaa(%rip),%xmm0
jmp    124c <get_lambda0+0x12c>
mov    0x2d69(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xd8d(%rip),%xmm0
jmp    124c <get_lambda0+0x12c>
mov    0x2d54(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xd70(%rip),%xmm0
jmp    124c <get_lambda0+0x12c>
mov    0x2d3f(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xd7b(%rip),%xmm0
jmp    124c <get_lambda0+0x12c>
mov    0x2d2a(%rip),%rax
movsd  (%rax),%xmm0
mulsd  0xd5e(%rip),%xmm0
jmp    124c <get_lambda0+0x12c>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Invalid grid zone format: [%s]\0A\00"
@M_PI = global double 0.000000e+00
@.str.1 = [29 x i8] c"Zone %02d%c does not exist!\0A\00"
define i32 @get_lambda0(i8* %0, double* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i32
%7 = alloca i8
store i8* %0, i8** %4
store double* %1, double** %5
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = call i32 @isdigit(i8 signext %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = call i32 @isdigit(i8 signext %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %13, %2
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %4
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %21)
store i32 -1, i32* %3
br label %95
23: ; preds = %13
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 0
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = sub nsw i32 %27, 48
%29 = mul nsw i32 %28, 10
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 48
%35 = add nsw i32 %29, %34
store i32 %35, i32* %6
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i64 2
%38 = load i8, i8* %37
store i8 %38, i8* %7
%39 = load i8, i8* %7
%40 = zext i8 %39 to i32
switch i32 %40, label %85 [
i32 65, label %41
i32 66, label %41
i32 89, label %41
i32 90, label %41
i32 86, label %43
i32 88, label %56
]
41: ; preds = %23, %23, %23, %23
%42 = load double*, double** %5
store double 0.000000e+00, double* %42
store i32 0, i32* %3
br label %95
43: ; preds = %23
%44 = load i32, i32* %6
switch i32 %44, label %55 [
i32 31, label %45
i32 32, label %50
]
45: ; preds = %43
%46 = load double, double* @M_PI
%47 = fmul double 1.500000e+00, %46
%48 = fdiv double %47, 1.800000e+02
%49 = load double*, double** %5
store double %48, double* %49
store i32 0, i32* %3
br label %95
50: ; preds = %43
%51 = load double, double* @M_PI
%52 = fmul double 7.500000e+00, %51
%53 = fdiv double %52, 1.800000e+02
%54 = load double*, double** %5
store double %53, double* %54
store i32 0, i32* %3
br label %95
55: ; preds = %43
br label %56
56: ; preds = %23, %55
%57 = load i32, i32* %6
switch i32 %57, label %84 [
i32 31, label %58
i32 33, label %63
i32 35, label %68
i32 37, label %73
i32 32, label %78
i32 34, label %78
i32 36, label %78
]
58: ; preds = %56
%59 = load double, double* @M_PI
%60 = fmul double 4.500000e+00, %59
%61 = fdiv double %60, 1.800000e+02
%62 = load double*, double** %5
store double %61, double* %62
store i32 0, i32* %3
br label %95
63: ; preds = %56
%64 = load double, double* @M_PI
%65 = fmul double 1.500000e+01, %64
%66 = fdiv double %65, 1.800000e+02
%67 = load double*, double** %5
store double %66, double* %67
store i32 0, i32* %3
br label %95
68: ; preds = %56
%69 = load double, double* @M_PI
%70 = fmul double 2.700000e+01, %69
%71 = fdiv double %70, 1.800000e+02
%72 = load double*, double** %5
store double %71, double* %72
store i32 0, i32* %3
br label %95
73: ; preds = %56
%74 = load double, double* @M_PI
%75 = fmul double 3.750000e+01, %74
%76 = fdiv double %75, 1.800000e+02
%77 = load double*, double** %5
store double %76, double* %77
store i32 0, i32* %3
br label %95
78: ; preds = %56, %56, %56
%79 = load i32, i32* @stderr
%80 = load i32, i32* %6
%81 = load i8, i8* %7
%82 = zext i8 %81 to i32
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %80, i32 %82)
store i32 -1, i32* %3
br label %95
84: ; preds = %56
br label %85
85: ; preds = %23, %84
%86 = load i32, i32* %6
%87 = sub i32 %86, 1
%88 = uitofp i32 %87 to double
%89 = call double @llvm.fmuladd.f64(double %88, double 6.000000e+00, double -1.800000e+02)
%90 = fadd double %89, 3.000000e+00
%91 = load double, double* @M_PI
%92 = fmul double %90, %91
%93 = fdiv double %92, 1.800000e+02
%94 = load double*, double** %5
store double %93, double* %94
store i32 0, i32* %3
br label %95
95: ; preds = %85, %78, %73, %68, %63, %58, %50, %45, %41, %19
%96 = load i32, i32* %3
ret i32 %96
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Invalid grid zone format: [%s]\0A\00"
@M_PI = global double 0.000000e+00
@.str.1 = [29 x i8] c"Zone %02d%c does not exist!\0A\00"
define i32 @get_lambda0(i8* %0, double* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = tail call i32 @isdigit(i8 signext %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = tail call i32 @isdigit(i8 signext %8)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6, %2
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %63
14: ; preds = %6
%15 = load i8, i8* %0
%16 = sext i8 %15 to i32
%17 = mul nsw i32 %16, 10
%18 = load i8, i8* %7
%19 = sext i8 %18 to i32
%20 = add nsw i32 %17, %19
%21 = add nsw i32 %20, -528
%22 = getelementptr inbounds i8, i8* %0, i64 2
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
switch i8 %23, label %55 [
i8 65, label %25
i8 66, label %25
i8 89, label %25
i8 90, label %25
i8 86, label %26
i8 88, label %35
]
25: ; preds = %14, %14, %14, %14
store double 0.000000e+00, double* %1
br label %63
26: ; preds = %14
switch i32 %20, label %55 [
i32 559, label %27
i32 560, label %31
i32 561, label %40
i32 563, label %44
i32 565, label %48
i32 562, label %52
i32 564, label %52
]
27: ; preds = %26
%28 = load double, double* @M_PI
%29 = fmul double %28, 1.500000e+00
%30 = fdiv double %29, 1.800000e+02
store double %30, double* %1
br label %63
31: ; preds = %26
%32 = load double, double* @M_PI
%33 = fmul double %32, 7.500000e+00
%34 = fdiv double %33, 1.800000e+02
store double %34, double* %1
br label %63
35: ; preds = %14
switch i32 %20, label %55 [
i32 559, label %36
i32 561, label %40
i32 563, label %44
i32 565, label %48
i32 560, label %52
i32 562, label %52
i32 564, label %52
]
36: ; preds = %35
%37 = load double, double* @M_PI
%38 = fmul double %37, 4.500000e+00
%39 = fdiv double %38, 1.800000e+02
store double %39, double* %1
br label %63
40: ; preds = %26, %35
%41 = load double, double* @M_PI
%42 = fmul double %41, 1.500000e+01
%43 = fdiv double %42, 1.800000e+02
store double %43, double* %1
br label %63
44: ; preds = %26, %35
%45 = load double, double* @M_PI
%46 = fmul double %45, 2.700000e+01
%47 = fdiv double %46, 1.800000e+02
store double %47, double* %1
br label %63
48: ; preds = %26, %35
%49 = load double, double* @M_PI
%50 = fmul double %49, 3.750000e+01
%51 = fdiv double %50, 1.800000e+02
store double %51, double* %1
br label %63
52: ; preds = %26, %26, %35, %35, %35
%53 = load i32, i32* @stderr
%54 = tail call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %24)
br label %63
55: ; preds = %26, %35, %14
%56 = add nsw i32 %20, -529
%57 = uitofp i32 %56 to double
%58 = tail call double @llvm.fmuladd.f64(double %57, double 6.000000e+00, double -1.800000e+02)
%59 = fadd double %58, 3.000000e+00
%60 = load double, double* @M_PI
%61 = fmul double %59, %60
%62 = fdiv double %61, 1.800000e+02
store double %62, double* %1
br label %63
63: ; preds = %55, %52, %48, %44, %40, %36, %31, %27, %25, %11
%64 = phi i32 [ 0, %55 ], [ -1, %52 ], [ 0, %48 ], [ 0, %44 ], [ 0, %40 ], [ 0, %36 ], [ 0, %31 ], [ 0, %27 ], [ 0, %25 ], [ -1, %11 ]
ret i32 %64
}