#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 */
typedef scalar_t__ u_int8_t;
typedef scalar_t__ const u_int32_t;
typedef int /*<<< orphan*/ u_char;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ GETLONG(scalar_t__ const, int /*<<< orphan*/ const *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ precsize_ntoa(scalar_t__);
int /*<<< orphan*/ sprintf(char *, char *, ...);
char *strdup(int /*<<< orphan*/);
const char *loc_ntoa(const u_char *binary, char *ascii) {
  static char *error = "?";
  const u_char *cp = binary;
  int latdeg, latmin, latsec, latsecfrac;
  int longdeg, longmin, longsec, longsecfrac;
  char northsouth, eastwest;
  int altmeters, altfrac, altsign;
  const u_int32_t referencealt = 100000 * 100;
  int32_t latval, longval, altval;
  u_int32_t templ;
  u_int8_t sizeval, hpval, vpval, versionval;
  char *sizestr, *hpstr, *vpstr;
  versionval = *cp++;
  if (versionval) {
    (void)sprintf(ascii, "; error: unknown LOC RR version");
    return (ascii);
  }
  sizeval = *cp++;
  hpval = *cp++;
  vpval = *cp++;
  GETLONG(templ, cp);
  latval = (templ - ((unsigned)1 << 31));
  GETLONG(templ, cp);
  longval = (templ - ((unsigned)1 << 31));
  GETLONG(templ, cp);
  if (templ < referencealt) {
    altval = referencealt - templ;
    altsign = -1;
  } else {
    altval = templ - referencealt;
    altsign = 1;
  }
  if (latval < 0) {
    northsouth = 'S';
    latval = -latval;
  } else
    northsouth = 'N';
  latsecfrac = latval % 1000;
  latval = latval / 1000;
  latsec = latval % 60;
  latval = latval / 60;
  latmin = latval % 60;
  latval = latval / 60;
  latdeg = latval;
  if (longval < 0) {
    eastwest = 'W';
    longval = -longval;
  } else
    eastwest = 'E';
  longsecfrac = longval % 1000;
  longval = longval / 1000;
  longsec = longval % 60;
  longval = longval / 60;
  longmin = longval % 60;
  longval = longval / 60;
  longdeg = longval;
  altfrac = altval % 100;
  altmeters = (altval / 100) * altsign;
  if ((sizestr = strdup(precsize_ntoa(sizeval))) == NULL)
    sizestr = error;
  if ((hpstr = strdup(precsize_ntoa(hpval))) == NULL)
    hpstr = error;
  if ((vpstr = strdup(precsize_ntoa(vpval))) == NULL)
    vpstr = error;
  sprintf(
      ascii, "%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm %sm %sm %sm",
      latdeg, latmin, latsec, latsecfrac, northsouth, longdeg, longmin, longsec,
      longsecfrac, eastwest, altmeters, altfrac, sizestr, hpstr, vpstr);
  if (sizestr != error)
    free(sizestr);
  if (hpstr != error)
    free(hpstr);
  if (vpstr != error)
    free(vpstr);
  return (ascii);
}


x86 assembly (clang, -O0):
<loc_ntoa>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rdi,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
movq   $0x989680,-0x80(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x48(%rbp)
movslq (%rax),%rax
mov    %rax,-0xb8(%rbp)
cmpq   $0x0,-0xb8(%rbp)
je     11c2 <loc_ntoa+0x72>
mov    -0x40(%rbp),%rdi
lea    0xe54(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    15c9 <loc_ntoa+0x479>
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x48(%rbp)
movslq (%rax),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x48(%rbp)
movslq (%rax),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x48(%rbp)
movslq (%rax),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x98(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1040 <GETLONG@plt>
mov    -0x98(%rbp),%rax
movabs $0x80000000,%rcx
sub    %rcx,%rax
mov    %eax,-0x84(%rbp)
mov    -0x98(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1040 <GETLONG@plt>
mov    -0x98(%rbp),%rax
movabs $0x80000000,%rcx
sub    %rcx,%rax
mov    %eax,-0x88(%rbp)
mov    -0x98(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1040 <GETLONG@plt>
cmpq   $0x989680,-0x98(%rbp)
jge    12a0 <loc_ntoa+0x150>
mov    $0x989680,%eax
sub    -0x98(%rbp),%rax
mov    %eax,-0x8c(%rbp)
movl   $0xffffffff,-0x78(%rbp)
jmp    12ba <loc_ntoa+0x16a>
mov    -0x98(%rbp),%rax
sub    $0x989680,%rax
mov    %eax,-0x8c(%rbp)
movl   $0x1,-0x78(%rbp)
cmpl   $0x0,-0x84(%rbp)
jge    12de <loc_ntoa+0x18e>
movb   $0x53,-0x69(%rbp)
xor    %eax,%eax
sub    -0x84(%rbp),%eax
mov    %eax,-0x84(%rbp)
jmp    12e2 <loc_ntoa+0x192>
movb   $0x4e,-0x69(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x58(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x54(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x50(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x88(%rbp)
jge    137e <loc_ntoa+0x22e>
movb   $0x57,-0x6a(%rbp)
xor    %eax,%eax
sub    -0x88(%rbp),%eax
mov    %eax,-0x88(%rbp)
jmp    1382 <loc_ntoa+0x232>
movb   $0x45,-0x6a(%rbp)
mov    -0x88(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x68(%rbp)
mov    -0x88(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x64(%rbp)
mov    -0x88(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x60(%rbp)
mov    -0x88(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x8c(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x74(%rbp)
mov    -0x8c(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
imul   -0x78(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0xa0(%rbp),%rdi
call   1070 <precsize_ntoa@plt>
mov    %eax,%edi
call   1060 <strdup@plt>
mov    %rax,-0xc0(%rbp)
cmp    $0x0,%rax
jne    1452 <loc_ntoa+0x302>
mov    0x2bfd(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    -0xa8(%rbp),%rdi
call   1070 <precsize_ntoa@plt>
mov    %eax,%edi
call   1060 <strdup@plt>
mov    %rax,-0xc8(%rbp)
cmp    $0x0,%rax
jne    1484 <loc_ntoa+0x334>
mov    0x2bcb(%rip),%rax
mov    %rax,-0xc8(%rbp)
mov    -0xb0(%rbp),%rdi
call   1070 <precsize_ntoa@plt>
mov    %eax,%edi
call   1060 <strdup@plt>
mov    %rax,-0xd0(%rbp)
cmp    $0x0,%rax
jne    14b6 <loc_ntoa+0x366>
mov    0x2b99(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x4c(%rbp),%edx
mov    -0x50(%rbp),%ecx
mov    -0x54(%rbp),%r8d
mov    -0x58(%rbp),%r9d
movsbl -0x69(%rbp),%eax
mov    -0x5c(%rbp),%esi
mov    %esi,-0xe0(%rbp)
mov    -0x60(%rbp),%esi
mov    %esi,-0xdc(%rbp)
mov    -0x64(%rbp),%r13d
mov    -0x68(%rbp),%r12d
movsbl -0x6a(%rbp),%r15d
mov    -0x70(%rbp),%r14d
mov    -0x74(%rbp),%ebx
mov    -0xc0(%rbp),%r11
mov    -0xc8(%rbp),%r10
mov    -0xd0(%rbp),%rsi
mov    %rsi,-0xd8(%rbp)
lea    0xb0d(%rip),%rsi
mov    %eax,(%rsp)
mov    -0xe0(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0xdc(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0xd8(%rbp),%rax
mov    %r13d,0x18(%rsp)
mov    %r12d,0x20(%rsp)
mov    %r15d,0x28(%rsp)
mov    %r14d,0x30(%rsp)
mov    %ebx,0x38(%rsp)
mov    %r11,0x40(%rsp)
mov    %r10,0x48(%rsp)
mov    %rax,0x50(%rsp)
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0xc0(%rbp),%rax
cmp    0x2ad9(%rip),%rax
je     1581 <loc_ntoa+0x431>
mov    -0xc0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc8(%rbp),%rax
cmp    0x2ab9(%rip),%rax
je     15a1 <loc_ntoa+0x451>
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xd0(%rbp),%rax
cmp    0x2a99(%rip),%rax
je     15c1 <loc_ntoa+0x471>
mov    -0xd0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<loc_ntoa>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
cmpl   $0x0,(%rdi)
je     117f <loc_ntoa+0x2f>
movups 0xea8(%rip),%xmm0
movups %xmm0,0x10(%r14)
movups 0xe8c(%rip),%xmm0
movups %xmm0,(%r14)
jmp    125b <loc_ntoa+0x10b>
mov    %rdi,%rbx
movslq 0x4(%rdi),%r15
movslq 0x8(%rdi),%r12
movslq 0xc(%rdi),%r13
add    $0x10,%rbx
mov    %rbx,%rsi
call   1040 <GETLONG@plt>
mov    %rbx,%rsi
call   1040 <GETLONG@plt>
mov    %rbx,%rsi
call   1040 <GETLONG@plt>
mov    %r15,%rdi
call   1070 <precsize_ntoa@plt>
mov    %eax,%edi
call   1060 <strdup@plt>
mov    %rax,%r15
test   %rax,%rax
lea    0xe3a(%rip),%rbp
cmove  %rbp,%r15
mov    %r12,%rdi
call   1070 <precsize_ntoa@plt>
mov    %eax,%edi
call   1060 <strdup@plt>
mov    %rax,%r12
test   %rax,%rax
cmove  %rbp,%r12
mov    %r13,%rdi
call   1070 <precsize_ntoa@plt>
mov    %eax,%edi
call   1060 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
cmove  %rbp,%rbx
sub    $0x8,%rsp
lea    0xe1b(%rip),%rsi
mov    %r14,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
xor    %eax,%eax
push   %rbx
push   %r12
push   %r15
push   $0x0
push   $0x0
push   $0x45
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x4e
call   1050 <sprintf@plt>
add    $0x60,%rsp
cmp    %rbp,%r15
je     1241 <loc_ntoa+0xf1>
mov    %r15,%rdi
call   1030 <free@plt>
cmp    %rbp,%r12
je     124e <loc_ntoa+0xfe>
mov    %r12,%rdi
call   1030 <free@plt>
cmp    %rbp,%rbx
je     125b <loc_ntoa+0x10b>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@loc_ntoa.error = internal global i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0)
@.str = [2 x i8] c"?\00"
@.str.1 = [32 x i8] c"; error: unknown LOC RR version\00"
@.str.2 = [63 x i8] c"%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm %sm %sm %sm\00"
define i8* @loc_ntoa(i32* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8
%16 = alloca i8
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i64
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i64
%25 = alloca i64
%26 = alloca i64
%27 = alloca i64
%28 = alloca i64
%29 = alloca i8*
%30 = alloca i8*
%31 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
%32 = load i32*, i32** %4
store i32* %32, i32** %6
store i64 10000000, i64* %20
%33 = load i32*, i32** %6
%34 = getelementptr inbounds i32, i32* %33, i32 1
store i32* %34, i32** %6
%35 = load i32, i32* %33
%36 = sext i32 %35 to i64
store i64 %36, i64* %28
%37 = load i64, i64* %28
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %2
%40 = load i8*, i8** %5
%41 = call i32 (i8*, i8*, ...) @sprintf(i8* %40, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%42 = load i8*, i8** %5
store i8* %42, i8** %3
br label %190
43: ; preds = %2
%44 = load i32*, i32** %6
%45 = getelementptr inbounds i32, i32* %44, i32 1
store i32* %45, i32** %6
%46 = load i32, i32* %44
%47 = sext i32 %46 to i64
store i64 %47, i64* %25
%48 = load i32*, i32** %6
%49 = getelementptr inbounds i32, i32* %48, i32 1
store i32* %49, i32** %6
%50 = load i32, i32* %48
%51 = sext i32 %50 to i64
store i64 %51, i64* %26
%52 = load i32*, i32** %6
%53 = getelementptr inbounds i32, i32* %52, i32 1
store i32* %53, i32** %6
%54 = load i32, i32* %52
%55 = sext i32 %54 to i64
store i64 %55, i64* %27
%56 = load i64, i64* %24
%57 = load i32*, i32** %6
%58 = call i32 @GETLONG(i64 %56, i32* %57)
%59 = load i64, i64* %24
%60 = sub nsw i64 %59, 2147483648
%61 = trunc i64 %60 to i32
store i32 %61, i32* %21
%62 = load i64, i64* %24
%63 = load i32*, i32** %6
%64 = call i32 @GETLONG(i64 %62, i32* %63)
%65 = load i64, i64* %24
%66 = sub nsw i64 %65, 2147483648
%67 = trunc i64 %66 to i32
store i32 %67, i32* %22
%68 = load i64, i64* %24
%69 = load i32*, i32** %6
%70 = call i32 @GETLONG(i64 %68, i32* %69)
%71 = load i64, i64* %24
%72 = icmp slt i64 %71, 10000000
br i1 %72, label %73, label %77
73: ; preds = %43
%74 = load i64, i64* %24
%75 = sub nsw i64 10000000, %74
%76 = trunc i64 %75 to i32
store i32 %76, i32* %23
store i32 -1, i32* %19
br label %81
77: ; preds = %43
%78 = load i64, i64* %24
%79 = sub nsw i64 %78, 10000000
%80 = trunc i64 %79 to i32
store i32 %80, i32* %23
store i32 1, i32* %19
br label %81
81: ; preds = %77, %73
%82 = load i32, i32* %21
%83 = icmp slt i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %81
store i8 83, i8* %15
%85 = load i32, i32* %21
%86 = sub nsw i32 0, %85
store i32 %86, i32* %21
br label %88
87: ; preds = %81
store i8 78, i8* %15
br label %88
88: ; preds = %87, %84
%89 = load i32, i32* %21
%90 = srem i32 %89, 1000
store i32 %90, i32* %10
%91 = load i32, i32* %21
%92 = sdiv i32 %91, 1000
store i32 %92, i32* %21
%93 = load i32, i32* %21
%94 = srem i32 %93, 60
store i32 %94, i32* %9
%95 = load i32, i32* %21
%96 = sdiv i32 %95, 60
store i32 %96, i32* %21
%97 = load i32, i32* %21
%98 = srem i32 %97, 60
store i32 %98, i32* %8
%99 = load i32, i32* %21
%100 = sdiv i32 %99, 60
store i32 %100, i32* %21
%101 = load i32, i32* %21
store i32 %101, i32* %7
%102 = load i32, i32* %22
%103 = icmp slt i32 %102, 0
br i1 %103, label %104, label %107
104: ; preds = %88
store i8 87, i8* %16
%105 = load i32, i32* %22
%106 = sub nsw i32 0, %105
store i32 %106, i32* %22
br label %108
107: ; preds = %88
store i8 69, i8* %16
br label %108
108: ; preds = %107, %104
%109 = load i32, i32* %22
%110 = srem i32 %109, 1000
store i32 %110, i32* %14
%111 = load i32, i32* %22
%112 = sdiv i32 %111, 1000
store i32 %112, i32* %22
%113 = load i32, i32* %22
%114 = srem i32 %113, 60
store i32 %114, i32* %13
%115 = load i32, i32* %22
%116 = sdiv i32 %115, 60
store i32 %116, i32* %22
%117 = load i32, i32* %22
%118 = srem i32 %117, 60
store i32 %118, i32* %12
%119 = load i32, i32* %22
%120 = sdiv i32 %119, 60
store i32 %120, i32* %22
%121 = load i32, i32* %22
store i32 %121, i32* %11
%122 = load i32, i32* %23
%123 = srem i32 %122, 100
store i32 %123, i32* %18
%124 = load i32, i32* %23
%125 = sdiv i32 %124, 100
%126 = load i32, i32* %19
%127 = mul nsw i32 %125, %126
store i32 %127, i32* %17
%128 = load i64, i64* %25
%129 = call i32 @precsize_ntoa(i64 %128)
%130 = call i8* @strdup(i32 %129)
store i8* %130, i8** %29
%131 = icmp eq i8* %130, null
br i1 %131, label %132, label %134
132: ; preds = %108
%133 = load i8*, i8** @loc_ntoa.error
store i8* %133, i8** %29
br label %134
134: ; preds = %132, %108
%135 = load i64, i64* %26
%136 = call i32 @precsize_ntoa(i64 %135)
%137 = call i8* @strdup(i32 %136)
store i8* %137, i8** %30
%138 = icmp eq i8* %137, null
br i1 %138, label %139, label %141
139: ; preds = %134
%140 = load i8*, i8** @loc_ntoa.error
store i8* %140, i8** %30
br label %141
141: ; preds = %139, %134
%142 = load i64, i64* %27
%143 = call i32 @precsize_ntoa(i64 %142)
%144 = call i8* @strdup(i32 %143)
store i8* %144, i8** %31
%145 = icmp eq i8* %144, null
br i1 %145, label %146, label %148
146: ; preds = %141
%147 = load i8*, i8** @loc_ntoa.error
store i8* %147, i8** %31
br label %148
148: ; preds = %146, %141
%149 = load i8*, i8** %5
%150 = load i32, i32* %7
%151 = load i32, i32* %8
%152 = load i32, i32* %9
%153 = load i32, i32* %10
%154 = load i8, i8* %15
%155 = sext i8 %154 to i32
%156 = load i32, i32* %11
%157 = load i32, i32* %12
%158 = load i32, i32* %13
%159 = load i32, i32* %14
%160 = load i8, i8* %16
%161 = sext i8 %160 to i32
%162 = load i32, i32* %17
%163 = load i32, i32* %18
%164 = load i8*, i8** %29
%165 = load i8*, i8** %30
%166 = load i8*, i8** %31
%167 = call i32 (i8*, i8*, ...) @sprintf(i8* %149, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i32 %150, i32 %151, i32 %152, i32 %153, i32 %155, i32 %156, i32 %157, i32 %158, i32 %159, i32 %161, i32 %162, i32 %163, i8* %164, i8* %165, i8* %166)
%168 = load i8*, i8** %29
%169 = load i8*, i8** @loc_ntoa.error
%170 = icmp ne i8* %168, %169
br i1 %170, label %171, label %174
171: ; preds = %148
%172 = load i8*, i8** %29
%173 = call i32 @free(i8* %172)
br label %174
174: ; preds = %171, %148
%175 = load i8*, i8** %30
%176 = load i8*, i8** @loc_ntoa.error
%177 = icmp ne i8* %175, %176
br i1 %177, label %178, label %181
178: ; preds = %174
%179 = load i8*, i8** %30
%180 = call i32 @free(i8* %179)
br label %181
181: ; preds = %178, %174
%182 = load i8*, i8** %31
%183 = load i8*, i8** @loc_ntoa.error
%184 = icmp ne i8* %182, %183
br i1 %184, label %185, label %188
185: ; preds = %181
%186 = load i8*, i8** %31
%187 = call i32 @free(i8* %186)
br label %188
188: ; preds = %185, %181
%189 = load i8*, i8** %5
store i8* %189, i8** %3
br label %190
190: ; preds = %188, %39
%191 = load i8*, i8** %3
ret i8* %191
}

LLVM IR (-O2):
@.str = [2 x i8] c"?\00"
@.str.1 = [32 x i8] c"; error: unknown LOC RR version\00"
@.str.2 = [63 x i8] c"%d %.2d %.2d.%.3d %c %d %.2d %.2d.%.3d %c %d.%.2dm %sm %sm %sm\00"
define i8* @loc_ntoa(i32* %0, i8* returned writeonly %1) {
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(32) %1, i8* align 1 dereferenceable(32) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i64 32, i1 false)
br label %44
6: ; preds = %2
%7 = getelementptr inbounds i32, i32* %0, i64 1
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %7
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %8
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %0, i64 4
%15 = load i32, i32* %11
%16 = sext i32 %15 to i64
%17 = tail call i32 @GETLONG(i64 undef, i32* %14)
%18 = tail call i32 @GETLONG(i64 undef, i32* %14)
%19 = tail call i32 @GETLONG(i64 undef, i32* %14)
%20 = tail call i32 @precsize_ntoa(i64 %10)
%21 = tail call i8* @strdup(i32 %20)
%22 = icmp eq i8* %21, null
%23 = select i1 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %21
%24 = tail call i32 @precsize_ntoa(i64 %13)
%25 = tail call i8* @strdup(i32 %24)
%26 = icmp eq i8* %25, null
%27 = select i1 %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %25
%28 = tail call i32 @precsize_ntoa(i64 %16)
%29 = tail call i8* @strdup(i32 %28)
%30 = icmp eq i8* %29, null
%31 = select i1 %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* %29
%32 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 0, i32 0, i32 0, i32 78, i32 0, i32 0, i32 0, i32 0, i32 69, i32 0, i32 0, i8* %23, i8* %27, i8* %31)
%33 = icmp eq i8* %23, getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
br i1 %33, label %36, label %34
34: ; preds = %6
%35 = tail call i32 @free(i8* %23)
br label %36
36: ; preds = %34, %6
%37 = icmp eq i8* %27, getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
br i1 %37, label %40, label %38
38: ; preds = %36
%39 = tail call i32 @free(i8* %27)
br label %40
40: ; preds = %38, %36
%41 = icmp eq i8* %31, getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
br i1 %41, label %44, label %42
42: ; preds = %40
%43 = tail call i32 @free(i8* %31)
br label %44
44: ; preds = %40, %42, %5
ret i8* %1
}