#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 */
typedef int /*<<< orphan*/ so_broadcast;
typedef int /*<<< orphan*/ reuseon;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_DGRAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_BROADCAST;
int /*<<< orphan*/ SO_REUSEADDR;
int /*<<< orphan*/ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/,
                              int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int yudpsocket_client() {
  int socketfd = socket(AF_INET, SOCK_DGRAM, 0);
  int reuseon = 1;
  setsockopt(socketfd, SOL_SOCKET, SO_REUSEADDR, &reuseon, sizeof(reuseon));
  int so_broadcast = 1;
  setsockopt(socketfd, SOL_SOCKET, SO_BROADCAST, &so_broadcast,
             sizeof(so_broadcast));
  return socketfd;
}


x86 assembly (clang, -O0):
<yudpsocket_client>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <socket@plt>
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
mov    0x2e62(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e68(%rip),%rax
mov    (%rax),%esi
mov    0x2e47(%rip),%rax
mov    (%rax),%edx
lea    -0xc(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yudpsocket_client>:
push   %r14
push   %rbx
push   %rax
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
mov    0x2ea4(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <socket@plt>
mov    %eax,%ebx
movl   $0x1,0x4(%rsp)
mov    0x2e9a(%rip),%r14
mov    (%r14),%esi
mov    0x2e68(%rip),%rax
mov    (%rax),%edx
lea    0x4(%rsp),%rcx
mov    %ebx,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
movl   $0x1,(%rsp)
mov    (%r14),%esi
mov    0x2e53(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
mov    %ebx,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@SO_BROADCAST = global i32 0
define i32 @yudpsocket_client() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* @AF_INET
%5 = load i32, i32* @SOCK_DGRAM
%6 = call i32 @socket(i32 %4, i32 %5, i32 0)
store i32 %6, i32* %1
store i32 1, i32* %2
%7 = load i32, i32* %1
%8 = load i32, i32* @SOL_SOCKET
%9 = load i32, i32* @SO_REUSEADDR
%10 = call i32 @setsockopt(i32 %7, i32 %8, i32 %9, i32* %2, i32 4)
store i32 1, i32* %3
%11 = load i32, i32* %1
%12 = load i32, i32* @SOL_SOCKET
%13 = load i32, i32* @SO_BROADCAST
%14 = call i32 @setsockopt(i32 %11, i32 %12, i32 %13, i32* %3, i32 4)
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_DGRAM = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@SO_BROADCAST = global i32 0
define i32 @yudpsocket_client() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @AF_INET
%4 = load i32, i32* @SOCK_DGRAM
%5 = tail call i32 @socket(i32 %3, i32 %4, i32 0)
%6 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%7 = load i32, i32* @SOL_SOCKET
%8 = load i32, i32* @SO_REUSEADDR
%9 = call i32 @setsockopt(i32 %5, i32 %7, i32 %8, i32* %1, i32 4)
%10 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%11 = load i32, i32* @SOL_SOCKET
%12 = load i32, i32* @SO_BROADCAST
%13 = call i32 @setsockopt(i32 %5, i32 %11, i32 %12, i32* %2, i32 4)
ret i32 %5
}