#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;
  int /*<<< orphan*/ sin_family;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_BROADCAST;
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
void create_bro_addr(int port, struct sockaddr_in *addrto) {
  bzero(addrto, sizeof(struct sockaddr_in));
  addrto->sin_family = AF_INET;
  addrto->sin_addr.s_addr = htonl(INADDR_BROADCAST);
  addrto->sin_port = htons(port);
}


x86 assembly (clang, -O0):
<create_bro_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xc,%esi
call   1050 <bzero@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
call   1040 <htonl@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x4(%rbp),%edi
call   1030 <htons@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_bro_addr>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
mov    $0xc,%esi
call   1050 <bzero@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rbx)
mov    0x2e88(%rip),%rax
mov    (%rax),%edi
call   1040 <htonl@plt>
mov    %eax,0x4(%rbx)
mov    %ebp,%edi
call   1030 <htons@plt>
mov    %eax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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