#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           unsigned char const, unsigned char const,
                           unsigned char const, unsigned char const);
void dump_ip4addr(FILE *pigsty, const char *field, const unsigned char *buffer,
                  const size_t buffer_size) {
  if (pigsty == NULL || field == NULL || buffer == NULL || buffer_size != 4) {
    return;
  }
  fprintf(pigsty,
          "\n "
          "%s = %d.%d.%d.%d",
          field, *(buffer), *(buffer + 1), *(buffer + 2), *(buffer + 3));
}


x86 assembly (clang, -O0):
<dump_ip4addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1154 <dump_ip4addr+0x44>
cmpq   $0x0,-0x10(%rbp)
je     1154 <dump_ip4addr+0x44>
cmpq   $0x0,-0x18(%rbp)
je     1154 <dump_ip4addr+0x44>
cmpq   $0x4,-0x20(%rbp)
je     1159 <dump_ip4addr+0x49>
jmp    1199 <dump_ip4addr+0x89>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%r8b
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%r9b
mov    -0x18(%rbp),%rax
lea    0xe7e(%rip),%rsi
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl 0x3(%rax),%eax
mov    %eax,(%rsp)
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_ip4addr>:
test   %rdi,%rdi
je     114d <dump_ip4addr+0x3d>
mov    %rsi,%rax
test   %rsi,%rsi
je     114d <dump_ip4addr+0x3d>
test   %rdx,%rdx
je     114d <dump_ip4addr+0x3d>
cmp    $0x4,%rcx
jne    114d <dump_ip4addr+0x3d>
push   %rax
movzbl (%rdx),%ecx
movzbl 0x1(%rdx),%r8d
movzbl 0x2(%rdx),%r9d
movzbl 0x3(%rdx),%edx
mov    %edx,(%rsp)
lea    0xebc(%rip),%rsi
mov    %rax,%rdx
call   1030 <fprintf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0A %s = %d.%d.%d.%d\00"
define void @dump_ip4addr(i32* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i32*, i32** %5
%10 = icmp eq i32* %9, null
br i1 %10, label %20, label %11
11: ; preds = %4
%12 = load i8*, i8** %6
%13 = icmp eq i8* %12, null
br i1 %13, label %20, label %14
14: ; preds = %11
%15 = load i8*, i8** %7
%16 = icmp eq i8* %15, null
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i64, i64* %8
%19 = icmp ne i64 %18, 4
br i1 %19, label %20, label %21
20: ; preds = %17, %14, %11, %4
br label %36
21: ; preds = %17
%22 = load i32*, i32** %5
%23 = load i8*, i8** %6
%24 = load i8*, i8** %7
%25 = load i8, i8* %24
%26 = load i8*, i8** %7
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = load i8, i8* %27
%29 = load i8*, i8** %7
%30 = getelementptr inbounds i8, i8* %29, i64 2
%31 = load i8, i8* %30
%32 = load i8*, i8** %7
%33 = getelementptr inbounds i8, i8* %32, i64 3
%34 = load i8, i8* %33
%35 = call i32 @fprintf(i32* %22, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %23, i8 zeroext %25, i8 zeroext %28, i8 zeroext %31, i8 zeroext %34)
br label %36
36: ; preds = %21, %20
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0A %s = %d.%d.%d.%d\00"
define void @dump_ip4addr(i32* %0, i8* %1, i8* %2, i64 %3) {
%5 = icmp eq i32* %0, null
%6 = icmp eq i8* %1, null
%7 = or i1 %5, %6
%8 = icmp eq i8* %2, null
%9 = or i1 %7, %8
%10 = icmp ne i64 %3, 4
%11 = or i1 %9, %10
br i1 %11, label %21, label %12
12: ; preds = %4
%13 = load i8, i8* %2
%14 = getelementptr inbounds i8, i8* %2, i64 1
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %2, i64 2
%17 = load i8, i8* %16
%18 = getelementptr inbounds i8, i8* %2, i64 3
%19 = load i8, i8* %18
%20 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %1, i8 zeroext %13, i8 zeroext %15, i8 zeroext %17, i8 zeroext %19)
br label %21
21: ; preds = %4, %12
ret void
}