#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 {
  TYPE_1__ sin_addr;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
void print_client_addr(struct sockaddr_in addr) {
  printf("%d.%d.%d.%d", addr.sin_addr.s_addr & 0xff,
         (addr.sin_addr.s_addr & 0xff00) >> 8,
         (addr.sin_addr.s_addr & 0xff0000) >> 16,
         (addr.sin_addr.s_addr & 0xff000000) >> 24);
}


x86 assembly (clang, -O0):
<print_client_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
and    $0xff,%esi
mov    -0x8(%rbp),%edx
and    $0xff00,%edx
sar    $0x8,%edx
mov    -0x8(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x10,%ecx
mov    -0x8(%rbp),%r8d
and    $0xff000000,%r8d
shr    $0x18,%r8d
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_client_addr>:
mov    %edi,%eax
movzbl %al,%esi
movzbl %ah,%edx
mov    %edi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
shr    $0x18,%eax
lea    0xed6(%rip),%rdi
mov    %eax,%r8d
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define void @print_client_addr(i32 %0) {
%2 = alloca %struct.sockaddr_in
%3 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
%4 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %3, i32 0, i32 0
store i32 %0, i32* %4
%5 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = and i32 %7, 255
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
%10 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = and i32 %11, 65280
%13 = ashr i32 %12, 8
%14 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
%15 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = and i32 %16, 16711680
%18 = ashr i32 %17, 16
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i32 0, i32 0
%20 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = and i32 %21, -16777216
%23 = lshr i32 %22, 24
%24 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %13, i32 %18, i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d.%d.%d.%d\00"
define void @print_client_addr(i32 %0) {
%2 = and i32 %0, 255
%3 = lshr i32 %0, 8
%4 = and i32 %3, 255
%5 = lshr i32 %0, 16
%6 = and i32 %5, 255
%7 = lshr i32 %0, 24
%8 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %4, i32 %6, i32 %7)
ret void
}