#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ ipacl_close(int);
int ipacl_do_request_s(int, int *const, char const *const, char const *const,
                       char const *const);
int ipacl_open(int *);
int ipacl_request_s(int *const restrict pfh, const char *const restrict ip,
                    const char *const restrict protocol,
                    const char *const restrict port) {
  int fh;
  int rc;
  assert(pfh != NULL);
  assert(ip != NULL);
  assert(protocol != NULL);
  assert(port != NULL);
  if ((rc = ipacl_open(&fh)) != 0)
    return rc;
  rc = ipacl_do_request_s(fh, pfh, ip, protocol, port);
  ipacl_close(fh);
  return rc;
}


x86 assembly (clang, -O0):
<ipacl_request_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpq   $0x0,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
cmpq   $0x0,-0x28(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x2c(%rbp),%rdi
call   1030 <ipacl_open@plt>
mov    %eax,-0x30(%rbp)
cmp    $0x0,%eax
je     11c0 <ipacl_request_s+0x80>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11e9 <ipacl_request_s+0xa9>
mov    -0x2c(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1040 <ipacl_do_request_s@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%edi
call   1060 <ipacl_close@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipacl_request_s>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1050 <assert@plt>
xor    %edi,%edi
test   %r12,%r12
setne  %dil
call   1050 <assert@plt>
xor    %edi,%edi
test   %r15,%r15
setne  %dil
call   1050 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1050 <assert@plt>
lea    0xc(%rsp),%rdi
call   1030 <ipacl_open@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    11c0 <ipacl_request_s+0x80>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1040 <ipacl_do_request_s@plt>
mov    %eax,%ebp
mov    0xc(%rsp),%edi
call   1060 <ipacl_close@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ipacl_request_s(i32* noalias %0, i8* noalias %1, i8* noalias %2, i8* noalias %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%12 = load i32*, i32** %6
%13 = icmp ne i32* %12, null
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i8*, i8** %7
%17 = icmp ne i8* %16, null
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = load i8*, i8** %8
%21 = icmp ne i8* %20, null
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = load i8*, i8** %9
%25 = icmp ne i8* %24, null
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = call i32 @ipacl_open(i32* %10)
store i32 %28, i32* %11
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %4
%31 = load i32, i32* %11
store i32 %31, i32* %5
br label %42
32: ; preds = %4
%33 = load i32, i32* %10
%34 = load i32*, i32** %6
%35 = load i8*, i8** %7
%36 = load i8*, i8** %8
%37 = load i8*, i8** %9
%38 = call i32 @ipacl_do_request_s(i32 %33, i32* %34, i8* %35, i8* %36, i8* %37)
store i32 %38, i32* %11
%39 = load i32, i32* %10
%40 = call i32 @ipacl_close(i32 %39)
%41 = load i32, i32* %11
store i32 %41, i32* %5
br label %42
42: ; preds = %32, %30
%43 = load i32, i32* %5
ret i32 %43
}

LLVM IR (-O2):
define i32 @ipacl_request_s(i32* noalias %0, i8* noalias %1, i8* noalias %2, i8* noalias %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = icmp ne i32* %0, null
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = icmp ne i8* %1, null
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = icmp ne i8* %2, null
%14 = zext i1 %13 to i32
%15 = tail call i32 @assert(i32 %14)
%16 = icmp ne i8* %3, null
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = call i32 @ipacl_open(i32* %5)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %4
%22 = load i32, i32* %5
%23 = call i32 @ipacl_do_request_s(i32 %22, i32* %0, i8* %1, i8* %2, i8* %3)
%24 = load i32, i32* %5
%25 = call i32 @ipacl_close(i32 %24)
br label %26
26: ; preds = %4, %21
%27 = phi i32 [ %23, %21 ], [ %19, %4 ]
ret i32 %27
}