#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 full_mapcode_decode(long *, long *, char const *, char const *,
                        int /*<<< orphan*/ *, int /*<<< orphan*/ *);
char *tc2text(int, int /*<<< orphan*/);
int mc2coord(double *lat, double *lon, const char *string, int context_tc) {
  if (lat == NULL || lon == NULL || string == NULL) {
    return -100;
  } else {
    long llat, llon;
    const char *iso3 = tc2text(context_tc, 0);
    int err = full_mapcode_decode(&llat, &llon, iso3, string, NULL, NULL);
    *lat = llat / 1000000.0;
    *lon = llon / 1000000.0;
    return err;
  }
}


x86 assembly (clang, -O0):
<mc2coord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1158 <mc2coord+0x38>
cmpq   $0x0,-0x18(%rbp)
je     1158 <mc2coord+0x38>
cmpq   $0x0,-0x20(%rbp)
jne    1164 <mc2coord+0x44>
movl   $0xffffff9c,-0x4(%rbp)
jmp    11cc <mc2coord+0xac>
mov    -0x24(%rbp),%edi
xor    %esi,%esi
call   1030 <tc2text@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    -0x30(%rbp),%rdi
lea    -0x38(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%r8
call   1040 <full_mapcode_decode@plt>
mov    %eax,-0x44(%rbp)
cvtsi2sdq -0x30(%rbp),%xmm0
movsd  0xe60(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
cvtsi2sdq -0x38(%rbp),%xmm0
movsd  0xe46(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x44(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mc2coord>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0xffffff9c,%eax
test   %rdi,%rdi
je     1192 <mc2coord+0x72>
mov    %rsi,%r14
test   %rsi,%rsi
je     1192 <mc2coord+0x72>
mov    %rdx,%rbx
test   %rdx,%rdx
je     1192 <mc2coord+0x72>
mov    %rdi,%r15
mov    %ecx,%edi
xor    %esi,%esi
call   1030 <tc2text@plt>
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
mov    %rax,%rdx
mov    %rbx,%rcx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1040 <full_mapcode_decode@plt>
cvtsi2sdq 0x8(%rsp),%xmm0
movsd  0xe89(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r15)
xorps  %xmm0,%xmm0
cvtsi2sdq (%rsp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @mc2coord(double* %0, double* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i32
store double* %0, double** %6
store double* %1, double** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%14 = load double*, double** %6
%15 = icmp eq double* %14, null
br i1 %15, label %22, label %16
16: ; preds = %4
%17 = load double*, double** %7
%18 = icmp eq double* %17, null
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i8*, i8** %8
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %23
22: ; preds = %19, %16, %4
store i32 -100, i32* %5
br label %38
23: ; preds = %19
%24 = load i32, i32* %9
%25 = call i8* @tc2text(i32 %24, i32 0)
store i8* %25, i8** %12
%26 = load i8*, i8** %12
%27 = load i8*, i8** %8
%28 = call i32 @full_mapcode_decode(i64* %10, i64* %11, i8* %26, i8* %27, i32* null, i32* null)
store i32 %28, i32* %13
%29 = load i64, i64* %10
%30 = sitofp i64 %29 to double
%31 = fdiv double %30, 1.000000e+06
%32 = load double*, double** %6
store double %31, double* %32
%33 = load i64, i64* %11
%34 = sitofp i64 %33 to double
%35 = fdiv double %34, 1.000000e+06
%36 = load double*, double** %7
store double %35, double* %36
%37 = load i32, i32* %13
store i32 %37, i32* %5
br label %38
38: ; preds = %23, %22
%39 = load i32, i32* %5
ret i32 %39
}

LLVM IR (-O2):
define i32 @mc2coord(double* writeonly %0, double* writeonly %1, i8* %2, i32 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = icmp eq double* %0, null
%8 = icmp eq double* %1, null
%9 = or i1 %7, %8
%10 = icmp eq i8* %2, null
%11 = or i1 %9, %10
br i1 %11, label %23, label %12
12: ; preds = %4
%13 = bitcast i64* %5 to i8*
%14 = bitcast i64* %6 to i8*
%15 = tail call i8* @tc2text(i32 %3, i32 0)
%16 = call i32 @full_mapcode_decode(i64* %5, i64* %6, i8* %15, i8* %2, i32* null, i32* null)
%17 = load i64, i64* %5
%18 = sitofp i64 %17 to double
%19 = fdiv double %18, 1.000000e+06
store double %19, double* %0
%20 = load i64, i64* %6
%21 = sitofp i64 %20 to double
%22 = fdiv double %21, 1.000000e+06
store double %22, double* %1
br label %23
23: ; preds = %4, %12
%24 = phi i32 [ %16, %12 ], [ -100, %4 ]
ret i32 %24
}