#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 */

/* Variables and functions */
int /*<<< orphan*/ fork_udp_reader(int, char const *, char const *, int *, int,
                                   int);
int udp_bind_a_port(int, int *);
int open_udp(const char *node, const char *port, int *pid, int cpu,
             int pagesize, int start_port) {
  int sfd;
  int num_port;
  num_port = udp_bind_a_port(start_port, &sfd);
  if (num_port < 0)
    return num_port;
  fork_udp_reader(sfd, node, port, pid, cpu, pagesize);
  return num_port;
}


x86 assembly (clang, -O0):
<open_udp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
lea    -0x30(%rbp),%rsi
call   1040 <udp_bind_a_port@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1163 <open_udp+0x43>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1185 <open_udp+0x65>
mov    -0x30(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
call   1030 <fork_udp_reader@plt>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_udp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%rbp
lea    0x4(%rsp),%rsi
mov    %r9d,%edi
call   1040 <udp_bind_a_port@plt>
mov    %eax,%ebx
test   %eax,%eax
js     1165 <open_udp+0x45>
mov    0x4(%rsp),%edi
mov    %rbp,%rsi
mov    %r13,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    %r14d,%r9d
call   1030 <fork_udp_reader@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @open_udp(i8* %0, i8* %1, i32* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i8* %0, i8** %8
store i8* %1, i8** %9
store i32* %2, i32** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
%16 = load i32, i32* %13
%17 = call i32 @udp_bind_a_port(i32 %16, i32* %14)
store i32 %17, i32* %15
%18 = load i32, i32* %15
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %6
%21 = load i32, i32* %15
store i32 %21, i32* %7
br label %31
22: ; preds = %6
%23 = load i32, i32* %14
%24 = load i8*, i8** %8
%25 = load i8*, i8** %9
%26 = load i32*, i32** %10
%27 = load i32, i32* %11
%28 = load i32, i32* %12
%29 = call i32 @fork_udp_reader(i32 %23, i8* %24, i8* %25, i32* %26, i32 %27, i32 %28)
%30 = load i32, i32* %15
store i32 %30, i32* %7
br label %31
31: ; preds = %22, %20
%32 = load i32, i32* %7
ret i32 %32
}

LLVM IR (-O2):
define i32 @open_udp(i8* %0, i8* %1, i32* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = bitcast i32* %7 to i8*
%9 = call i32 @udp_bind_a_port(i32 %5, i32* %7)
%10 = icmp slt i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = load i32, i32* %7
%13 = call i32 @fork_udp_reader(i32 %12, i8* %0, i8* %1, i32* %2, i32 %3, i32 %4)
br label %14
14: ; preds = %6, %11
ret i32 %9
}