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

/* Variables and functions */
int /*<<< orphan*/ GETLONG(int, 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 - ((u_int32_t)1 << 31));
  GETLONG(templ, cp);
  longval = (templ - ((u_int32_t)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    $0x108,%rsp
mov    %rdi,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
movl   $0x989680,-0x7c(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x48(%rbp)
movslq (%rax),%rax
mov    %rax,-0xb0(%rbp)
cmpq   $0x0,-0xb0(%rbp)
je     11c1 <loc_ntoa+0x71>
mov    -0x40(%rbp),%rdi
lea    0xe55(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    1585 <loc_ntoa+0x435>
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x48(%rbp)
movslq (%rax),%rax
mov    %rax,-0x98(%rbp)
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    -0x8c(%rbp),%edi
mov    -0x48(%rbp),%rsi
call   1040 <GETLONG@plt>
mov    -0x8c(%rbp),%eax
sub    $0x80000000,%eax
mov    %eax,-0x80(%rbp)
mov    -0x8c(%rbp),%edi
mov    -0x48(%rbp),%rsi
call   1040 <GETLONG@plt>
mov    -0x8c(%rbp),%eax
sub    $0x80000000,%eax
mov    %eax,-0x84(%rbp)
mov    -0x8c(%rbp),%edi
mov    -0x48(%rbp),%rsi
call   1040 <GETLONG@plt>
cmpl   $0x989680,-0x8c(%rbp)
jge    1285 <loc_ntoa+0x135>
mov    $0x989680,%eax
sub    -0x8c(%rbp),%eax
mov    %eax,-0x88(%rbp)
movl   $0xffffffff,-0x78(%rbp)
jmp    129d <loc_ntoa+0x14d>
mov    -0x8c(%rbp),%eax
sub    $0x989680,%eax
mov    %eax,-0x88(%rbp)
movl   $0x1,-0x78(%rbp)
cmpl   $0x0,-0x80(%rbp)
jge    12b8 <loc_ntoa+0x168>
movb   $0x53,-0x69(%rbp)
xor    %eax,%eax
sub    -0x80(%rbp),%eax
mov    %eax,-0x80(%rbp)
jmp    12bc <loc_ntoa+0x16c>
movb   $0x4e,-0x69(%rbp)
mov    -0x80(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x58(%rbp)
mov    -0x80(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x54(%rbp)
mov    -0x80(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x50(%rbp)
mov    -0x80(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x84(%rbp)
jge    133a <loc_ntoa+0x1ea>
movb   $0x57,-0x6a(%rbp)
xor    %eax,%eax
sub    -0x84(%rbp),%eax
mov    %eax,-0x84(%rbp)
jmp    133e <loc_ntoa+0x1ee>
movb   $0x45,-0x6a(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x68(%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,-0x64(%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,-0x60(%rbp)
mov    -0x84(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x88(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x74(%rbp)
mov    -0x88(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
imul   -0x78(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x98(%rbp),%rdi
call   1070 <precsize_ntoa@plt>
mov    %eax,%edi
call   1060 <strdup@plt>
mov    %rax,-0xb8(%rbp)
cmp    $0x0,%rax
jne    140e <loc_ntoa+0x2be>
mov    0x2c41(%rip),%rax
mov    %rax,-0xb8(%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    1440 <loc_ntoa+0x2f0>
mov    0x2c0f(%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    1472 <loc_ntoa+0x322>
mov    0x2bdd(%rip),%rax
mov    %rax,-0xc8(%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,-0xd8(%rbp)
mov    -0x60(%rbp),%esi
mov    %esi,-0xd4(%rbp)
mov    -0x64(%rbp),%r13d
mov    -0x68(%rbp),%r12d
movsbl -0x6a(%rbp),%r15d
mov    -0x70(%rbp),%r14d
mov    -0x74(%rbp),%ebx
mov    -0xb8(%rbp),%r11
mov    -0xc0(%rbp),%r10
mov    -0xc8(%rbp),%rsi
mov    %rsi,-0xd0(%rbp)
lea    0xb51(%rip),%rsi
mov    %eax,(%rsp)
mov    -0xd8(%rbp),%eax
mov    %eax,0x8(%rsp)
mov    -0xd4(%rbp),%eax
mov    %eax,0x10(%rsp)
mov    -0xd0(%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    -0xb8(%rbp),%rax
cmp    0x2b1d(%rip),%rax
je     153d <loc_ntoa+0x3ed>
mov    -0xb8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc0(%rbp),%rax
cmp    0x2afd(%rip),%rax
je     155d <loc_ntoa+0x40d>
mov    -0xc0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc8(%rbp),%rax
cmp    0x2add(%rip),%rax
je     157d <loc_ntoa+0x42d>
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
add    $0x108,%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 i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%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 i32 10000000, i32* %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 %186
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 i32, i32* %24
%57 = load i32*, i32** %6
%58 = call i32 @GETLONG(i32 %56, i32* %57)
%59 = load i32, i32* %24
%60 = sub nsw i32 %59, -2147483648
store i32 %60, i32* %21
%61 = load i32, i32* %24
%62 = load i32*, i32** %6
%63 = call i32 @GETLONG(i32 %61, i32* %62)
%64 = load i32, i32* %24
%65 = sub nsw i32 %64, -2147483648
store i32 %65, i32* %22
%66 = load i32, i32* %24
%67 = load i32*, i32** %6
%68 = call i32 @GETLONG(i32 %66, i32* %67)
%69 = load i32, i32* %24
%70 = icmp slt i32 %69, 10000000
br i1 %70, label %71, label %74
71: ; preds = %43
%72 = load i32, i32* %24
%73 = sub nsw i32 10000000, %72
store i32 %73, i32* %23
store i32 -1, i32* %19
br label %77
74: ; preds = %43
%75 = load i32, i32* %24
%76 = sub nsw i32 %75, 10000000
store i32 %76, i32* %23
store i32 1, i32* %19
br label %77
77: ; preds = %74, %71
%78 = load i32, i32* %21
%79 = icmp slt i32 %78, 0
br i1 %79, label %80, label %83
80: ; preds = %77
store i8 83, i8* %15
%81 = load i32, i32* %21
%82 = sub nsw i32 0, %81
store i32 %82, i32* %21
br label %84
83: ; preds = %77
store i8 78, i8* %15
br label %84
84: ; preds = %83, %80
%85 = load i32, i32* %21
%86 = srem i32 %85, 1000
store i32 %86, i32* %10
%87 = load i32, i32* %21
%88 = sdiv i32 %87, 1000
store i32 %88, i32* %21
%89 = load i32, i32* %21
%90 = srem i32 %89, 60
store i32 %90, i32* %9
%91 = load i32, i32* %21
%92 = sdiv i32 %91, 60
store i32 %92, i32* %21
%93 = load i32, i32* %21
%94 = srem i32 %93, 60
store i32 %94, i32* %8
%95 = load i32, i32* %21
%96 = sdiv i32 %95, 60
store i32 %96, i32* %21
%97 = load i32, i32* %21
store i32 %97, i32* %7
%98 = load i32, i32* %22
%99 = icmp slt i32 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %84
store i8 87, i8* %16
%101 = load i32, i32* %22
%102 = sub nsw i32 0, %101
store i32 %102, i32* %22
br label %104
103: ; preds = %84
store i8 69, i8* %16
br label %104
104: ; preds = %103, %100
%105 = load i32, i32* %22
%106 = srem i32 %105, 1000
store i32 %106, i32* %14
%107 = load i32, i32* %22
%108 = sdiv i32 %107, 1000
store i32 %108, i32* %22
%109 = load i32, i32* %22
%110 = srem i32 %109, 60
store i32 %110, i32* %13
%111 = load i32, i32* %22
%112 = sdiv i32 %111, 60
store i32 %112, i32* %22
%113 = load i32, i32* %22
%114 = srem i32 %113, 60
store i32 %114, i32* %12
%115 = load i32, i32* %22
%116 = sdiv i32 %115, 60
store i32 %116, i32* %22
%117 = load i32, i32* %22
store i32 %117, i32* %11
%118 = load i32, i32* %23
%119 = srem i32 %118, 100
store i32 %119, i32* %18
%120 = load i32, i32* %23
%121 = sdiv i32 %120, 100
%122 = load i32, i32* %19
%123 = mul nsw i32 %121, %122
store i32 %123, i32* %17
%124 = load i64, i64* %25
%125 = call i32 @precsize_ntoa(i64 %124)
%126 = call i8* @strdup(i32 %125)
store i8* %126, i8** %29
%127 = icmp eq i8* %126, null
br i1 %127, label %128, label %130
128: ; preds = %104
%129 = load i8*, i8** @loc_ntoa.error
store i8* %129, i8** %29
br label %130
130: ; preds = %128, %104
%131 = load i64, i64* %26
%132 = call i32 @precsize_ntoa(i64 %131)
%133 = call i8* @strdup(i32 %132)
store i8* %133, i8** %30
%134 = icmp eq i8* %133, null
br i1 %134, label %135, label %137
135: ; preds = %130
%136 = load i8*, i8** @loc_ntoa.error
store i8* %136, i8** %30
br label %137
137: ; preds = %135, %130
%138 = load i64, i64* %27
%139 = call i32 @precsize_ntoa(i64 %138)
%140 = call i8* @strdup(i32 %139)
store i8* %140, i8** %31
%141 = icmp eq i8* %140, null
br i1 %141, label %142, label %144
142: ; preds = %137
%143 = load i8*, i8** @loc_ntoa.error
store i8* %143, i8** %31
br label %144
144: ; preds = %142, %137
%145 = load i8*, i8** %5
%146 = load i32, i32* %7
%147 = load i32, i32* %8
%148 = load i32, i32* %9
%149 = load i32, i32* %10
%150 = load i8, i8* %15
%151 = sext i8 %150 to i32
%152 = load i32, i32* %11
%153 = load i32, i32* %12
%154 = load i32, i32* %13
%155 = load i32, i32* %14
%156 = load i8, i8* %16
%157 = sext i8 %156 to i32
%158 = load i32, i32* %17
%159 = load i32, i32* %18
%160 = load i8*, i8** %29
%161 = load i8*, i8** %30
%162 = load i8*, i8** %31
%163 = call i32 (i8*, i8*, ...) @sprintf(i8* %145, i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), i32 %146, i32 %147, i32 %148, i32 %149, i32 %151, i32 %152, i32 %153, i32 %154, i32 %155, i32 %157, i32 %158, i32 %159, i8* %160, i8* %161, i8* %162)
%164 = load i8*, i8** %29
%165 = load i8*, i8** @loc_ntoa.error
%166 = icmp ne i8* %164, %165
br i1 %166, label %167, label %170
167: ; preds = %144
%168 = load i8*, i8** %29
%169 = call i32 @free(i8* %168)
br label %170
170: ; preds = %167, %144
%171 = load i8*, i8** %30
%172 = load i8*, i8** @loc_ntoa.error
%173 = icmp ne i8* %171, %172
br i1 %173, label %174, label %177
174: ; preds = %170
%175 = load i8*, i8** %30
%176 = call i32 @free(i8* %175)
br label %177
177: ; preds = %174, %170
%178 = load i8*, i8** %31
%179 = load i8*, i8** @loc_ntoa.error
%180 = icmp ne i8* %178, %179
br i1 %180, label %181, label %184
181: ; preds = %177
%182 = load i8*, i8** %31
%183 = call i32 @free(i8* %182)
br label %184
184: ; preds = %181, %177
%185 = load i8*, i8** %5
store i8* %185, i8** %3
br label %186
186: ; preds = %184, %39
%187 = load i8*, i8** %3
ret i8* %187
}

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(i32 undef, i32* %14)
%18 = tail call i32 @GETLONG(i32 undef, i32* %14)
%19 = tail call i32 @GETLONG(i32 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
}