#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int);
char *int2ip(int inputintip) {
  uint32_t ipint = inputintip;
  static char xxx_int2ip_result[16] = "\0";
  bzero(xxx_int2ip_result, 16);
  uint32_t ipint0 = (ipint >> 8 * 3) % 256;
  uint32_t ipint1 = (ipint >> 8 * 2) % 256;
  uint32_t ipint2 = (ipint >> 8 * 1) % 256;
  uint32_t ipint3 = (ipint >> 8 * 0) % 256;
  sprintf(xxx_int2ip_result, "%d.%d.%d.%d", ipint0, ipint1, ipint2, ipint3);
  return xxx_int2ip_result;
}


x86 assembly (clang, -O0):
<int2ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    0x2f08(%rip),%rdi
mov    $0x10,%esi
call   1030 <bzero@plt>
mov    -0x8(%rbp),%eax
sar    $0x18,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x10,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x8,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x0,%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0x2ea5(%rip),%rdi
lea    0xe5e(%rip),%rsi
call   1040 <sprintf@plt>
lea    0x2e92(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int2ip>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x2f13(%rip),%r14
mov    %r14,%rdi
mov    $0x10,%esi
call   1030 <bzero@plt>
mov    %ebx,%edx
sar    $0x18,%edx
mov    %ebx,%eax
shr    $0x10,%eax
lea    0xff(%rax),%ecx
test   %ax,%ax
cmovns %eax,%ecx
and    $0xffffff00,%ecx
sub    %ecx,%eax
movswl %ax,%ecx
mov    %ebx,%r8d
sar    $0x8,%r8d
lea    0xff(%r8),%eax
test   %r8d,%r8d
cmovns %r8d,%eax
and    $0xffffff00,%eax
sub    %eax,%r8d
lea    0xff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffffff00,%eax
sub    %eax,%ebx
lea    0xe6f(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%r9d
call   1040 <sprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@int2ip.xxx_int2ip_result = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @int2ip(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %2
%8 = load i32, i32* %2
store i32 %8, i32* %3
%9 = call i32 @bzero(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @int2ip.xxx_int2ip_result, i64 0, i64 0), i32 16)
%10 = load i32, i32* %3
%11 = ashr i32 %10, 24
%12 = srem i32 %11, 256
store i32 %12, i32* %4
%13 = load i32, i32* %3
%14 = ashr i32 %13, 16
%15 = srem i32 %14, 256
store i32 %15, i32* %5
%16 = load i32, i32* %3
%17 = ashr i32 %16, 8
%18 = srem i32 %17, 256
store i32 %18, i32* %6
%19 = load i32, i32* %3
%20 = ashr i32 %19, 0
%21 = srem i32 %20, 256
store i32 %21, i32* %7
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = call i32 @sprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @int2ip.xxx_int2ip_result, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %23, i32 %24, i32 %25)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @int2ip.xxx_int2ip_result, i64 0, i64 0)
}

LLVM IR (-O2):
@int2ip.xxx_int2ip_result = internal global [16 x i8] zeroinitializer
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @int2ip(i32 %0) {
%2 = tail call i32 @bzero(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @int2ip.xxx_int2ip_result, i64 0, i64 0), i32 16)
%3 = ashr i32 %0, 24
%4 = lshr i32 %0, 16
%5 = trunc i32 %4 to i16
%6 = srem i16 %5, 256
%7 = sext i16 %6 to i32
%8 = ashr i32 %0, 8
%9 = srem i32 %8, 256
%10 = srem i32 %0, 256
%11 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @int2ip.xxx_int2ip_result, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %7, i32 %9, i32 %10)
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @int2ip.xxx_int2ip_result, i64 0, i64 0)
}