#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_freeres(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                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 = 0;
  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 ((CLIENT *)clnt == NULL) {
    clnt_pcreateerror("err");
    printf("1\n");
    return 1;
  }
  cs = clnt_call(clnt, 2, (xdrproc_t)xdr_int, (char *)&varSnd,
                 (xdrproc_t)xdr_int, (char *)&varSnd, to);
  test_status = !clnt_freeres(clnt, (xdrproc_t)xdr_int, (char *)&varSnd);
  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   1090 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    0xe55(%rip),%rax
mov    %rax,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x44(%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    1228 <main+0xb8>
mov    -0x30(%rbp),%rsi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x24(%rbp),%rsi
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x30(%rbp)
jne    1259 <main+0xe9>
lea    0xdf5(%rip),%rdi
call   1060 <clnt_pcreateerror@plt>
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12ed <main+0x17d>
mov    -0x30(%rbp),%rdi
mov    0x2d84(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    -0x44(%rbp),%rcx
mov    0x2d74(%rip),%rax
mov    (%rax),%rax
mov    %eax,%r8d
lea    -0x44(%rbp),%r9
mov    -0x40(%rbp),%rax
mov    $0x2,%esi
mov    %rax,(%rsp)
call   1050 <clnt_call@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
mov    0x2d4a(%rip),%rax
mov    (%rax),%rax
mov    %eax,%esi
lea    -0x44(%rbp),%rdx
call   1070 <clnt_freeres@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
mov    -0x34(%rbp),%eax
mov    0x2d1a(%rip),%rcx
cmp    (%rcx),%eax
je     12d6 <main+0x166>
mov    -0x34(%rbp),%edi
call   1080 <clnt_perrno@plt>
mov    -0x18(%rbp),%esi
lea    0xd3f(%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   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   10a0 <atoi@plt>
movq   $0x706475,0x10(%rsp)
movl   $0x0,0xc(%rsp)
mov    0x8(%rbx),%rdi
mov    $0x1,%ebp
lea    0x10(%rsp),%rcx
mov    %eax,%esi
mov    $0x1,%edx
call   1050 <clnt_create@plt>
test   %rax,%rax
je     123b <main+0xbb>
mov    %rax,%rbx
mov    0x2e18(%rip),%r15
mov    (%r15),%edx
movabs $0x6400000001,%rax
mov    %rax,(%rsp)
lea    0xc(%rsp),%rbp
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %rbp,%rcx
mov    %edx,%r8d
mov    %rbp,%r9
call   1060 <clnt_call@plt>
mov    %eax,%r14d
mov    (%r15),%esi
mov    %rbx,%rdi
mov    %rbp,%rdx
call   1080 <clnt_freeres@plt>
xor    %ebp,%ebp
test   %eax,%eax
sete   %bpl
mov    0x2dc4(%rip),%rax
cmp    (%rax),%r14d
je     1229 <main+0xa9>
mov    %r14d,%edi
call   1090 <clnt_perrno@plt>
lea    0xdd4(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1253 <main+0xd3>
lea    0xdbe(%rip),%rdi
call   1070 <clnt_pcreateerror@plt>
lea    0xdba(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
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
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
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %8
%18 = bitcast [8 x i8]* %9 to i8*
store i32* null, i32** %10
store i32 0, i32* %13
%19 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
store i32 1, i32* %19
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
store i32 100, i32* %20
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = load i32, i32* %8
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%26 = call i32* @clnt_create(i8* %23, i32 %24, i32 1, i8* %25)
store i32* %26, i32** %10
%27 = load i32, i32* %6
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %36
29: ; preds = %2
%30 = load i32*, i32** %10
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32* %30)
%32 = load i32, i32* %8
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %29, %2
%37 = load i32*, i32** %10
%38 = icmp eq i32* %37, null
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = call i32 @clnt_pcreateerror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%41 = 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 %71
42: ; preds = %36
%43 = load i32*, i32** %10
%44 = load i64, i64* @xdr_int
%45 = trunc i64 %44 to i32
%46 = bitcast i32* %13 to i8*
%47 = load i64, i64* @xdr_int
%48 = trunc i64 %47 to i32
%49 = bitcast i32* %13 to i8*
%50 = bitcast %struct.timeval* %12 to i64*
%51 = load i64, i64* %50
%52 = call i32 @clnt_call(i32* %43, i32 2, i32 %45, i8* %46, i32 %48, i8* %49, i64 %51)
store i32 %52, i32* %11
%53 = load i32*, i32** %10
%54 = load i64, i64* @xdr_int
%55 = trunc i64 %54 to i32
%56 = bitcast i32* %13 to i8*
%57 = call i32 @clnt_freeres(i32* %53, i32 %55, i8* %56)
%58 = icmp ne i32 %57, 0
%59 = xor i1 %58, true
%60 = zext i1 %59 to i32
store i32 %60, i32* %7
%61 = load i32, i32* %11
%62 = load i32, i32* @RPC_SUCCESS
%63 = icmp ne i32 %61, %62
br i1 %63, label %64, label %67
64: ; preds = %42
%65 = load i32, i32* %11
%66 = call i32 @clnt_perrno(i32 %65)
br label %67
67: ; preds = %64, %42
%68 = load i32, i32* %7
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i32 %68)
%70 = load i32, i32* %7
store i32 %70, i32* %3
br label %71
71: ; preds = %67, %39
%72 = load i32, i32* %3
ret i32 %72
}

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 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = bitcast i64* %3 to i8*
store i64 7365749, i64* %3
%9 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32* @clnt_create(i8* %11, i32 %7, i32 1, i8* %8)
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = call i32 @clnt_pcreateerror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %32
17: ; preds = %2
%18 = load i64, i64* @xdr_int
%19 = trunc i64 %18 to i32
%20 = call i32 @clnt_call(i32* %12, i32 2, i32 %19, i8* %9, i32 %19, i8* %9, i64 429496729601)
%21 = load i64, i64* @xdr_int
%22 = trunc i64 %21 to i32
%23 = call i32 @clnt_freeres(i32* %12, i32 %22, i8* %9)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = load i32, i32* @RPC_SUCCESS
%27 = icmp eq i32 %20, %26
br i1 %27, label %30, label %28
28: ; preds = %17
%29 = call i32 @clnt_perrno(i32 %20)
br label %30
30: ; preds = %28, %17
%31 = 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 %32
32: ; preds = %30, %14
%33 = phi i32 [ 1, %14 ], [ %25, %30 ]
ret i32 %33
}