#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*/ CLIENT;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ *clnt_create(char *, int, int, char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argn, char *argc[]) {
  int run_mode = 0;
  int test_status = 1;
  int progNum = atoi(argc[2]);
  char proto[8] = "tcp";
  CLIENT *clnt = NULL;
  int nbCall = atoi(argc[3]);
  int nbOk = 0;
  int i;
  for (i = 0; i < nbCall; i++) {
    clnt = clnt_create(argc[1], progNum, 1, proto);
    if (clnt != NULL)
      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    $0x40,%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   1050 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    0xe95(%rip),%rax
mov    %rax,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11e5 <main+0xb5>
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)
cmpq   $0x0,-0x30(%rbp)
je     11d2 <main+0xa2>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11d7 <main+0xa7>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1195 <main+0x65>
cmpl   $0x1,-0x14(%rbp)
jne    120d <main+0xdd>
mov    -0x34(%rbp),%esi
lea    0xe0f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%esi
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%edx
mov    -0x34(%rbp),%esi
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xde4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    0x10(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%r12d
movq   $0x706374,(%rsp)
mov    0x18(%r13),%rdi
call   1050 <atoi@plt>
mov    %eax,%r14d
xor    %ebp,%ebp
test   %eax,%eax
jle    1190 <main+0x60>
mov    %rsp,%r15
mov    %r14d,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x8(%r13),%rdi
mov    %r12d,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1040 <clnt_create@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
add    $0xffffffff,%ebx
jne    1170 <main+0x40>
xor    %ebx,%ebx
cmp    %r14d,%ebp
setne  %bl
lea    0xe61(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.proto = [8 x i8] c"tcp\00\00\00\00\00"
@.str = [12 x i8] c"Aimed : %d\0A\00"
@.str.1 = [10 x i8] c"Got : %d\0A\00"
@.str.2 = [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 i32
%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
%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* %11
store i32 0, i32* %12
store i32 0, i32* %13
br label %23
23: ; preds = %40, %2
%24 = load i32, i32* %13
%25 = load i32, i32* %11
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %43
27: ; preds = %23
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = load i32, i32* %8
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 0
%33 = call i32* @clnt_create(i8* %30, i32 %31, i32 1, i8* %32)
store i32* %33, i32** %10
%34 = load i32*, i32** %10
%35 = icmp ne i32* %34, null
br i1 %35, label %36, label %39
36: ; preds = %27
%37 = load i32, i32* %12
%38 = add nsw i32 %37, 1
store i32 %38, i32* %12
br label %39
39: ; preds = %36, %27
br label %40
40: ; preds = %39
%41 = load i32, i32* %13
%42 = add nsw i32 %41, 1
store i32 %42, i32* %13
br label %23
43: ; preds = %23
%44 = load i32, i32* %6
%45 = icmp eq i32 %44, 1
br i1 %45, label %46, label %51
46: ; preds = %43
%47 = load i32, i32* %11
%48 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %12
%50 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %46, %43
%52 = load i32, i32* %12
%53 = load i32, i32* %11
%54 = icmp eq i32 %52, %53
%55 = zext i1 %54 to i64
%56 = select i1 %54, i32 0, i32 1
store i32 %56, i32* %7
%57 = load i32, i32* %7
%58 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %57)
%59 = load i32, i32* %7
ret i32 %59
}

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