#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*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ wfa_print(char *, char *);
void *startControlAgent(void *commandLine) {
  char sCommand[1024];
  sprintf(sCommand, "%s", (char *)commandLine);
  wfa_print("\n Starting Control Agent -  %s ", sCommand);
  while (1) {
    system(sCommand);
    sleep(10);
    wfa_print("\n Restarting Control Agent -  %s", sCommand);
  }
}


x86 assembly (clang, -O0):
<startControlAgent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xedd(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1030 <wfa_print@plt>
lea    -0x410(%rbp),%rdi
call   1040 <system@plt>
mov    $0xa,%edi
call   1060 <sleep@plt>
lea    -0x410(%rbp),%rsi
lea    0xe83(%rip),%rdi
call   1030 <wfa_print@plt>
jmp    1179 <startControlAgent+0x39>

x86 assembly (clang, -O2):
<startControlAgent>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xea1(%rip),%rdi
mov    %rbx,%rsi
call   1040 <wfa_print@plt>
lea    0xeb2(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1050 <system@plt>
mov    $0xa,%edi
call   1060 <sleep@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <wfa_print@plt>
jmp    1170 <startControlAgent+0x30>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [32 x i8] c"\0A Starting Control Agent - %s \00"
@.str.2 = [33 x i8] c"\0A Restarting Control Agent - %s\00"
define i8* @startControlAgent(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = load i8*, i8** %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = call i32 @wfa_print(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %9
9: ; preds = %1, %9
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = call i32 @system(i8* %10)
%12 = call i32 @sleep(i32 10)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%14 = call i32 @wfa_print(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %9
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"\0A Starting Control Agent - %s \00"
@.str.2 = [33 x i8] c"\0A Restarting Control Agent - %s\00"
define noalias i8* @startControlAgent(i8* nocapture %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i8* @strcpy(i8* %3, i8* dereferenceable(1) %0)
%5 = call i32 @wfa_print(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %6
6: ; preds = %6, %1
%7 = call i32 @system(i8* %3)
%8 = call i32 @sleep(i32 10)
%9 = call i32 @wfa_print(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %3)
br label %6
}