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

/* Variables and functions */
int /*<<< orphan*/ close_connect();
scalar_t__ connect_server();
scalar_t__ execte_request(char *);
int main(int argc, char *argv[]) {
  int i;
  if (connect_server() < 0) {
    return 0;
  }
  for (i = 1; i < argc; i++) {
    if (execte_request(argv[i] + 2) < 0) {
      break;
    }
  }
  close_connect();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <connect_server@plt>
cmp    $0x0,%rax
jge    1163 <main+0x33>
movl   $0x0,-0x4(%rbp)
jmp    11bb <main+0x8b>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ad <main+0x7d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x2,%rdi
call   1050 <execte_request@plt>
cmp    $0x0,%rax
jge    119a <main+0x6a>
jmp    11ad <main+0x7d>
jmp    119f <main+0x6f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116a <main+0x3a>
mov    $0x0,%al
call   1030 <close_connect@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <connect_server@plt>
test   %rax,%rax
js     1186 <main+0x56>
cmp    $0x2,%ebp
jl     117f <main+0x4f>
mov    %ebp,%ebp
mov    $0x2,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    -0x8(%r14,%rbx,8),%rdi
add    $0x2,%rdi
call   1050 <execte_request@plt>
test   %rax,%rax
js     117f <main+0x4f>
lea    0x1(%rbx),%rax
cmp    %rbp,%rbx
mov    %rax,%rbx
jb     1160 <main+0x30>
xor    %eax,%eax
call   1030 <close_connect@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 (...) @connect_server()
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 0, i32* %3
br label %31
10: ; preds = %2
store i32 1, i32* %6
br label %11
11: ; preds = %26, %10
%12 = load i32, i32* %6
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = load i8**, i8*** %5
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = getelementptr inbounds i8, i8* %20, i64 2
%22 = call i64 @execte_request(i8* %21)
%23 = icmp slt i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %15
br label %29
25: ; preds = %15
br label %26
26: ; preds = %25
%27 = load i32, i32* %6
%28 = add nsw i32 %27, 1
store i32 %28, i32* %6
br label %11
29: ; preds = %24, %11
%30 = call i32 (...) @close_connect()
store i32 0, i32* %3
br label %31
31: ; preds = %29, %9
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 (...) @connect_server()
%4 = icmp slt i64 %3, 0
br i1 %4, label %21, label %5
5: ; preds = %2
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %19
7: ; preds = %5
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %9, %7
%10 = phi i64 [ %16, %9 ], [ 1, %7 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8, i8* %12, i64 2
%14 = tail call i64 @execte_request(i8* %13)
%15 = icmp sgt i64 %14, -1
%16 = add nuw nsw i64 %10, 1
%17 = icmp ult i64 %16, %8
%18 = select i1 %15, i1 %17, i1 false
br i1 %18, label %9, label %19
19: ; preds = %9, %5
%20 = tail call i32 (...) @close_connect()
br label %21
21: ; preds = %2, %19
ret i32 0
}