#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 */
char *calloc(int, int);
scalar_t__ pow(int, int);
int /*<<< orphan*/ snprintf(char *, int, char *, int, int, int, int);
char *ipUtils_unsignedIntToIp(unsigned int ip) {
  char *ipStr = calloc(16, sizeof(char));
  int ipPart1 = ip / (int)pow(256, 3);
  ip -= ipPart1 * (int)pow(256, 3);
  int ipPart2 = ip / (int)pow(256, 2);
  ip -= ipPart2 * (int)pow(256, 2);
  int ipPart3 = ip / (int)pow(256, 1);
  ip -= ipPart3 * (int)pow(256, 1);
  int ipPart4 = ip / (int)pow(256, 0);
  snprintf(ipStr, 16, "%d.%d.%d.%d", ipPart1, ipPart2, ipPart3, ipPart4);
  return ipStr;
}


x86 assembly (clang, -O0):
<ipUtils_unsignedIntToIp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x10,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    $0x100,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x3c(%rbp),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    $0x100,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
mov    -0x38(%rbp),%ecx
imul   %eax,%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    $0x100,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x34(%rbp),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    $0x100,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    -0x30(%rbp),%ecx
imul   %eax,%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    $0x100,%edi
mov    $0x1,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x2c(%rbp),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    $0x100,%edi
mov    $0x1,%esi
call   1050 <pow@plt>
mov    -0x28(%rbp),%ecx
imul   %eax,%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x100,%edi
xor    %esi,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x24(%rbp),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%eax
mov    $0x10,%esi
lea    0xda6(%rip),%rdx
mov    %eax,(%rsp)
call   1030 <snprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipUtils_unsignedIntToIp>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebp
mov    $0x10,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%r14
mov    $0x100,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%r15d
mov    $0x100,%edi
mov    $0x3,%esi
call   1050 <pow@plt>
imul   %r15d,%eax
sub    %eax,%ebp
mov    $0x100,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%r12d
mov    $0x100,%edi
mov    $0x2,%esi
call   1050 <pow@plt>
imul   %r12d,%eax
sub    %eax,%ebp
mov    $0x100,%edi
mov    $0x1,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%ebx
mov    $0x100,%edi
mov    $0x1,%esi
call   1050 <pow@plt>
imul   %ebx,%eax
sub    %eax,%ebp
mov    $0x100,%edi
xor    %esi,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    %ebp,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,(%rsp)
lea    0xe03(%rip),%rdx
mov    %r14,%rdi
mov    $0x10,%esi
mov    %r15d,%ecx
mov    %r12d,%r8d
mov    %ebx,%r9d
call   1030 <snprintf@plt>
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @ipUtils_unsignedIntToIp(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
%8 = call i8* @calloc(i32 16, i32 1)
store i8* %8, i8** %3
%9 = load i32, i32* %2
%10 = call i64 @pow(i32 256, i32 3)
%11 = trunc i64 %10 to i32
%12 = udiv i32 %9, %11
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = call i64 @pow(i32 256, i32 3)
%15 = trunc i64 %14 to i32
%16 = mul nsw i32 %13, %15
%17 = load i32, i32* %2
%18 = sub i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = call i64 @pow(i32 256, i32 2)
%21 = trunc i64 %20 to i32
%22 = udiv i32 %19, %21
store i32 %22, i32* %5
%23 = load i32, i32* %5
%24 = call i64 @pow(i32 256, i32 2)
%25 = trunc i64 %24 to i32
%26 = mul nsw i32 %23, %25
%27 = load i32, i32* %2
%28 = sub i32 %27, %26
store i32 %28, i32* %2
%29 = load i32, i32* %2
%30 = call i64 @pow(i32 256, i32 1)
%31 = trunc i64 %30 to i32
%32 = udiv i32 %29, %31
store i32 %32, i32* %6
%33 = load i32, i32* %6
%34 = call i64 @pow(i32 256, i32 1)
%35 = trunc i64 %34 to i32
%36 = mul nsw i32 %33, %35
%37 = load i32, i32* %2
%38 = sub i32 %37, %36
store i32 %38, i32* %2
%39 = load i32, i32* %2
%40 = call i64 @pow(i32 256, i32 0)
%41 = trunc i64 %40 to i32
%42 = udiv i32 %39, %41
store i32 %42, i32* %7
%43 = load i8*, i8** %3
%44 = load i32, i32* %4
%45 = load i32, i32* %5
%46 = load i32, i32* %6
%47 = load i32, i32* %7
%48 = call i32 @snprintf(i8* %43, i32 16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %44, i32 %45, i32 %46, i32 %47)
%49 = load i8*, i8** %3
ret i8* %49
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @ipUtils_unsignedIntToIp(i32 %0) {
%2 = tail call dereferenceable_or_null(16) i8* @calloc(i32 16, i32 1)
%3 = tail call i64 @pow(i32 256, i32 3)
%4 = trunc i64 %3 to i32
%5 = udiv i32 %0, %4
%6 = tail call i64 @pow(i32 256, i32 3)
%7 = trunc i64 %6 to i32
%8 = mul nsw i32 %5, %7
%9 = sub i32 %0, %8
%10 = tail call i64 @pow(i32 256, i32 2)
%11 = trunc i64 %10 to i32
%12 = udiv i32 %9, %11
%13 = tail call i64 @pow(i32 256, i32 2)
%14 = trunc i64 %13 to i32
%15 = mul nsw i32 %12, %14
%16 = sub i32 %9, %15
%17 = tail call i64 @pow(i32 256, i32 1)
%18 = trunc i64 %17 to i32
%19 = udiv i32 %16, %18
%20 = tail call i64 @pow(i32 256, i32 1)
%21 = trunc i64 %20 to i32
%22 = mul nsw i32 %19, %21
%23 = sub i32 %16, %22
%24 = tail call i64 @pow(i32 256, i32 0)
%25 = trunc i64 %24 to i32
%26 = udiv i32 %23, %25
%27 = tail call i32 @snprintf(i8* %2, i32 16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %12, i32 %19, i32 %26)
ret i8* %2
}