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

/* Variables and functions */
int RPC_SYSTEMERROR;
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_destroy(int /*<<< orphan*/ *);
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]);
  CLIENT *client = NULL;
  enum clnt_stat cs;
  int var_snd = 0;
  struct timeval tv;
  char nettype[8] = "udp";
  if (run_mode) {
    printf("Before creation\n");
  }
  tv.tv_sec = 1;
  tv.tv_usec = 0;
  client = clnt_create(argc[1], progNum, 1, nettype);
  cs = clnt_call(client, 10, (xdrproc_t)xdr_int, (char *)&var_snd,
                 (xdrproc_t)xdr_int, (char *)&var_snd, tv);
  test_status = (cs == RPC_SYSTEMERROR) ? 0 : 1;
  printf("%d\n", test_status);
  clnt_destroy(client);
  return test_status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%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   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x30(%rbp)
mov    0xe66(%rip),%rax
mov    %rax,-0x48(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11b6 <main+0x66>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x40(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x48(%rbp),%rcx
mov    $0x1,%edx
call   1040 <clnt_create@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2df3(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    -0x30(%rbp),%rcx
mov    0x2de3(%rip),%rax
mov    (%rax),%rax
mov    %eax,%r8d
lea    -0x30(%rbp),%r9
mov    $0xa,%esi
lea    -0x40(%rbp),%rax
mov    (%rax),%r10
mov    %r10,(%rsp)
mov    0x8(%rax),%rax
mov    %rax,0x8(%rsp)
call   1050 <clnt_call@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edx
mov    0x2db6(%rip),%rax
mov    (%rax),%esi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xdcc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rdi
call   1060 <clnt_destroy@plt>
mov    -0x18(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1070 <atoi@plt>
movl   $0x0,0x1c(%rsp)
movq   $0x706475,0x20(%rsp)
movl   $0x1,0x28(%rsp)
movq   $0x0,0x30(%rsp)
mov    0x8(%rbx),%rdi
lea    0x20(%rsp),%rcx
mov    %eax,%esi
mov    $0x1,%edx
call   1040 <clnt_create@plt>
mov    %rax,%rbx
mov    0x2e3d(%rip),%rax
mov    (%rax),%edx
movups 0x28(%rsp),%xmm0
movups %xmm0,(%rsp)
lea    0x1c(%rsp),%rcx
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %edx,%r8d
mov    %rcx,%r9
call   1050 <clnt_call@plt>
mov    0x2e1b(%rip),%rcx
xor    %ebp,%ebp
cmp    (%rcx),%eax
setne  %bpl
lea    0xe24(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1060 <clnt_destroy@plt>
mov    %ebp,%eax
add    $0x38,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@__const.main.nettype = [8 x i8] c"udp\00\00\00\00\00"
@.str = [17 x i8] c"Before creation\0A\00"
@xdr_int = global i64 0
@RPC_SYSTEMERROR = global i32 0
@.str.1 = [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 i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca %struct.timeval
%13 = alloca [8 x i8]
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
store i32* null, i32** %9
store i32 0, i32* %11
%18 = bitcast [8 x i8]* %13 to i8*
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %21, %2
%24 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
store i32 1, i32* %24
%25 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
store i64 0, i64* %25
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = load i32, i32* %8
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%31 = call i32* @clnt_create(i8* %28, i32 %29, i32 1, i8* %30)
store i32* %31, i32** %9
%32 = load i32*, i32** %9
%33 = load i64, i64* @xdr_int
%34 = trunc i64 %33 to i32
%35 = bitcast i32* %11 to i8*
%36 = load i64, i64* @xdr_int
%37 = trunc i64 %36 to i32
%38 = bitcast i32* %11 to i8*
%39 = call i32 @clnt_call(i32* %32, i32 10, i32 %34, i8* %35, i32 %37, i8* %38, %struct.timeval* byval(%struct.timeval) align 8 %12)
store i32 %39, i32* %10
%40 = load i32, i32* %10
%41 = load i32, i32* @RPC_SYSTEMERROR
%42 = icmp eq i32 %40, %41
%43 = zext i1 %42 to i64
%44 = select i1 %42, i32 0, i32 1
store i32 %44, i32* %7
%45 = load i32, i32* %7
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %45)
%47 = load i32*, i32** %9
%48 = call i32 @clnt_destroy(i32* %47)
%49 = load i32, i32* %7
ret i32 %49
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@xdr_int = global i64 0
@RPC_SYSTEMERROR = global i32 0
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca %struct.timeval
%5 = alloca i64
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%10 = bitcast %struct.timeval* %4 to i8*
%11 = bitcast i64* %5 to i8*
store i64 7365749, i64* %5
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
store i32 1, i32* %12
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
store i64 0, i64* %13
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = call i32* @clnt_create(i8* %15, i32 %8, i32 1, i8* %11)
%17 = load i64, i64* @xdr_int
%18 = trunc i64 %17 to i32
%19 = call i32 @clnt_call(i32* %16, i32 10, i32 %18, i8* %9, i32 %18, i8* %9, %struct.timeval* byval(%struct.timeval) align 8 %4)
%20 = load i32, i32* @RPC_SYSTEMERROR
%21 = icmp ne i32 %19, %20
%22 = zext i1 %21 to i32
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 @clnt_destroy(i32* %16)
ret i32 %22
}