#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 /*<<< 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 flg;
  int s;
  ilat = 85.0;
  ilon = 45.0;
  hgt = 150.0;
  flg = 0;
  s = AACGMConvert(ilat, ilon, hgt, &olat, &olon, &r, flg);
  if (s != 0) {
    fprintf(stderr, "Error in AACGM conversion.\n");
    exit(-1);
  }
  fprintf(stdout, "AACGMConvert\n");
  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  0xec2(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xead(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe98(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x44(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
mov    -0x44(%rbp),%ecx
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
lea    -0x40(%rbp),%rdx
call   1040 <AACGMConvert@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
je     11c5 <main+0x95>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
mov    0x2e0c(%rip),%rax
mov    (%rax),%edi
lea    0xe5f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2df5(%rip),%rax
mov    (%rax),%edi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm2
lea    0xe47(%rip),%rsi
mov    $0x3,%al
call   1030 <fprintf@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    0xe48(%rip),%rsi
mov    $0x2,%al
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movsd  0xec3(%rip),%xmm0
movsd  0xec3(%rip),%xmm1
movsd  0xec3(%rip),%xmm2
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x18(%rsp),%rdx
xor    %ecx,%ecx
call   1040 <AACGMConvert@plt>
test   %eax,%eax
jne    11ca <main+0x9a>
mov    0x2e6a(%rip),%rbx
mov    (%rbx),%edi
lea    0xebd(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xebb(%rip),%rsi
movsd  0xe71(%rip),%xmm0
movsd  0xe71(%rip),%xmm1
movsd  0xe71(%rip),%xmm2
mov    $0x3,%al
call   1030 <fprintf@plt>
mov    (%rbx),%edi
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
lea    0xea9(%rip),%rsi
mov    $0x2,%al
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
lea    0xe3e(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Error in AACGM conversion.\0A\00"
@stdout = global i32 0
@.str.1 = [14 x i8] c"AACGMConvert\0A\00"
@.str.2 = [34 x i8] c"Input: lat=%g, lon=%g, height=%g\0A\00"
@.str.3 = [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
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* %12
%14 = load double, double* %6
%15 = load double, double* %7
%16 = load double, double* %8
%17 = load i32, i32* %12
%18 = call i32 @AACGMConvert(double %14, double %15, double %16, double* %9, double* %10, double* %11, i32 %17)
store i32 %18, i32* %13
%19 = load i32, i32* %13
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @exit(i32 -1)
unreachable
25: ; preds = %2
%26 = load i32, i32* @stdout
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%28 = load i32, i32* @stdout
%29 = load double, double* %6
%30 = load double, double* %7
%31 = load double, double* %8
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double %29, double %30, double %31)
%33 = load i32, i32* @stdout
%34 = load double, double* %9
%35 = load double, double* %10
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), double %34, double %35)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Error in AACGM conversion.\0A\00"
@stdout = global i32 0
@.str.1 = [14 x i8] c"AACGMConvert\0A\00"
@.str.2 = [34 x i8] c"Input: lat=%g, lon=%g, height=%g\0A\00"
@.str.3 = [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 = call i32 @AACGMConvert(double 8.500000e+01, double 4.500000e+01, double 1.500000e+02, double* %3, double* %4, double* %5, i32 0)
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
%16 = load i32, i32* @stdout
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @stdout
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), double 8.500000e+01, double 4.500000e+01, double 1.500000e+02)
%20 = load i32, i32* @stdout
%21 = load double, double* %3
%22 = load double, double* %4
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), double %21, double %22)
ret i32 0
}