#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*/ 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;
  int nbCall = atoi(argc[3]);
  int nbOk = 0;
  int i;
  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;
  }
  for (i = 0; i < nbCall; i++) {
    cs = clnt_call(clnt, 1, (xdrproc_t)xdr_int, (char *)&varSnd,
                   (xdrproc_t)xdr_int, (char *)&varRec, to);
    if (cs == RPC_SUCCESS)
      nbOk++;
  }
  if (run_mode == 1) {
    printf("Aimed : %d\n", nbCall);
    printf("Got : %d\n", nbOk);
  }
  test_status = (nbOk == nbCall) ? 0 : 1;
  printf("%d\n", test_status);
  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)
mov    0xe75(%rip),%rax
mov    %rax,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0xa,-0x44(%rbp)
movl   $0xffffffff,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x50(%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    1226 <main+0xd6>
mov    -0x30(%rbp),%rsi
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x24(%rbp),%rsi
lea    0xe04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x30(%rbp)
jne    1257 <main+0x107>
lea    0xdf7(%rip),%rdi
call   1060 <clnt_pcreateerror@plt>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    132a <main+0x1da>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    12d2 <main+0x182>
mov    -0x30(%rbp),%rdi
mov    0x2d73(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    -0x44(%rbp),%rcx
mov    0x2d63(%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),%eax
mov    0x2d32(%rip),%rcx
cmp    (%rcx),%eax
jne    12bf <main+0x16f>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    12c4 <main+0x174>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    125e <main+0x10e>
cmpl   $0x1,-0x14(%rbp)
jne    12fe <main+0x1ae>
mov    -0x4c(%rbp),%esi
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%esi
lea    0xd4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x50(%rbp),%edx
mov    -0x4c(%rbp),%esi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xd21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1080 <atoi@plt>
mov    %eax,%r15d
movq   $0x706475,0x20(%rsp)
movl   $0xa,0x1c(%rsp)
movl   $0xffffffff,0x18(%rsp)
ff
mov    0x18(%rbx),%rdi
call   1080 <atoi@plt>
mov    %eax,%r14d
mov    0x8(%rbx),%rdi
mov    $0x1,%r12d
lea    0x20(%rsp),%rcx
mov    %r15d,%esi
mov    $0x1,%edx
call   1050 <clnt_create@plt>
test   %rax,%rax
je     1230 <main+0xd0>
test   %r14d,%r14d
mov    %r14d,0x14(%rsp)
jle    124a <main+0xea>
mov    %rax,%rbx
xor    %ebp,%ebp
lea    0x1c(%rsp),%r15
lea    0x18(%rsp),%r12
mov    0x2dfd(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x2df1(%rip),%rax
mov    (%rax),%edx
movabs $0x6400000001,%rax
mov    %rax,(%rsp)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15,%rcx
mov    %edx,%r8d
mov    %r12,%r9
call   1060 <clnt_call@plt>
xor    %ecx,%ecx
cmp    0x0(%r13),%eax
sete   %cl
add    %ecx,%ebp
add    $0xffffffff,%r14d
jne    11f0 <main+0x90>
jmp    124c <main+0xec>
lea    0xdc9(%rip),%rdi
call   1070 <clnt_pcreateerror@plt>
lea    0xdc5(%rip),%rdi
call   1030 <puts@plt>
jmp    1268 <main+0x108>
xor    %ebp,%ebp
xor    %r12d,%r12d
cmp    0x14(%rsp),%ebp
setne  %r12b
lea    0xda6(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
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 = [12 x i8] c"Aimed : %d\0A\00"
@.str.6 = [10 x i8] c"Got : %d\0A\00"
@.str.7 = [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
%15 = alloca i32
%16 = alloca i32
%17 = 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
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %8
%22 = bitcast [8 x i8]* %9 to i8*
store i32* null, i32** %10
store i32 10, i32* %13
store i32 -1, i32* %14
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 3
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %15
store i32 0, i32* %16
%27 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
store i32 1, i32* %27
%28 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
store i32 100, i32* %28
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = load i32, i32* %8
%33 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%34 = call i32* @clnt_create(i8* %31, i32 %32, i32 1, i8* %33)
store i32* %34, i32** %10
%35 = load i32, i32* %6
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %44
37: ; preds = %2
%38 = load i32*, i32** %10
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32* %38)
%40 = load i32, i32* %8
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %42)
br label %44
44: ; preds = %37, %2
%45 = load i32*, i32** %10
%46 = icmp eq i32* %45, null
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = call i32 @clnt_pcreateerror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%49 = 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 %93
50: ; preds = %44
store i32 0, i32* %17
br label %51
51: ; preds = %73, %50
%52 = load i32, i32* %17
%53 = load i32, i32* %15
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %76
55: ; preds = %51
%56 = load i32*, i32** %10
%57 = load i64, i64* @xdr_int
%58 = trunc i64 %57 to i32
%59 = bitcast i32* %13 to i8*
%60 = load i64, i64* @xdr_int
%61 = trunc i64 %60 to i32
%62 = bitcast i32* %14 to i8*
%63 = bitcast %struct.timeval* %12 to i64*
%64 = load i64, i64* %63
%65 = call i32 @clnt_call(i32* %56, i32 1, i32 %58, i8* %59, i32 %61, i8* %62, i64 %64)
store i32 %65, i32* %11
%66 = load i32, i32* %11
%67 = load i32, i32* @RPC_SUCCESS
%68 = icmp eq i32 %66, %67
br i1 %68, label %69, label %72
69: ; preds = %55
%70 = load i32, i32* %16
%71 = add nsw i32 %70, 1
store i32 %71, i32* %16
br label %72
72: ; preds = %69, %55
br label %73
73: ; preds = %72
%74 = load i32, i32* %17
%75 = add nsw i32 %74, 1
store i32 %75, i32* %17
br label %51
76: ; preds = %51
%77 = load i32, i32* %6
%78 = icmp eq i32 %77, 1
br i1 %78, label %79, label %84
79: ; preds = %76
%80 = load i32, i32* %15
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %80)
%82 = load i32, i32* %16
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %82)
br label %84
84: ; preds = %79, %76
%85 = load i32, i32* %16
%86 = load i32, i32* %15
%87 = icmp eq i32 %85, %86
%88 = zext i1 %87 to i64
%89 = select i1 %87, i32 0, i32 1
store i32 %89, i32* %7
%90 = load i32, i32* %7
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %90)
%92 = load i32, i32* %7
store i32 %92, i32* %3
br label %93
93: ; preds = %84, %47
%94 = load i32, i32* %3
ret i32 %94
}

LLVM IR (-O2):
@.str.3 = [4 x i8] c"err\00"
@xdr_int = global i64 0
@RPC_SUCCESS = global i32 0
@.str.7 = [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 3
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32* @clnt_create(i8* %16, i32 %8, i32 1, i8* %9)
%18 = icmp eq i32* %17, null
br i1 %18, label %21, label %19
19: ; preds = %2
%20 = icmp sgt i32 %14, 0
br i1 %20, label %24, label %36
21: ; preds = %2
%22 = call i32 @clnt_pcreateerror(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %41
24: ; preds = %19, %24
%25 = phi i32 [ %34, %24 ], [ 0, %19 ]
%26 = phi i32 [ %33, %24 ], [ 0, %19 ]
%27 = load i64, i64* @xdr_int
%28 = trunc i64 %27 to i32
%29 = call i32 @clnt_call(i32* %17, i32 1, i32 %28, i8* %10, i32 %28, i8* %11, i64 429496729601)
%30 = load i32, i32* @RPC_SUCCESS
%31 = icmp eq i32 %29, %30
%32 = zext i1 %31 to i32
%33 = add nuw nsw i32 %26, %32
%34 = add nuw nsw i32 %25, 1
%35 = icmp eq i32 %34, %14
br i1 %35, label %36, label %24
36: ; preds = %24, %19
%37 = phi i32 [ 0, %19 ], [ %33, %24 ]
%38 = icmp ne i32 %37, %14
%39 = zext i1 %38 to i32
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 %39)
br label %41
41: ; preds = %36, %21
%42 = phi i32 [ 1, %21 ], [ %39, %36 ]
ret i32 %42
}