#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 int u_int32_t;
typedef int u_int;

/* Variables and functions */
char *intoa(u_int32_t addr) {
  register char *cp;
  register u_int byte;
  register int n;
  static char buf[sizeof(".xxx.xxx.xxx.xxx")];
  cp = &buf[sizeof buf];
  *--cp = '\0';
  n = 4;
  do {
    byte = addr & 0xff;
    *--cp = byte % 10 + '0';
    byte /= 10;
    if (byte > 0) {
      *--cp = byte % 10 + '0';
      byte /= 10;
      if (byte > 0)
        *--cp = byte + '0';
    }
    *--cp = '.';
    addr >>= 8;
  } while (--n > 0);
  return cp + 1;
}


x86 assembly (clang, -O0):
<intoa>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0x2f22(%rip),%rax
add    $0x11,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,-0x1(%rax)
movl   $0x4,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11ce <intoa+0xce>
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    11c9 <intoa+0xc9>
mov    -0x14(%rbp),%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,-0x1(%rax)
jmp    11ce <intoa+0xce>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2e,-0x1(%rax)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jg     1130 <intoa+0x30>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intoa>:
movb   $0x0,0x2f39(%rip)
movzbl %dil,%eax
imul   $0xcd,%eax,%ecx
shr    $0xb,%ecx
lea    (%rcx,%rcx,1),%edx
lea    (%rdx,%rdx,4),%esi
mov    %eax,%edx
sub    %sil,%dl
or     $0x30,%dl
mov    %dl,0x2f17(%rip)
cmp    $0xa,%eax
jae    1136 <intoa+0x36>
lea    0x2f0b(%rip),%rax
jmp    1179 <intoa+0x79>
movzbl %cl,%ecx
imul   $0xcd,%ecx,%edx
shr    $0xa,%edx
and    $0xfffffffe,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%cl
or     $0x30,%cl
mov    %cl,0x2eeb(%rip)
cmp    $0x64,%eax
jae    1161 <intoa+0x61>
lea    0x2edf(%rip),%rax
jmp    1179 <intoa+0x79>
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,8),%eax
shr    $0xc,%eax
or     $0x30,%al
mov    %al,0x2ecb(%rip)
lea    0x2ec4(%rip),%rax
movb   $0x2e,-0x1(%rax)
mov    %edi,%ecx
sar    $0x8,%ecx
movzbl %cl,%r8d
imul   $0xcd,%r8d,%edx
shr    $0xb,%edx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %r8d,%ecx
sub    %sil,%cl
or     $0x30,%cl
mov    %cl,-0x2(%rax)
cmp    $0xa,%r8d
jae    11ae <intoa+0xae>
add    $0xfffffffffffffffe,%rax
jmp    11e9 <intoa+0xe9>
movzbl %dl,%ecx
imul   $0xcd,%ecx,%edx
shr    $0xa,%edx
and    $0xfffffffe,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%cl
or     $0x30,%cl
mov    %cl,-0x3(%rax)
cmp    $0x64,%r8d
jae    11d4 <intoa+0xd4>
add    $0xfffffffffffffffd,%rax
jmp    11e9 <intoa+0xe9>
lea    (%r8,%r8,4),%ecx
lea    (%r8,%rcx,8),%ecx
shr    $0xc,%ecx
or     $0x30,%cl
mov    %cl,-0x4(%rax)
add    $0xfffffffffffffffc,%rax
movb   $0x2e,-0x1(%rax)
mov    %edi,%ecx
sar    $0x10,%ecx
movzbl %cl,%r8d
imul   $0xcd,%r8d,%edx
shr    $0xb,%edx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %r8d,%ecx
sub    %sil,%cl
or     $0x30,%cl
mov    %cl,-0x2(%rax)
cmp    $0xa,%r8d
jae    121e <intoa+0x11e>
add    $0xfffffffffffffffe,%rax
jmp    1259 <intoa+0x159>
movzbl %dl,%ecx
imul   $0xcd,%ecx,%edx
shr    $0xa,%edx
and    $0xfffffffe,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%cl
or     $0x30,%cl
mov    %cl,-0x3(%rax)
cmp    $0x64,%r8d
jae    1244 <intoa+0x144>
add    $0xfffffffffffffffd,%rax
jmp    1259 <intoa+0x159>
lea    (%r8,%r8,4),%ecx
lea    (%r8,%rcx,8),%ecx
shr    $0xc,%ecx
or     $0x30,%cl
mov    %cl,-0x4(%rax)
add    $0xfffffffffffffffc,%rax
movb   $0x2e,-0x1(%rax)
sar    $0x18,%edi
movzbl %dil,%edi
imul   $0xcd,%edi,%edx
shr    $0xb,%edx
lea    (%rdx,%rdx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edi,%ecx
sub    %sil,%cl
or     $0x30,%cl
mov    %cl,-0x2(%rax)
cmp    $0xa,%edi
jae    128c <intoa+0x18c>
add    $0xfffffffffffffffe,%rax
movb   $0x2e,-0x1(%rax)
ret
movzbl %dl,%ecx
imul   $0xcd,%ecx,%edx
shr    $0xa,%edx
and    $0xfffffffe,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%cl
or     $0x30,%cl
mov    %cl,-0x3(%rax)
cmp    $0x64,%edi
jae    12b4 <intoa+0x1b4>
add    $0xfffffffffffffffd,%rax
movb   $0x2e,-0x1(%rax)
ret
lea    (%rdi,%rdi,4),%ecx
lea    (%rdi,%rcx,8),%ecx
shr    $0xc,%ecx
or     $0x30,%cl
mov    %cl,-0x4(%rax)
add    $0xfffffffffffffffc,%rax
movb   $0x2e,-0x1(%rax)
ret

LLVM IR (-O0):
@intoa.buf = internal global [17 x i8] zeroinitializer
define i8* @intoa(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @intoa.buf, i64 1, i64 0), i8** %3
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 -1
store i8* %7, i8** %3
store i8 0, i8* %7
store i32 4, i32* %5
br label %8
8: ; preds = %44, %1
%9 = load i32, i32* %2
%10 = and i32 %9, 255
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = srem i32 %11, 10
%13 = add nsw i32 %12, 48
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i32 -1
store i8* %16, i8** %3
store i8 %14, i8* %16
%17 = load i32, i32* %4
%18 = sdiv i32 %17, 10
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %39
21: ; preds = %8
%22 = load i32, i32* %4
%23 = srem i32 %22, 10
%24 = add nsw i32 %23, 48
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 -1
store i8* %27, i8** %3
store i8 %25, i8* %27
%28 = load i32, i32* %4
%29 = sdiv i32 %28, 10
store i32 %29, i32* %4
%30 = load i32, i32* %4
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %38
32: ; preds = %21
%33 = load i32, i32* %4
%34 = add nsw i32 %33, 48
%35 = trunc i32 %34 to i8
%36 = load i8*, i8** %3
%37 = getelementptr inbounds i8, i8* %36, i32 -1
store i8* %37, i8** %3
store i8 %35, i8* %37
br label %38
38: ; preds = %32, %21
br label %39
39: ; preds = %38, %8
%40 = load i8*, i8** %3
%41 = getelementptr inbounds i8, i8* %40, i32 -1
store i8* %41, i8** %3
store i8 46, i8* %41
%42 = load i32, i32* %2
%43 = ashr i32 %42, 8
store i32 %43, i32* %2
br label %44
44: ; preds = %39
%45 = load i32, i32* %5
%46 = add nsw i32 %45, -1
store i32 %46, i32* %5
%47 = icmp sgt i32 %46, 0
br i1 %47, label %8, label %48
48: ; preds = %44
%49 = load i8*, i8** %3
%50 = getelementptr inbounds i8, i8* %49, i64 1
ret i8* %50
}

LLVM IR (-O2):
@intoa.buf = internal global [17 x i8] zeroinitializer
define i8* @intoa(i32 %0) {
store i8 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @intoa.buf, i64 0, i64 16)
%2 = and i32 %0, 255
%3 = trunc i32 %0 to i8
%4 = urem i8 %3, 10
%5 = udiv i8 %3, 10
%6 = or i8 %4, 48
store i8 %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @intoa.buf, i64 0, i64 15)
%7 = icmp ult i32 %2, 10
br i1 %7, label %15, label %8
8: ; preds = %1
%9 = urem i8 %5, 10
%10 = or i8 %9, 48
store i8 %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @intoa.buf, i64 0, i64 14)
%11 = icmp ult i32 %2, 100
br i1 %11, label %15, label %12
12: ; preds = %8
%13 = udiv i8 %3, 100
%14 = or i8 %13, 48
store i8 %14, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @intoa.buf, i64 0, i64 13)
br label %15
15: ; preds = %8, %12, %1
%16 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @intoa.buf, i64 0, i64 13), %12 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @intoa.buf, i64 0, i64 14), %8 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @intoa.buf, i64 0, i64 15), %1 ]
%17 = getelementptr inbounds i8, i8* %16, i64 -1
store i8 46, i8* %17
%18 = ashr i32 %0, 8
%19 = and i32 %18, 255
%20 = trunc i32 %18 to i8
%21 = urem i8 %20, 10
%22 = udiv i8 %20, 10
%23 = or i8 %21, 48
%24 = getelementptr inbounds i8, i8* %16, i64 -2
store i8 %23, i8* %24
%25 = icmp ult i32 %19, 10
br i1 %25, label %35, label %26
26: ; preds = %15
%27 = urem i8 %22, 10
%28 = or i8 %27, 48
%29 = getelementptr inbounds i8, i8* %16, i64 -3
store i8 %28, i8* %29
%30 = icmp ult i32 %19, 100
br i1 %30, label %35, label %31
31: ; preds = %26
%32 = udiv i8 %20, 100
%33 = or i8 %32, 48
%34 = getelementptr inbounds i8, i8* %16, i64 -4
store i8 %33, i8* %34
br label %35
35: ; preds = %31, %26, %15
%36 = phi i8* [ %34, %31 ], [ %29, %26 ], [ %24, %15 ]
%37 = getelementptr inbounds i8, i8* %36, i64 -1
store i8 46, i8* %37
%38 = ashr i32 %0, 16
%39 = and i32 %38, 255
%40 = trunc i32 %38 to i8
%41 = urem i8 %40, 10
%42 = udiv i8 %40, 10
%43 = or i8 %41, 48
%44 = getelementptr inbounds i8, i8* %36, i64 -2
store i8 %43, i8* %44
%45 = icmp ult i32 %39, 10
br i1 %45, label %55, label %46
46: ; preds = %35
%47 = urem i8 %42, 10
%48 = or i8 %47, 48
%49 = getelementptr inbounds i8, i8* %36, i64 -3
store i8 %48, i8* %49
%50 = icmp ult i32 %39, 100
br i1 %50, label %55, label %51
51: ; preds = %46
%52 = udiv i8 %40, 100
%53 = or i8 %52, 48
%54 = getelementptr inbounds i8, i8* %36, i64 -4
store i8 %53, i8* %54
br label %55
55: ; preds = %51, %46, %35
%56 = phi i8* [ %54, %51 ], [ %49, %46 ], [ %44, %35 ]
%57 = getelementptr inbounds i8, i8* %56, i64 -1
store i8 46, i8* %57
%58 = ashr i32 %0, 24
%59 = and i32 %58, 255
%60 = trunc i32 %58 to i8
%61 = urem i8 %60, 10
%62 = udiv i8 %60, 10
%63 = or i8 %61, 48
%64 = getelementptr inbounds i8, i8* %56, i64 -2
store i8 %63, i8* %64
%65 = icmp ult i32 %59, 10
br i1 %65, label %75, label %66
66: ; preds = %55
%67 = urem i8 %62, 10
%68 = or i8 %67, 48
%69 = getelementptr inbounds i8, i8* %56, i64 -3
store i8 %68, i8* %69
%70 = icmp ult i32 %59, 100
br i1 %70, label %75, label %71
71: ; preds = %66
%72 = udiv i8 %60, 100
%73 = or i8 %72, 48
%74 = getelementptr inbounds i8, i8* %56, i64 -4
store i8 %73, i8* %74
br label %75
75: ; preds = %71, %66, %55
%76 = phi i8* [ %74, %71 ], [ %69, %66 ], [ %64, %55 ]
%77 = getelementptr inbounds i8, i8* %76, i64 -1
store i8 46, i8* %77
ret i8* %76
}