#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*/ printf(char *);
void MAG_Error(int control) {
  switch (control) {
  case 1:
    printf("\nError allocating in MAG_LegendreFunctionMemory.\n");
    break;
  case 2:
    printf("\nError allocating in MAG_AllocateModelMemory.\n");
    break;
  case 3:
    printf("\nError allocating in MAG_InitializeGeoid\n");
    break;
  case 4:
    printf("\nError in setting default values.\n");
    break;
  case 5:
    printf("\nError initializing Geoid.\n");
    break;
  case 6:
    printf("\nError opening WMM.COF\n.");
    break;
  case 7:
    printf("\nError opening WMMSV.COF\n.");
    break;
  case 8:
    printf("\nError reading Magnetic Model.\n");
    break;
  case 9:
    printf("\nError printing Command Prompt introduction.\n");
    break;
  case 10:
    printf("\nError converting from geodetic co-ordinates to spherical "
           "co-ordinates.\n");
    break;
  case 11:
    printf("\nError in time modifying the Magnetic model\n");
    break;
  case 12:
    printf("\nError in Geomagnetic\n");
    break;
  case 13:
    printf("\nError printing user data\n");
    break;
  case 14:
    printf("\nError allocating in MAG_SummationSpecial\n");
    break;
  case 15:
    printf("\nError allocating in MAG_SecVarSummationSpecial\n");
    break;
  case 16:
    printf("\nError in opening EGM9615.BIN file\n");
    break;
  case 17:
    printf(
        "\nError: Latitude OR Longitude out of range in MAG_GetGeoidHeight\n");
    break;
  case 18:
    printf("\nError allocating in MAG_PcupHigh\n");
    break;
  case 19:
    printf("\nError allocating in MAG_PcupLow\n");
    break;
  case 20:
    printf("\nError opening coefficient file\n");
    break;
  case 21:
    printf("\nError: UnitDepth too large\n");
    break;
  case 22:
    printf("\nYour system needs Big endian version of EGM9615.BIN.  \n");
    printf("Please download this file from "
           "http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml.  \n");
    printf("Replace the existing EGM9615.BIN file with the downloaded one\n");
    break;
  }
}


x86 assembly (clang, -O0):
<MAG_Error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x15,%eax
ja     12cd <MAG_Error+0x1bd>
mov    -0x10(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf0d(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0xf2e(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0xf4c(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0xf65(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0xf77(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0xf82(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0xf8a(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0xf94(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0xfa3(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0xfc0(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0xff8(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x1014(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x101a(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x1024(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x103e(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x105e(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x1071(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x10a2(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x10b4(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x10c5(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x10d5(%rip),%rdi
call   1030 <printf@plt>
jmp    12cd <MAG_Error+0x1bd>
lea    0x10e1(%rip),%rdi
call   1030 <printf@plt>
lea    0x110e(%rip),%rdi
call   1030 <printf@plt>
lea    0x1156(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MAG_Error>:
push   %rax
add    $0xffffffff,%edi
cmp    $0x15,%edi
ja     1146 <MAG_Error+0x26>
lea    0xed0(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0x12d6(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
pop    %rax
ret
lea    0x1299(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x1263(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x1234(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x120c(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xed5(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>
lea    0xee1(%rip),%rdi
pop    %rax
jmp    1040 <printf@plt>
lea    0x11c6(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x118c(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x1137(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x10fe(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x10db(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x10b4(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x107d(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x1040(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0x1010(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xfc2(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xf93(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xf65(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xf1c(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xe46(%rip),%rdi
call   1030 <puts@plt>
lea    0xe72(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>
lea    0xf06(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"\0AError allocating in MAG_LegendreFunctionMemory.\0A\00"
@.str.1 = [47 x i8] c"\0AError allocating in MAG_AllocateModelMemory.\0A\00"
@.str.2 = [42 x i8] c"\0AError allocating in MAG_InitializeGeoid\0A\00"
@.str.3 = [35 x i8] c"\0AError in setting default values.\0A\00"
@.str.4 = [28 x i8] c"\0AError initializing Geoid.\0A\00"
@.str.5 = [25 x i8] c"\0AError opening WMM.COF\0A.\00"
@.str.6 = [27 x i8] c"\0AError opening WMMSV.COF\0A.\00"
@.str.7 = [32 x i8] c"\0AError reading Magnetic Model.\0A\00"
@.str.8 = [46 x i8] c"\0AError printing Command Prompt introduction.\0A\00"
@.str.9 = [73 x i8] c"\0AError converting from geodetic co-ordinates to spherical co-ordinates.\0A\00"
@.str.10 = [45 x i8] c"\0AError in time modifying the Magnetic model\0A\00"
@.str.11 = [23 x i8] c"\0AError in Geomagnetic\0A\00"
@.str.12 = [27 x i8] c"\0AError printing user data\0A\00"
@.str.13 = [43 x i8] c"\0AError allocating in MAG_SummationSpecial\0A\00"
@.str.14 = [49 x i8] c"\0AError allocating in MAG_SecVarSummationSpecial\0A\00"
@.str.15 = [36 x i8] c"\0AError in opening EGM9615.BIN file\0A\00"
@.str.16 = [66 x i8] c"\0AError: Latitude OR Longitude out of range in MAG_GetGeoidHeight\0A\00"
@.str.17 = [35 x i8] c"\0AError allocating in MAG_PcupHigh\0A\00"
@.str.18 = [34 x i8] c"\0AError allocating in MAG_PcupLow\0A\00"
@.str.19 = [33 x i8] c"\0AError opening coefficient file\0A\00"
@.str.20 = [29 x i8] c"\0AError: UnitDepth too large\0A\00"
@.str.21 = [57 x i8] c"\0AYour system needs Big endian version of EGM9615.BIN. \0A\00"
@.str.22 = [84 x i8] c"Please download this file from http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml. \0A\00"
@.str.23 = [63 x i8] c"Replace the existing EGM9615.BIN file with the downloaded one\0A\00"
define void @MAG_Error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %50 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 6, label %14
i32 7, label %16
i32 8, label %18
i32 9, label %20
i32 10, label %22
i32 11, label %24
i32 12, label %26
i32 13, label %28
i32 14, label %30
i32 15, label %32
i32 16, label %34
i32 17, label %36
i32 18, label %38
i32 19, label %40
i32 20, label %42
i32 21, label %44
i32 22, label %46
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
br label %50
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
br label %50
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %50
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %50
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
br label %50
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %50
16: ; preds = %1
%17 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %50
18: ; preds = %1
%19 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
br label %50
20: ; preds = %1
%21 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.8, i64 0, i64 0))
br label %50
22: ; preds = %1
%23 = call i32 @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.9, i64 0, i64 0))
br label %50
24: ; preds = %1
%25 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.10, i64 0, i64 0))
br label %50
26: ; preds = %1
%27 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.11, i64 0, i64 0))
br label %50
28: ; preds = %1
%29 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.12, i64 0, i64 0))
br label %50
30: ; preds = %1
%31 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.13, i64 0, i64 0))
br label %50
32: ; preds = %1
%33 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.14, i64 0, i64 0))
br label %50
34: ; preds = %1
%35 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.15, i64 0, i64 0))
br label %50
36: ; preds = %1
%37 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.16, i64 0, i64 0))
br label %50
38: ; preds = %1
%39 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0))
br label %50
40: ; preds = %1
%41 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.18, i64 0, i64 0))
br label %50
42: ; preds = %1
%43 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.19, i64 0, i64 0))
br label %50
44: ; preds = %1
%45 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.20, i64 0, i64 0))
br label %50
46: ; preds = %1
%47 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.21, i64 0, i64 0))
%48 = call i32 @printf(i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str.22, i64 0, i64 0))
%49 = call i32 @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.23, i64 0, i64 0))
br label %50
50: ; preds = %1, %46, %44, %42, %40, %38, %36, %34, %32, %30, %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str.5 = [25 x i8] c"\0AError opening WMM.COF\0A.\00"
@.str.6 = [27 x i8] c"\0AError opening WMMSV.COF\0A.\00"
@str = [56 x i8] c"\0AYour system needs Big endian version of EGM9615.BIN. \00"
@str.24 = [83 x i8] c"Please download this file from http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml. \00"
@str.25 = [62 x i8] c"Replace the existing EGM9615.BIN file with the downloaded one\00"
@str.26 = [28 x i8] c"\0AError: UnitDepth too large\00"
@str.27 = [32 x i8] c"\0AError opening coefficient file\00"
@str.28 = [33 x i8] c"\0AError allocating in MAG_PcupLow\00"
@str.29 = [34 x i8] c"\0AError allocating in MAG_PcupHigh\00"
@str.30 = [65 x i8] c"\0AError: Latitude OR Longitude out of range in MAG_GetGeoidHeight\00"
@str.31 = [35 x i8] c"\0AError in opening EGM9615.BIN file\00"
@str.32 = [48 x i8] c"\0AError allocating in MAG_SecVarSummationSpecial\00"
@str.33 = [42 x i8] c"\0AError allocating in MAG_SummationSpecial\00"
@str.34 = [26 x i8] c"\0AError printing user data\00"
@str.35 = [22 x i8] c"\0AError in Geomagnetic\00"
@str.36 = [44 x i8] c"\0AError in time modifying the Magnetic model\00"
@str.37 = [72 x i8] c"\0AError converting from geodetic co-ordinates to spherical co-ordinates.\00"
@str.38 = [45 x i8] c"\0AError printing Command Prompt introduction.\00"
@str.39 = [31 x i8] c"\0AError reading Magnetic Model.\00"
@str.40 = [27 x i8] c"\0AError initializing Geoid.\00"
@str.41 = [34 x i8] c"\0AError in setting default values.\00"
@str.42 = [41 x i8] c"\0AError allocating in MAG_InitializeGeoid\00"
@str.43 = [46 x i8] c"\0AError allocating in MAG_AllocateModelMemory.\00"
@str.44 = [49 x i8] c"\0AError allocating in MAG_LegendreFunctionMemory.\00"
define void @MAG_Error(i32 %0) {
switch i32 %0, label %48 [
i32 1, label %2
i32 2, label %4
i32 3, label %6
i32 4, label %8
i32 5, label %10
i32 6, label %12
i32 7, label %14
i32 8, label %16
i32 9, label %18
i32 10, label %20
i32 11, label %22
i32 12, label %24
i32 13, label %26
i32 14, label %28
i32 15, label %30
i32 16, label %32
i32 17, label %34
i32 18, label %36
i32 19, label %38
i32 20, label %40
i32 21, label %42
i32 22, label %44
]
2: ; preds = %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.44, i64 0, i64 0))
br label %48
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.43, i64 0, i64 0))
br label %48
6: ; preds = %1
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.42, i64 0, i64 0))
br label %48
8: ; preds = %1
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.41, i64 0, i64 0))
br label %48
10: ; preds = %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.40, i64 0, i64 0))
br label %48
12: ; preds = %1
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
br label %48
14: ; preds = %1
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %48
16: ; preds = %1
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.39, i64 0, i64 0))
br label %48
18: ; preds = %1
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.38, i64 0, i64 0))
br label %48
20: ; preds = %1
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str.37, i64 0, i64 0))
br label %48
22: ; preds = %1
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.36, i64 0, i64 0))
br label %48
24: ; preds = %1
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.35, i64 0, i64 0))
br label %48
26: ; preds = %1
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.34, i64 0, i64 0))
br label %48
28: ; preds = %1
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.33, i64 0, i64 0))
br label %48
30: ; preds = %1
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.32, i64 0, i64 0))
br label %48
32: ; preds = %1
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.31, i64 0, i64 0))
br label %48
34: ; preds = %1
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str.30, i64 0, i64 0))
br label %48
36: ; preds = %1
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.29, i64 0, i64 0))
br label %48
38: ; preds = %1
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.28, i64 0, i64 0))
br label %48
40: ; preds = %1
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.27, i64 0, i64 0))
br label %48
42: ; preds = %1
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.26, i64 0, i64 0))
br label %48
44: ; preds = %1
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str, i64 0, i64 0))
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([83 x i8], [83 x i8]* @str.24, i64 0, i64 0))
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str.25, i64 0, i64 0))
br label %48
48: ; preds = %1, %44, %42, %40, %38, %36, %34, %32, %30, %28, %26, %24, %22, %20, %18, %16, %14, %12, %10, %8, %6, %4, %2
ret void
}