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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int INADDR_ANY;
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
void *htonl(int);
void fill_values(struct sockaddr_in *addr) {
  bzero(addr, sizeof(*addr));
  addr->sin_family = AF_INET;
  addr->sin_addr.s_addr = htonl(INADDR_ANY);
  addr->sin_port = htonl(5000);
}


x86 assembly (clang, -O0):
<fill_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x18,%esi
call   1040 <bzero@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
call   1030 <htonl@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    $0x1388,%edi
call   1030 <htonl@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_values>:
push   %rbx
mov    %rdi,%rbx
mov    $0x18,%esi
call   1040 <bzero@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rbx)
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1030 <htonl@plt>
mov    %rax,0x8(%rbx)
mov    $0x1388,%edi
call   1030 <htonl@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i8* }
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
define void @fill_values(%struct.sockaddr_in* %0) {
%2 = alloca %struct.sockaddr_in*
store %struct.sockaddr_in* %0, %struct.sockaddr_in** %2
%3 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%4 = call i32 @bzero(%struct.sockaddr_in* %3, i32 24)
%5 = load i32, i32* @AF_INET
%6 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %5, i32* %7
%8 = load i32, i32* @INADDR_ANY
%9 = call i8* @htonl(i32 %8)
%10 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%12 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %11, i32 0, i32 0
store i8* %9, i8** %12
%13 = call i8* @htonl(i32 5000)
%14 = load %struct.sockaddr_in*, %struct.sockaddr_in** %2
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 0
store i8* %13, i8** %15
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i8* }
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
define void @fill_values(%struct.sockaddr_in* nocapture writeonly %0) {
%2 = tail call i32 @bzero(%struct.sockaddr_in* %0, i32 24)
%3 = load i32, i32* @AF_INET
%4 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 2
store i32 %3, i32* %4
%5 = load i32, i32* @INADDR_ANY
%6 = tail call i8* @htonl(i32 %5)
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 1, i32 0
store i8* %6, i8** %7
%8 = tail call i8* @htonl(i32 5000)
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %0, i64 0, i32 0
store i8* %8, i8** %9
ret void
}