#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*/ exit(int);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int execution(char *cmds, char **cmde, int count) {
  if (!fork()) {
    printf("system: %s\n", cmds);
    exit(9);
  } else {
    int i = 0;
    sleep(3);
    printf("exec: ");
    for (i = 0; i < count; i++)
      printf("%s ", cmde[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<execution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1060 <fork@plt>
cmp    $0x0,%eax
jne    117f <execution+0x3f>
mov    -0x8(%rbp),%rsi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x9,%edi
call   1040 <exit@plt>
movl   $0x0,-0x18(%rbp)
mov    $0x3,%edi
call   1050 <sleep@plt>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11d9 <execution+0x99>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a5 <execution+0x65>
jmp    11de <execution+0x9e>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execution>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%r15
mov    %rdi,%r14
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
je     11b4 <execution+0x74>
mov    $0x3,%edi
call   1050 <sleep@plt>
lea    0xea1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebp,%ebp
jle    11a7 <execution+0x67>
mov    %ebp,%ebp
lea    0xe94(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1190 <execution+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe45(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x9,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"system: %s\0A\00"
@.str.1 = [7 x i8] c"exec: \00"
@.str.2 = [4 x i8] c"%s \00"
define i32 @execution(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%8 = call i32 (...) @fork()
%9 = icmp ne i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 9)
unreachable
14: ; preds = %3
store i32 0, i32* %7
%15 = call i32 @sleep(i32 3)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %7
br label %17
17: ; preds = %28, %14
%18 = load i32, i32* %7
%19 = load i32, i32* %6
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %31
21: ; preds = %17
%22 = load i8**, i8*** %5
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8*, i8** %22, i64 %24
%26 = load i8*, i8** %25
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %26)
br label %28
28: ; preds = %21
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
br label %17
31: ; preds = %17
br label %32
32: ; preds = %31
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"system: %s\0A\00"
@.str.1 = [7 x i8] c"exec: \00"
@.str.2 = [4 x i8] c"%s \00"
define i32 @execution(i8* %0, i8** nocapture %1, i32 %2) {
%4 = tail call i32 (...) @fork()
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i32 @exit(i32 9)
unreachable
9: ; preds = %3
%10 = tail call i32 @sleep(i32 3)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp sgt i32 %2, 0
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = zext i32 %2 to i64
br label %15
15: ; preds = %13, %15
%16 = phi i64 [ 0, %13 ], [ %20, %15 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 %16
%18 = load i8*, i8** %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = add nuw nsw i64 %16, 1
%21 = icmp eq i64 %20, %14
br i1 %21, label %22, label %15
22: ; preds = %15, %9
ret i32 0
}