#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 AACGMConvert(double, double, double, double *, double *, double *, int);
int AACGMInit(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  double ilat, ilon, hgt;
  double olat, olon, r;
  int yr;
  int flg;
  int s;
  ilat = 85.0;
  ilon = 45.0;
  hgt = 150.0;
  flg = 0;
  yr = 1990;
  s = AACGMInit(yr);
  if (s != 0) {
    fprintf(stderr, "Error in initializing AACGM\n");
    exit(-1);
  }
  s = AACGMConvert(ilat, ilon, hgt, &olat, &olon, &r, flg);
  if (s != 0) {
    fprintf(stderr, "Error in AACGM conversion.\n");
    exit(-1);
  }
  fprintf(stdout, "AACGMInit\n");
  fprintf(stdout, "AACGM Year:%d\n", yr);
  fprintf(stdout, "Input: lat=%g, lon=%g, height=%g\n", ilat, ilon, hgt);
  fprintf(stdout, "Output: lat=%g, lon=%g\n", olat, olon);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xeb2(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe9d(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe88(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x7c6,-0x44(%rbp)
mov    -0x44(%rbp),%edi
call   1030 <AACGMInit@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
je     11c1 <main+0x81>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe68(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
mov    -0x48(%rbp),%ecx
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1050 <AACGMConvert@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
je     1212 <main+0xd2>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
lea    0xe34(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
lea    0xe2f(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2da8(%rip),%rax
mov    (%rax),%edi
mov    -0x44(%rbp),%edx
lea    0xe20(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
lea    0xe09(%rip),%rsi
mov    $0x3,%al
call   1040 <fprintf@plt>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xe0a(%rip),%rsi
mov    $0x2,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    $0x7c6,%edi
call   1030 <AACGMInit@plt>
test   %eax,%eax
jne    1205 <main+0xc5>
movsd  0xea1(%rip),%xmm0
movsd  0xea1(%rip),%xmm1
movsd  0xea1(%rip),%xmm2
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x18(%rsp),%rdx
xor    %ecx,%ecx
call   1050 <AACGMConvert@plt>
test   %eax,%eax
jne    1217 <main+0xd7>
mov    0x2e44(%rip),%rbx
mov    (%rbx),%edi
lea    0xeb4(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeaf(%rip),%rsi
mov    $0x7c6,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xea9(%rip),%rsi
movsd  0xe36(%rip),%xmm0
movsd  0xe36(%rip),%xmm1
movsd  0xe36(%rip),%xmm2
mov    $0x3,%al
call   1040 <fprintf@plt>
mov    (%rbx),%edi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
lea    0xe97(%rip),%rsi
mov    $0x2,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret
mov    0x2dd4(%rip),%rax
mov    (%rax),%edi
lea    0xe03(%rip),%rsi
jmp    1227 <main+0xe7>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
lea    0xe0e(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"Error in initializing AACGM\0A\00"
@.str.1 = [28 x i8] c"Error in AACGM conversion.\0A\00"
@stdout = global i32 0
@.str.2 = [11 x i8] c"AACGMInit\0A\00"
@.str.3 = [15 x i8] c"AACGM Year:%d\0A\00"
@.str.4 = [34 x i8] c"Input: lat=%g, lon=%g, height=%g\0A\00"
@.str.5 = [24 x i8] c"Output: lat=%g, lon=%g\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 8.500000e+01, double* %6
store double 4.500000e+01, double* %7
store double 1.500000e+02, double* %8
store i32 0, i32* %13
store i32 1990, i32* %12
%15 = load i32, i32* %12
%16 = call i32 @AACGMInit(i32 %15)
store i32 %16, i32* %14
%17 = load i32, i32* %14
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 -1)
unreachable
23: ; preds = %2
%24 = load double, double* %6
%25 = load double, double* %7
%26 = load double, double* %8
%27 = load i32, i32* %13
%28 = call i32 @AACGMConvert(double %24, double %25, double %26, double* %9, double* %10, double* %11, i32 %27)
store i32 %28, i32* %14
%29 = load i32, i32* %14
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %23
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @exit(i32 -1)
unreachable
35: ; preds = %23
%36 = load i32, i32* @stdout
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* @stdout
%39 = load i32, i32* %12
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %39)
%41 = load i32, i32* @stdout
%42 = load double, double* %6
%43 = load double, double* %7
%44 = load double, double* %8
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double %42, double %43, double %44)
%46 = load i32, i32* @stdout
%47 = load double, double* %9
%48 = load double, double* %10
%49 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), double %47, double %48)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Error in initializing AACGM\0A\00"
@.str.1 = [28 x i8] c"Error in AACGM conversion.\0A\00"
@stdout = global i32 0
@.str.2 = [11 x i8] c"AACGMInit\0A\00"
@.str.3 = [15 x i8] c"AACGM Year:%d\0A\00"
@.str.4 = [34 x i8] c"Input: lat=%g, lon=%g, height=%g\0A\00"
@.str.5 = [24 x i8] c"Output: lat=%g, lon=%g\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = bitcast double* %3 to i8*
%7 = bitcast double* %4 to i8*
%8 = bitcast double* %5 to i8*
%9 = tail call i32 @AACGMInit(i32 1990)
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
%16 = call i32 @AACGMConvert(double 8.500000e+01, double 4.500000e+01, double 1.500000e+02, double* %3, double* %4, double* %5, i32 0)
%17 = icmp eq i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @exit(i32 -1)
unreachable
22: ; preds = %15
%23 = load i32, i32* @stdout
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* @stdout
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 1990)
%27 = load i32, i32* @stdout
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), double 8.500000e+01, double 4.500000e+01, double 1.500000e+02)
%29 = load i32, i32* @stdout
%30 = load double, double* %3
%31 = load double, double* %4
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), double %30, double %31)
ret i32 0
}