#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 scalar_t__ pid_t;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  int count = atoi(argv[1]), i;
  for (i = 0; i < count; i++) {
    pid_t pid = fork();
    if (pid == 0) {
      system("gnome-terminal -x bash -c 'ulimit -n 1000000;cd "
             "/home/lee/server/skynet;./3rd/lua/lua "
             "./gameclient/test_presure.lua'");
      exit(0);
    }
    sleep(2);
  }
  exit(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    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ca <main+0x7a>
mov    $0x0,%al
call   1070 <fork@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11b2 <main+0x62>
lea    0xe5a(%rip),%rdi
call   1030 <system@plt>
xor    %edi,%edi
call   1050 <exit@plt>
mov    $0x2,%edi
call   1060 <sleep@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117d <main+0x2d>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
test   %eax,%eax
jle    117b <main+0x2b>
mov    %eax,%ebx
xor    %eax,%eax
call   1070 <fork@plt>
test   %rax,%rax
je     1182 <main+0x32>
mov    $0x2,%edi
call   1060 <sleep@plt>
add    $0xffffffff,%ebx
jne    1160 <main+0x10>
xor    %edi,%edi
call   1050 <exit@plt>
lea    0xe77(%rip),%rdi
call   1030 <system@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [117 x i8] c"gnome-terminal -x bash -c 'ulimit -n 1000000;cd /home/lee/server/skynet;./3rd/lua/lua ./gameclient/test_presure.lua'\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 i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @atoi(i8* %11)
store i32 %12, i32* %6
store i32 0, i32* %7
br label %13
13: ; preds = %26, %2
%14 = load i32, i32* %7
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %29
17: ; preds = %13
%18 = call i64 (...) @fork()
store i64 %18, i64* %8
%19 = load i64, i64* %8
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = call i32 @system(i8* getelementptr inbounds ([117 x i8], [117 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %17
%25 = call i32 @sleep(i32 2)
br label %26
26: ; preds = %24
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %13
29: ; preds = %13
%30 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [117 x i8] c"gnome-terminal -x bash -c 'ulimit -n 1000000;cd /home/lee/server/skynet;./3rd/lua/lua ./gameclient/test_presure.lua'\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %2, %14
%8 = phi i32 [ %16, %14 ], [ 0, %2 ]
%9 = tail call i64 (...) @fork()
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = tail call i32 @system(i8* getelementptr inbounds ([117 x i8], [117 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 0)
unreachable
14: ; preds = %7
%15 = tail call i32 @sleep(i32 2)
%16 = add nuw nsw i32 %8, 1
%17 = icmp eq i32 %16, %5
br i1 %17, label %18, label %7
18: ; preds = %14, %2
%19 = tail call i32 @exit(i32 0)
unreachable
}