#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 uint;
typedef size_t u_short;

/* Variables and functions */
char *intoaV4(unsigned int addr, char *buf, u_short bufLen) {
  char *cp, *retStr;
  uint byte;
  int n;
  cp = &buf[bufLen];
  *--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);
  retStr = (char *)(cp + 1);
  return (retStr);
}


x86 assembly (clang, -O0):
<intoaV4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,-0x1(%rax)
movl   $0x4,-0x30(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x2c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    11d3 <intoaV4+0xd3>
mov    -0x2c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x2c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    11ce <intoaV4+0xce>
mov    -0x2c(%rbp),%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,-0x1(%rax)
jmp    11d3 <intoaV4+0xd3>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x2e,-0x1(%rax)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x30(%rbp)
cmp    $0x0,%eax
jg     1135 <intoaV4+0x35>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intoaV4>:
movb   $0x0,-0x1(%rsi,%rdx,1)
movzbl %dil,%r8d
imul   $0xcd,%r8d,%ecx
shr    $0xb,%ecx
lea    (%rcx,%rcx,1),%eax
lea    (%rax,%rax,4),%r9d
mov    %r8d,%eax
sub    %r9b,%al
or     $0x30,%al
mov    %al,-0x2(%rsi,%rdx,1)
cmp    $0xa,%r8d
jae    1136 <intoaV4+0x36>
lea    (%rsi,%rdx,1),%rax
add    $0xfffffffffffffffe,%rax
jmp    1179 <intoaV4+0x79>
lea    (%rsi,%rdx,1),%rax
add    $0xffffffffffffffff,%rax
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,-0x2(%rax)
cmp    $0x64,%r8d
jae    1164 <intoaV4+0x64>
add    $0xfffffffffffffffe,%rax
jmp    1179 <intoaV4+0x79>
lea    (%r8,%r8,4),%ecx
lea    (%r8,%rcx,8),%ecx
shr    $0xc,%ecx
or     $0x30,%cl
mov    %cl,-0x3(%rax)
add    $0xfffffffffffffffd,%rax
movb   $0x2e,-0x1(%rax)
mov    %edi,%ecx
shr    $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 <intoaV4+0xae>
add    $0xfffffffffffffffe,%rax
jmp    11e9 <intoaV4+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 <intoaV4+0xd4>
add    $0xfffffffffffffffd,%rax
jmp    11e9 <intoaV4+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
shr    $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 <intoaV4+0x11e>
add    $0xfffffffffffffffe,%rax
jmp    1259 <intoaV4+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 <intoaV4+0x144>
add    $0xfffffffffffffffd,%rax
jmp    1259 <intoaV4+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)
mov    %edi,%r8d
shr    $0x18,%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    $0xa000000,%edi
jae    1291 <intoaV4+0x191>
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    $0x64000000,%edi
jae    12bc <intoaV4+0x1bc>
add    $0xfffffffffffffffd,%rax
movb   $0x2e,-0x1(%rax)
ret
movzbl %r8b,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rcx,%rdx,8),%ecx
shr    $0xc,%ecx
or     $0x30,%cl
mov    %cl,-0x4(%rax)
add    $0xfffffffffffffffc,%rax
movb   $0x2e,-0x1(%rax)
ret

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

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