#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;
typedef enum clnt_stat { ____Placeholder_clnt_stat } clnt_stat;

/* Variables and functions */
int RPC_SUCCESS;
int atoi(char *);
int callrpc(char *, int, int, int, int /*<<< orphan*/, char *,
            int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ xdr_int;
int main(int argn, char *argc[]) {
  int run_mode = 0;
  int test_status = 1;
  int progNum = atoi(argc[2]);
  enum clnt_stat cs;
  int varSnd = 10;
  int varRec = -1;
  int nbCall = atoi(argc[3]);
  int nbOk = 0;
  int i;
  if (run_mode == 1) {
    printf("progNum : %d\n", progNum);
  }
  for (i = 0; i < nbCall; i++) {
    cs = callrpc(argc[1], progNum, 1, 1, (xdrproc_t)xdr_int, (char *)&varSnd,
                 (xdrproc_t)xdr_int, (char *)&varRec);
    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    $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   1040 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movl   $0xa,-0x24(%rbp)
movl   $0xffffffff,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    11a2 <main+0x72>
mov    -0x1c(%rbp),%esi
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1228 <main+0xf8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x1c(%rbp),%esi
mov    0x2e21(%rip),%rax
mov    (%rax),%rax
mov    %eax,%r8d
lea    -0x24(%rbp),%r9
mov    0x2e10(%rip),%rax
mov    (%rax),%rax
mov    %eax,%r10d
lea    -0x28(%rbp),%rax
mov    $0x1,%ecx
mov    %ecx,%edx
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <callrpc@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    0x2ddc(%rip),%rcx
cmp    (%rcx),%eax
jne    1215 <main+0xe5>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    121a <main+0xea>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11a9 <main+0x79>
cmpl   $0x1,-0x14(%rbp)
jne    1250 <main+0x120>
mov    -0x2c(%rbp),%esi
lea    0xdd2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%esi
lea    0xdcf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%esi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xda7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    0x10(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%r12d
movl   $0xa,0x14(%rsp)
movl   $0xffffffff,0x10(%rsp)
ff
mov    0x18(%rbx),%rdi
call   1040 <atoi@plt>
test   %eax,%eax
mov    %eax,0xc(%rsp)
jle    11c2 <main+0x92>
xor    %ebp,%ebp
lea    0x14(%rsp),%r15
mov    0x2e64(%rip),%r13
mov    %eax,%r14d
nop
mov    0x8(%rbx),%rdi
mov    0x2e5d(%rip),%rax
mov    (%rax),%r8d
mov    %r12d,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
mov    %r15,%r9
lea    0x10(%rsp),%rax
push   %rax
push   %r8
call   1050 <callrpc@plt>
add    $0x10,%rsp
xor    %ecx,%ecx
cmp    0x0(%r13),%eax
sete   %cl
add    %ecx,%ebp
add    $0xffffffff,%r14d
jne    1180 <main+0x50>
jmp    11c4 <main+0x94>
xor    %ebp,%ebp
xor    %ebx,%ebx
cmp    0xc(%rsp),%ebp
setne  %bl
lea    0xe2c(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"progNum : %d\0A\00"
@xdr_int = global i64 0
@RPC_SUCCESS = global i32 0
@.str.1 = [12 x i8] c"Aimed : %d\0A\00"
@.str.2 = [10 x i8] c"Got : %d\0A\00"
@.str.3 = [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 i32
%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
store i32 10, i32* %10
store i32 -1, i32* %11
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 3
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %12
store i32 0, i32* %13
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %28
25: ; preds = %2
%26 = load i32, i32* %8
%27 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %2
store i32 0, i32* %14
br label %29
29: ; preds = %52, %28
%30 = load i32, i32* %14
%31 = load i32, i32* %12
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %55
33: ; preds = %29
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = load i32, i32* %8
%38 = load i64, i64* @xdr_int
%39 = trunc i64 %38 to i32
%40 = bitcast i32* %10 to i8*
%41 = load i64, i64* @xdr_int
%42 = trunc i64 %41 to i32
%43 = bitcast i32* %11 to i8*
%44 = call i32 @callrpc(i8* %36, i32 %37, i32 1, i32 1, i32 %39, i8* %40, i32 %42, i8* %43)
store i32 %44, i32* %9
%45 = load i32, i32* %9
%46 = load i32, i32* @RPC_SUCCESS
%47 = icmp eq i32 %45, %46
br i1 %47, label %48, label %51
48: ; preds = %33
%49 = load i32, i32* %13
%50 = add nsw i32 %49, 1
store i32 %50, i32* %13
br label %51
51: ; preds = %48, %33
br label %52
52: ; preds = %51
%53 = load i32, i32* %14
%54 = add nsw i32 %53, 1
store i32 %54, i32* %14
br label %29
55: ; preds = %29
%56 = load i32, i32* %6
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %63
58: ; preds = %55
%59 = load i32, i32* %12
%60 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %13
%62 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %58, %55
%64 = load i32, i32* %13
%65 = load i32, i32* %12
%66 = icmp eq i32 %64, %65
%67 = zext i1 %66 to i64
%68 = select i1 %66, i32 0, i32 1
store i32 %68, i32* %7
%69 = load i32, i32* %7
%70 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %7
ret i32 %71
}

LLVM IR (-O2):
@xdr_int = global i64 0
@RPC_SUCCESS = global i32 0
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%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 i32* %3 to i8*
store i32 10, i32* %3
%9 = bitcast i32* %4 to i8*
store i32 -1, i32* %4
%10 = getelementptr inbounds i8*, i8** %1, i64 3
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %29
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
br label %16
16: ; preds = %14, %16
%17 = phi i32 [ 0, %14 ], [ %27, %16 ]
%18 = phi i32 [ 0, %14 ], [ %26, %16 ]
%19 = load i8*, i8** %15
%20 = load i64, i64* @xdr_int
%21 = trunc i64 %20 to i32
%22 = call i32 @callrpc(i8* %19, i32 %7, i32 1, i32 1, i32 %21, i8* %8, i32 %21, i8* %9)
%23 = load i32, i32* @RPC_SUCCESS
%24 = icmp eq i32 %22, %23
%25 = zext i1 %24 to i32
%26 = add nuw nsw i32 %18, %25
%27 = add nuw nsw i32 %17, 1
%28 = icmp eq i32 %27, %12
br i1 %28, label %29, label %16
29: ; preds = %16, %2
%30 = phi i32 [ 0, %2 ], [ %26, %16 ]
%31 = icmp ne i32 %30, %12
%32 = zext i1 %31 to i32
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %32)
ret i32 %32
}