#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*/ xdrproc_t;
struct timeval {
  int tv_sec;
  int tv_usec;
};
typedef enum clnt_stat { ____Placeholder_clnt_stat } clnt_stat;
typedef int /*<<< orphan*/ CLIENT;

/* Variables and functions */
int RPC_SUCCESS;
int atoi(char *);
int clnt_call(int /*<<< orphan*/ *, int, int /*<<< orphan*/, char *,
              int /*<<< orphan*/, char *, struct timeval);
int /*<<< orphan*/ *clnt_create(char *, int, int, char *);
int /*<<< orphan*/ clnt_pcreateerror(char *);
int /*<<< orphan*/ clnt_perrno(int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ xdr_int;
int main(int argn, char *argc[]) {
  int run_mode = 0;
  int test_status = 1;
  int progNum = atoi(argc[2]);
  char proto[8] = "udp";
  CLIENT *clnt = NULL;
  enum clnt_stat cs;
  struct timeval to;
  int varSnd = 10;
  int varRec = -1;
  to.tv_sec = 1;
  to.tv_usec = 100;
  clnt = clnt_create(argc[1], progNum, 1, proto);
  if (run_mode == 1) {
    printf("CLIENT : %p\n", clnt);
    printf("progNum : %d\n", progNum);
    printf("Proto : %s\n", proto);
  }
  if (clnt == NULL) {
    clnt_pcreateerror("err");
    printf("1\n");
    return 1;
  }
  cs = clnt_call(clnt, 1, (xdrproc_t)xdr_int, (char *)&varSnd,
                 (xdrproc_t)xdr_int, (char *)&varRec, to);
  test_status = (cs == RPC_SUCCESS) ? 0 : 1;
  if (cs != RPC_SUCCESS)
    clnt_perrno(cs);
  printf("%d\n", test_status);
  return test_status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1080 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    0xe65(%rip),%rax
mov    %rax,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0xa,-0x44(%rbp)
movl   $0xffffffff,-0x48(%rbp)
movl   $0x1,-0x40(%rbp)
movl   $0x64,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x24(%rbp),%rcx
mov    $0x1,%edx
call   1040 <clnt_create@plt>
mov    %rax,-0x30(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    121f <main+0xbf>
mov    -0x30(%rbp),%rsi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x24(%rbp),%rsi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x30(%rbp)
jne    1250 <main+0xf0>
lea    0xdfe(%rip),%rdi
call   1060 <clnt_pcreateerror@plt>
lea    0xdf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12d6 <main+0x176>
mov    -0x30(%rbp),%rdi
mov    0x2d8d(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    -0x44(%rbp),%rcx
mov    0x2d7d(%rip),%rax
mov    (%rax),%rax
mov    %eax,%r8d
lea    -0x48(%rbp),%r9
mov    -0x40(%rbp),%rax
mov    $0x1,%esi
mov    %rax,(%rsp)
call   1050 <clnt_call@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edx
mov    0x2d4c(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x34(%rbp),%eax
mov    0x2d31(%rip),%rcx
cmp    (%rcx),%eax
je     12bf <main+0x15f>
mov    -0x34(%rbp),%edi
call   1070 <clnt_perrno@plt>
mov    -0x18(%rbp),%esi
lea    0xd56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1090 <atoi@plt>
movq   $0x706475,0x18(%rsp)
movl   $0xa,0x14(%rsp)
movl   $0xffffffff,0x10(%rsp)
ff
mov    0x8(%rbx),%rdi
mov    $0x1,%ebx
lea    0x18(%rsp),%rcx
mov    %eax,%esi
mov    $0x1,%edx
call   1050 <clnt_create@plt>
test   %rax,%rax
je     1213 <main+0xa3>
mov    0x2e28(%rip),%rcx
mov    (%rcx),%edx
movabs $0x6400000001,%rcx
mov    %rcx,(%rsp)
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r9
mov    %rax,%rdi
mov    $0x1,%esi
mov    %edx,%r8d
call   1060 <clnt_call@plt>
mov    0x2def(%rip),%rcx
xor    %ebx,%ebx
cmp    (%rcx),%eax
setne  %bl
je     1201 <main+0x91>
mov    %eax,%edi
call   1080 <clnt_perrno@plt>
lea    0xdfc(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    122b <main+0xbb>
lea    0xde6(%rip),%rdi
call   1070 <clnt_pcreateerror@plt>
lea    0xde2(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@__const.main.proto = [8 x i8] c"udp\00\00\00\00\00"
@.str = [13 x i8] c"CLIENT : %p\0A\00"
@.str.1 = [14 x i8] c"progNum : %d\0A\00"
@.str.2 = [12 x i8] c"Proto : %s\0A\00"
@.str.3 = [4 x i8] c"err\00"
@.str.4 = [3 x i8] c"1\0A\00"
@xdr_int = global i64 0
@RPC_SUCCESS = global i32 0
@.str.5 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [8 x i8]
%10 = alloca i32*
%11 = alloca i32
%12 = alloca %struct.timeval
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 1, i32* %7
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %8
%19 = bitcast [8 x i8]* %9 to i8*
store i32* null, i32** %10
store i32 10, i32* %13
store i32 -1, i32* %14
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
store i32 1, i32* %20
%21 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
store i32 100, i32* %21
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = load i32, i32* %8
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%27 = call i32* @clnt_create(i8* %24, i32 %25, i32 1, i8* %26)
store i32* %27, i32** %10
%28 = load i32, i32* %6
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %37
30: ; preds = %2
%31 = load i32*, i32** %10
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32* %31)
%33 = load i32, i32* %8
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %35)
br label %37
37: ; preds = %30, %2
%38 = load i32*, i32** %10
%39 = icmp eq i32* %38, null
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = call i32 @clnt_pcreateerror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %69
43: ; preds = %37
%44 = load i32*, i32** %10
%45 = load i64, i64* @xdr_int
%46 = trunc i64 %45 to i32
%47 = bitcast i32* %13 to i8*
%48 = load i64, i64* @xdr_int
%49 = trunc i64 %48 to i32
%50 = bitcast i32* %14 to i8*
%51 = bitcast %struct.timeval* %12 to i64*
%52 = load i64, i64* %51
%53 = call i32 @clnt_call(i32* %44, i32 1, i32 %46, i8* %47, i32 %49, i8* %50, i64 %52)
store i32 %53, i32* %11
%54 = load i32, i32* %11
%55 = load i32, i32* @RPC_SUCCESS
%56 = icmp eq i32 %54, %55
%57 = zext i1 %56 to i64
%58 = select i1 %56, i32 0, i32 1
store i32 %58, i32* %7
%59 = load i32, i32* %11
%60 = load i32, i32* @RPC_SUCCESS
%61 = icmp ne i32 %59, %60
br i1 %61, label %62, label %65
62: ; preds = %43
%63 = load i32, i32* %11
%64 = call i32 @clnt_perrno(i32 %63)
br label %65
65: ; preds = %62, %43
%66 = load i32, i32* %7
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %66)
%68 = load i32, i32* %7
store i32 %68, i32* %3
br label %69
69: ; preds = %65, %40
%70 = load i32, i32* %3
ret i32 %70
}

LLVM IR (-O2):
@.str.3 = [4 x i8] c"err\00"
@xdr_int = global i64 0
@RPC_SUCCESS = global i32 0
@.str.5 = [4 x i8] c"%d\0A\00"
@str = [2 x i8] c"1\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = bitcast i64* %3 to i8*
store i64 7365749, i64* %3
%10 = bitcast i32* %4 to i8*
store i32 10, i32* %4
%11 = bitcast i32* %5 to i8*
store i32 -1, i32* %5
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = call i32* @clnt_create(i8* %13, i32 %8, i32 1, i8* %9)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = call i32 @clnt_pcreateerror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %31
19: ; preds = %2
%20 = load i64, i64* @xdr_int
%21 = trunc i64 %20 to i32
%22 = call i32 @clnt_call(i32* %14, i32 1, i32 %21, i8* %10, i32 %21, i8* %11, i64 429496729601)
%23 = load i32, i32* @RPC_SUCCESS
%24 = icmp ne i32 %22, %23
%25 = zext i1 %24 to i32
%26 = icmp eq i32 %22, %23
br i1 %26, label %29, label %27
27: ; preds = %19
%28 = call i32 @clnt_perrno(i32 %22)
br label %29
29: ; preds = %27, %19
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %25)
br label %31
31: ; preds = %29, %16
%32 = phi i32 [ 1, %16 ], [ %25, %29 ]
ret i32 %32
}