#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 s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
};

/* Variables and functions */
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void netUDPPrint(struct sockaddr_in *from) {
  int i, j;
  printf("%d.", (from->sin_addr.s_addr) & 0xFF);
  printf("%d.", (from->sin_addr.s_addr >> 8) & 0xFF);
  printf("%d.", (from->sin_addr.s_addr >> 16) & 0xFF);
  printf("%d", (from->sin_addr.s_addr >> 24) & 0xFF);
  printf(" port %d\n", ntohs(from->sin_port));
}


x86 assembly (clang, -O0):
<netUDPPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
and    $0xff,%esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
sar    $0x8,%esi
and    $0xff,%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
sar    $0x10,%esi
and    $0xff,%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
sar    $0x18,%esi
and    $0xff,%esi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1040 <ntohs@plt>
mov    %eax,%esi
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<netUDPPrint>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movzbl 0x4(%rdi),%esi
lea    0xece(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x5(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x6(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movzbl 0x7(%rbx),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    (%rbx),%edi
call   1040 <ntohs@plt>
lea    0xe97(%rip),%rdi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@.str = [4 x i8] c"%d.\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c" port %d\0A\00"
define void @netUDPPrint(%struct.sockaddr_in* %0) {
%2 = alloca %struct.sockaddr_in*
%3 = alloca i32
%4 = alloca i32
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %2
%5 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%6 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 1
%7 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = and i32 %8, 255
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%13 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %12, i32 0, i32 0
%14 = load i32, i32* %13
%15 = ashr i32 %14, 8
%16 = and i32 %15, 255
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 1
%20 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = ashr i32 %21, 16
%23 = and i32 %22, 255
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %25, i32 0, i32 1
%27 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %26, i32 0, i32 0
%28 = load i32, i32* %27
%29 = ashr i32 %28, 24
%30 = and i32 %29, 255
%31 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %32, i32 0, i32 0
%34 = load i32, i32* %33
%35 = call i32 @ntohs(i32 %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %35)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@.str = [4 x i8] c"%d.\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c" port %d\0A\00"
define void @netUDPPrint(%struct.sockaddr_in* nocapture %0) {
%2 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 1, i32 0
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %2
%7 = lshr i32 %6, 8
%8 = and i32 %7, 255
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = lshr i32 %10, 16
%12 = and i32 %11, 255
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %2
%15 = lshr i32 %14, 24
%16 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 0
%18 = load i32, i32* %17
%19 = tail call i32 @ntohs(i32 %18)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %19)
ret void
}