#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 atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ location_convert(char *, char *, int, int, char);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char *source_format;
  char *destination_format;
  int eastwest_piece;
  int northsouth_piece;
  char delimiter;
  if (argc != 6) {
    fprintf(stderr,
            "Usage: %s source_format destination_format eastwest_piece "
            "northsouth_piece delimiter\n",
            argv[0]);
    fprintf(stderr, "Expecting format: %s, %s, or %s\n", "UTM_NAD83",
            "WGS84_D.decimal", "WGS84_D_M.decimal");
    return 1;
  }
  source_format = argv[1];
  destination_format = argv[2];
  eastwest_piece = atoi(argv[3]);
  northsouth_piece = atoi(argv[4]);
  delimiter = *argv[5];
  location_convert(source_format, destination_format, eastwest_piece,
                   northsouth_piece, delimiter);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x6,-0x8(%rbp)
je     11a6 <main+0x76>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    0xed8(%rip),%rsi
lea    0xef2(%rip),%rdx
lea    0xef5(%rip),%rcx
lea    0xefe(%rip),%r8
mov    $0x0,%al
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    120a <main+0xda>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rax
mov    (%rax),%al
mov    %al,-0x29(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
movsbl -0x29(%rbp),%r8d
call   1030 <location_convert@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x6,%edi
jne    1176 <main+0x46>
mov    0x8(%rbx),%r14
mov    0x10(%rbx),%r15
mov    0x18(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    0x20(%rbx),%rdi
call   1050 <atoi@plt>
mov    0x28(%rbx),%rcx
movsbl (%rcx),%r8d
mov    %r14,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
mov    %eax,%ecx
call   1030 <location_convert@plt>
xor    %eax,%eax
jmp    11bc <main+0x8c>
mov    0x2e63(%rip),%rbp
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
lea    0xe76(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xebb(%rip),%rsi
lea    0xed5(%rip),%rdx
lea    0xed8(%rip),%rcx
lea    0xee1(%rip),%r8
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [86 x i8] c"Usage: %s source_format destination_format eastwest_piece northsouth_piece delimiter\0A\00"
@.str.1 = [33 x i8] c"Expecting format: %s, %s, or %s\0A\00"
@.str.2 = [10 x i8] c"UTM_NAD83\00"
@.str.3 = [16 x i8] c"WGS84_D.decimal\00"
@.str.4 = [18 x i8] c"WGS84_D_M.decimal\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 6
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %46
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
store i8* %24, i8** %6
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
store i8* %27, i8** %7
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 3
%30 = load i8*, i8** %29
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %8
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 4
%34 = load i8*, i8** %33
%35 = call i32 @atoi(i8* %34)
store i32 %35, i32* %9
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 5
%38 = load i8*, i8** %37
%39 = load i8, i8* %38
store i8 %39, i8* %10
%40 = load i8*, i8** %6
%41 = load i8*, i8** %7
%42 = load i32, i32* %8
%43 = load i32, i32* %9
%44 = load i8, i8* %10
%45 = call i32 @location_convert(i8* %40, i8* %41, i32 %42, i32 %43, i8 signext %44)
store i32 0, i32* %3
br label %46
46: ; preds = %21, %13
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [86 x i8] c"Usage: %s source_format destination_format eastwest_piece northsouth_piece delimiter\0A\00"
@.str.1 = [33 x i8] c"Expecting format: %s, %s, or %s\0A\00"
@.str.2 = [10 x i8] c"UTM_NAD83\00"
@.str.3 = [16 x i8] c"WGS84_D.decimal\00"
@.str.4 = [18 x i8] c"WGS84_D_M.decimal\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 6
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
br label %25
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call i32 @atoi(i8* %16)
%18 = getelementptr inbounds i8*, i8** %1, i64 4
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
%21 = getelementptr inbounds i8*, i8** %1, i64 5
%22 = load i8*, i8** %21
%23 = load i8, i8* %22
%24 = tail call i32 @location_convert(i8* %12, i8* %14, i32 %17, i32 %20, i8 signext %23)
br label %25
25: ; preds = %10, %4
%26 = phi i32 [ 1, %4 ], [ 0, %10 ]
ret i32 %26
}