#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 */
int /*<<< orphan*/ P4(char *, unsigned long, unsigned long, unsigned long,
                      unsigned long);
int /*<<< orphan*/ TCPIP_SNPRINTF0(char *, int, int /*<<< orphan*/);
char *Hdr_IpAddrToStr(unsigned long ulAddr, char *szStr) {
  if (NULL == szStr) {
    return NULL;
  }
  (void)TCPIP_SNPRINTF0(szStr, 128,
                        P4("%d.%d.%d.%d", ulAddr >> 24, (ulAddr >> 16) & 0xff,
                           (ulAddr >> 8) & 0xff, ulAddr & 0xff));
  return szStr;
}


x86 assembly (clang, -O0):
<Hdr_IpAddrToStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    1149 <Hdr_IpAddrToStr+0x29>
movq   $0x0,-0x8(%rbp)
jmp    11a6 <Hdr_IpAddrToStr+0x86>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
shr    $0x18,%rsi
mov    -0x10(%rbp),%rdx
shr    $0x10,%rdx
and    $0xff,%rdx
mov    -0x10(%rbp),%rcx
shr    $0x8,%rcx
and    $0xff,%rcx
mov    -0x10(%rbp),%r8
and    $0xff,%r8
lea    0xe77(%rip),%rdi
call   1030 <P4@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
mov    $0x80,%esi
call   1040 <TCPIP_SNPRINTF0@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Hdr_IpAddrToStr>:
push   %rbx
mov    %rsi,%rbx
test   %rsi,%rsi
je     115d <Hdr_IpAddrToStr+0x3d>
mov    %rdi,%rax
mov    %rdi,%rsi
shr    $0x18,%rsi
mov    %eax,%ecx
shr    $0x10,%ecx
movzbl %cl,%edx
movzbl %ah,%ecx
movzbl %al,%r8d
lea    0xeb7(%rip),%rdi
call   1030 <P4@plt>
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %eax,%edx
call   1040 <TCPIP_SNPRINTF0@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @Hdr_IpAddrToStr(i64 %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %4
store i8* %1, i8** %5
%6 = load i8*, i8** %5
%7 = icmp eq i8* null, %6
br i1 %7, label %8, label %9
8: ; preds = %2
store i8* null, i8** %3
br label %24
9: ; preds = %2
%10 = load i8*, i8** %5
%11 = load i64, i64* %4
%12 = lshr i64 %11, 24
%13 = load i64, i64* %4
%14 = lshr i64 %13, 16
%15 = and i64 %14, 255
%16 = load i64, i64* %4
%17 = lshr i64 %16, 8
%18 = and i64 %17, 255
%19 = load i64, i64* %4
%20 = and i64 %19, 255
%21 = call i32 @P4(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %12, i64 %15, i64 %18, i64 %20)
%22 = call i32 @TCPIP_SNPRINTF0(i8* %10, i32 128, i32 %21)
%23 = load i8*, i8** %5
store i8* %23, i8** %3
br label %24
24: ; preds = %9, %8
%25 = load i8*, i8** %3
ret i8* %25
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define i8* @Hdr_IpAddrToStr(i64 %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %13, label %4
4: ; preds = %2
%5 = lshr i64 %0, 24
%6 = lshr i64 %0, 16
%7 = and i64 %6, 255
%8 = lshr i64 %0, 8
%9 = and i64 %8, 255
%10 = and i64 %0, 255
%11 = tail call i32 @P4(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %5, i64 %7, i64 %9, i64 %10)
%12 = tail call i32 @TCPIP_SNPRINTF0(i8* %1, i32 128, i32 %11)
br label %13
13: ; preds = %2, %4
ret i8* %1
}