#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*/ attack(char *, char *, int);
int /*<<< orphan*/ cycle_identity();
scalar_t__ fork();
int /*<<< orphan*/ getc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  int x;
  if (argc != 3)
    cycle_identity();
  for (x = 0; x != 48; x++) {
    if (fork())
      attack(argv[1], argv[2], x);
    usleep(200000);
  }
  getc(stdin);
  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)
cmpl   $0x3,-0x8(%rbp)
je     1177 <main+0x27>
mov    $0x0,%al
call   1030 <cycle_identity@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x30,-0x14(%rbp)
je     11c9 <main+0x79>
mov    $0x0,%al
call   1060 <fork@plt>
cmp    $0x0,%rax
je     11b1 <main+0x61>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    -0x14(%rbp),%edx
call   1040 <attack@plt>
mov    $0x30d40,%edi
call   1070 <usleep@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117e <main+0x2e>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1162 <main+0x12>
xor    %eax,%eax
call   1030 <cycle_identity@plt>
xor    %ebp,%ebp
jmp    1182 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
mov    $0x30d40,%edi
call   1070 <usleep@plt>
add    $0x1,%ebp
cmp    $0x30,%ebp
je     119f <main+0x4f>
xor    %eax,%eax
call   1060 <fork@plt>
test   %rax,%rax
je     1170 <main+0x20>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
mov    %ebp,%edx
call   1040 <attack@plt>
jmp    1170 <main+0x20>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
call   1050 <getc@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
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 = load i32, i32* %4
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @cycle_identity()
br label %11
11: ; preds = %9, %2
store i32 0, i32* %6
br label %12
12: ; preds = %29, %11
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 48
br i1 %14, label %15, label %32
15: ; preds = %12
%16 = call i64 (...) @fork()
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %27
18: ; preds = %15
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = load i32, i32* %6
%26 = call i32 @attack(i8* %21, i8* %24, i32 %25)
br label %27
27: ; preds = %18, %15
%28 = call i32 @usleep(i32 200000)
br label %29
29: ; preds = %27
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %12
32: ; preds = %12
%33 = load i32, i32* @stdin
%34 = call i32 @getc(i32 %33)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @cycle_identity()
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = getelementptr inbounds i8*, i8** %1, i64 2
br label %9
9: ; preds = %6, %17
%10 = phi i32 [ 0, %6 ], [ %19, %17 ]
%11 = tail call i64 (...) @fork()
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = load i8*, i8** %7
%15 = load i8*, i8** %8
%16 = tail call i32 @attack(i8* %14, i8* %15, i32 %10)
br label %17
17: ; preds = %13, %9
%18 = tail call i32 @usleep(i32 200000)
%19 = add nuw nsw i32 %10, 1
%20 = icmp eq i32 %19, 48
br i1 %20, label %21, label %9
21: ; preds = %17
%22 = load i32, i32* @stdin
%23 = tail call i32 @getc(i32 %22)
ret i32 0
}