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

/* Variables and functions */
char *inet_ntoa(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
void print_addr(struct sockaddr_in addr) {
  int i;
  printf("addr = %s, port = %o, family = %o zero = ", inet_ntoa(addr.sin_addr),
         addr.sin_port, addr.sin_family);
  for (i = 0; i < 8; i++)
    printf("%o ", (int)addr.sin_zero[i]);
  putchar('\n');
}


x86 assembly (clang, -O0):
<print_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x10(%rax),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    0x4(%rax),%ecx
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    11a1 <print_addr+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <print_addr+0x39>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_addr>:
push   %r14
push   %rbx
push   %rax
mov    0x30(%rsp),%edi
call   1040 <inet_ntoa@plt>
mov    0x20(%rsp),%edx
mov    0x24(%rsp),%ecx
lea    0xeb4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rsp),%rbx
mov    (%rbx),%esi
lea    0xec6(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x10(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x20(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x28(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x30(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x38(%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i64*, i32 }
@.str = [42 x i8] c"addr = %s, port = %o, family = %o zero = \00"
@.str.1 = [4 x i8] c"%o \00"
define void @print_addr(%struct.sockaddr_in* byval(%struct.sockaddr_in) align 8 %0) {
%2 = alloca i32
%3 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i32 0, i32 3
%4 = load i32, i32* %3
%5 = call i8* @inet_ntoa(i32 %4)
%6 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i32 0, i32 0
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i32 0, i32 1
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %7, i32 %9)
store i32 0, i32* %2
br label %11
11: ; preds = %23, %1
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i32 0, i32 2
%16 = load i64*, i64** %15
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i64, i64* %16, i64 %18
%20 = load i64, i64* %19
%21 = trunc i64 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %14
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %11
26: ; preds = %11
%27 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i64*, i32 }
@.str = [42 x i8] c"addr = %s, port = %o, family = %o zero = \00"
@.str.1 = [4 x i8] c"%o \00"
define void @print_addr(%struct.sockaddr_in* nocapture byval(%struct.sockaddr_in) align 8 %0) {
%2 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 3
%3 = load i32, i32* %2
%4 = tail call i8* @inet_ntoa(i32 %3)
%5 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 1
%8 = load i32, i32* %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %4, i32 %6, i32 %8)
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 2
%11 = load i64*, i64** %10
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds i64, i64* %11, i64 1
%16 = load i64, i64* %15
%17 = trunc i64 %16 to i32
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = getelementptr inbounds i64, i64* %11, i64 2
%20 = load i64, i64* %19
%21 = trunc i64 %20 to i32
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds i64, i64* %11, i64 3
%24 = load i64, i64* %23
%25 = trunc i64 %24 to i32
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds i64, i64* %11, i64 4
%28 = load i64, i64* %27
%29 = trunc i64 %28 to i32
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%31 = getelementptr inbounds i64, i64* %11, i64 5
%32 = load i64, i64* %31
%33 = trunc i64 %32 to i32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds i64, i64* %11, i64 6
%36 = load i64, i64* %35
%37 = trunc i64 %36 to i32
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds i64, i64* %11, i64 7
%40 = load i64, i64* %39
%41 = trunc i64 %40 to i32
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = tail call i32 @putchar(i8 signext 10)
ret void
}