#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int, int, int, int, int);
void DisplayAddress(const char *label, struct sockaddr_in *sockaddr_in) {
  char *addr_ptr = (char *)&sockaddr_in->sin_addr.s_addr;
  char *port_ptr = (char *)&sockaddr_in->sin_port;
  printf("%s: %d.%d.%d.%d:%d\n", label, (int)(addr_ptr[0] & 255),
         (int)(addr_ptr[1] & 255), (int)(addr_ptr[2] & 255),
         (int)(addr_ptr[3] & 255),
         (int)(256 * (port_ptr[0] & 255) + (port_ptr[1] & 255)));
}


x86 assembly (clang, -O0):
<DisplayAddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rax
movsbl (%rax),%edx
and    $0xff,%edx
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%ecx
and    $0xff,%ecx
mov    -0x18(%rbp),%rax
movsbl 0x2(%rax),%r8d
and    $0xff,%r8d
mov    -0x18(%rbp),%rax
movsbl 0x3(%rax),%r9d
and    $0xff,%r9d
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x20(%rbp),%rdi
movsbl 0x1(%rdi),%edi
and    $0xff,%edi
add    %edi,%eax
lea    0xe67(%rip),%rdi
mov    %eax,(%rsp)
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DisplayAddress>:
push   %rax
mov    %rdi,%rax
movzbl 0x4(%rsi),%edx
movzbl 0x5(%rsi),%ecx
movzbl 0x6(%rsi),%r8d
movzbl 0x7(%rsi),%r9d
movzwl (%rsi),%esi
shl    $0x10,%esi
bswap  %esi
mov    %esi,(%rsp)
lea    0xec8(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@.str = [20 x i8] c"%s: %d.%d.%d.%d:%d\0A\00"
define void @DisplayAddress(i8* %0, %struct.sockaddr_in* %1) {
%3 = alloca i8*
%4 = alloca %struct.sockaddr_in*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %4
%7 = load %struct.sockaddr_in*, %struct.sockaddr_in** %4
%8 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 1
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
%10 = bitcast i32* %9 to i8*
store i8* %10, i8** %5
%11 = load %struct.sockaddr_in*, %struct.sockaddr_in** %4
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%13 = bitcast i32* %12 to i8*
store i8* %13, i8** %6
%14 = load i8*, i8** %3
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = and i32 %18, 255
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = and i32 %23, 255
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i64 2
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = and i32 %28, 255
%30 = load i8*, i8** %5
%31 = getelementptr inbounds i8, i8* %30, i64 3
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = and i32 %33, 255
%35 = load i8*, i8** %6
%36 = getelementptr inbounds i8, i8* %35, i64 0
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = and i32 %38, 255
%40 = mul nsw i32 256, %39
%41 = load i8*, i8** %6
%42 = getelementptr inbounds i8, i8* %41, i64 1
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = and i32 %44, 255
%46 = add nsw i32 %40, %45
%47 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %19, i32 %24, i32 %29, i32 %34, i32 %46)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@.str = [20 x i8] c"%s: %d.%d.%d.%d:%d\0A\00"
define void @DisplayAddress(i8* %0, %struct.sockaddr_in* nocapture %1) {
%3 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
%4 = bitcast i32* %3 to i8*
%5 = bitcast %struct.sockaddr_in* %1 to i8*
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = getelementptr inbounds i8, i8* %4, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = getelementptr inbounds i8, i8* %4, i64 3
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = load i8, i8* %5
%18 = zext i8 %17 to i32
%19 = shl nuw nsw i32 %18, 8
%20 = getelementptr inbounds i8, i8* %5, i64 1
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = or i32 %19, %22
%24 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %7, i32 %10, i32 %13, i32 %16, i32 %23)
ret void
}