#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int ipacl_request_s(int *, char *, char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
char *strerror(int);
int main(int argc, char *argv[]) {
  int fh;
  int rc;
  if (argc < 4) {
    fprintf(stderr, "usage: %s ipaddr protocol port\n", argv[0]);
    return EXIT_FAILURE;
  }
  rc = ipacl_request_s(&fh, argv[1], argv[2], argv[3]);
  if (rc != 0) {
    fprintf(stderr, "failed: %s\n", strerror(rc));
    return EXIT_FAILURE;
  }
  printf("success\n");
  fgetc(stdin);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    119d <main+0x4d>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe79(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1228 <main+0xd8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
lea    -0x14(%rbp),%rdi
call   1060 <ipacl_request_s@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1202 <main+0xb2>
mov    0x2e06(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
call   1070 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%rdx
lea    0xe34(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2dd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1228 <main+0xd8>
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    0x2da5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x3,%edi
jg     116f <main+0x1f>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe93(%rip),%rsi
jmp    11a8 <main+0x58>
mov    0x8(%rsi),%rax
mov    0x10(%rsi),%rdx
mov    0x18(%rsi),%rcx
lea    0xc(%rsp),%rdi
mov    %rax,%rsi
call   1060 <ipacl_request_s@plt>
test   %eax,%eax
je     11b6 <main+0x66>
mov    0x2e45(%rip),%rcx
mov    (%rcx),%ebx
mov    %eax,%edi
call   1070 <strerror@plt>
lea    0xe7d(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
mov    0x2e1c(%rip),%rax
jmp    11d7 <main+0x87>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc@plt>
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"usage: %s ipaddr protocol port\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [12 x i8] c"failed: %s\0A\00"
@.str.2 = [9 x i8] c"success\0A\00"
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 4
br i1 %9, label %10, label %17
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* @EXIT_FAILURE
store i32 %16, i32* %3
br label %41
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 2
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 3
%26 = load i8*, i8** %25
%27 = call i32 @ipacl_request_s(i32* %6, i8* %20, i8* %23, i8* %26)
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %36
30: ; preds = %17
%31 = load i32, i32* @stderr
%32 = load i32, i32* %7
%33 = call i8* @strerror(i32 %32)
%34 = call i32 @fprintf(i32 %31, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @EXIT_FAILURE
store i32 %35, i32* %3
br label %41
36: ; preds = %17
%37 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* @stdin
%39 = call i32 @fgetc(i32 %38)
%40 = load i32, i32* @EXIT_SUCCESS
store i32 %40, i32* %3
br label %41
41: ; preds = %36, %30, %10
%42 = load i32, i32* %3
ret i32 %42
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"usage: %s ipaddr protocol port\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [12 x i8] c"failed: %s\0A\00"
@stdin = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [8 x i8] c"success\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp slt i32 %0, 4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %27
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = call i32 @ipacl_request_s(i32* %3, i8* %12, i8* %14, i8* %16)
%18 = icmp eq i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %10
%20 = load i32, i32* @stderr
%21 = call i8* @strerror(i32 %17)
%22 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %21)
br label %27
23: ; preds = %10
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%25 = load i32, i32* @stdin
%26 = call i32 @fgetc(i32 %25)
br label %27
27: ; preds = %23, %19, %6
%28 = phi i32* [ @EXIT_FAILURE, %6 ], [ @EXIT_FAILURE, %19 ], [ @EXIT_SUCCESS, %23 ]
%29 = load i32, i32* %28
ret i32 %29
}