#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*/ create_thread(int);
int /*<<< orphan*/ system(char *);
int main(int argc, char **argv) {
  int ret = 0;
  char cmd_buf[50] = {0x00};
  int i;
  ;
  ;
  ;
  system(cmd_buf);
  for (i = 0; i < 3; ++i) {
    create_thread(i + 1);
    system(cmd_buf);
  }
exit:;
  return ret;
}


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)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1040 <memset@plt>
lea    -0x50(%rbp),%rdi
call   1030 <system@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x3,-0x54(%rbp)
jge    1199 <main+0x69>
mov    -0x54(%rbp),%edi
add    $0x1,%edi
call   1050 <create_thread@plt>
lea    -0x50(%rbp),%rdi
call   1030 <system@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    116d <main+0x3d>
jmp    119e <main+0x6e>
mov    -0x14(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movw   $0x0,0x30(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <system@plt>
mov    $0x1,%edi
call   1040 <create_thread@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    $0x2,%edi
call   1040 <create_thread@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    $0x3,%edi
call   1040 <create_thread@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [50 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%9 = bitcast [50 x i8]* %7 to i8*
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%11 = call i32 @system(i8* %10)
store i32 0, i32* %8
br label %12
12: ; preds = %21, %2
%13 = load i32, i32* %8
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %24
15: ; preds = %12
%16 = load i32, i32* %8
%17 = add nsw i32 %16, 1
%18 = call i32 @create_thread(i32 %17)
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%20 = call i32 @system(i8* %19)
br label %21
21: ; preds = %15
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
store i32 %23, i32* %8
br label %12
24: ; preds = %12
br label %25
25: ; preds = %24
%26 = load i32, i32* %6
ret i32 %26
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%5 = call i32 @system(i8* %4)
%6 = tail call i32 @create_thread(i32 1)
%7 = call i32 @system(i8* %4)
%8 = tail call i32 @create_thread(i32 2)
%9 = call i32 @system(i8* %4)
%10 = tail call i32 @create_thread(i32 3)
%11 = call i32 @system(i8* %4)
ret i32 0
}