#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 int /*<<< orphan*/ path;

/* Variables and functions */
scalar_t__ execl(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int fork();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
int procmgrStartUpProcess(char *bin_name, char *name) {
  int pid = 0;
  char path[50];
  printf("Ready to startup process %s\r\n", name);
  snprintf(path, sizeof(path), "%s/%s", "/easylinux/app/bin", bin_name);
  pid = fork();
  if (pid == 0) {
    if (execl(path, NULL) < 0) {
      printf("execl process error\r\n");
      exit(-1);
    }
    exit(0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<procmgrStartUpProcess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%r8
mov    $0x32,%esi
lea    0xe91(%rip),%rdx
lea    0xe90(%rip),%rcx
call   1040 <snprintf@plt>
mov    $0x0,%al
call   1070 <fork@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11e3 <procmgrStartUpProcess+0x93>
lea    -0x50(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1060 <execl@plt>
cmp    $0x0,%rax
jge    11dc <procmgrStartUpProcess+0x8c>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<procmgrStartUpProcess>:
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
lea    0xe91(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea1(%rip),%rdx
lea    0xea0(%rip),%rcx
mov    %rsp,%rdi
mov    $0x32,%esi
mov    %rbx,%r8
call   1050 <snprintf@plt>
xor    %eax,%eax
call   1080 <fork@plt>
test   %eax,%eax
je     11a7 <procmgrStartUpProcess+0x47>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret
mov    %rsp,%rdi
xor    %esi,%esi
call   1070 <execl@plt>
test   %rax,%rax
jns    11cc <procmgrStartUpProcess+0x6c>
lea    0xe7a(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Ready to startup process %s\0D\0A\00"
@.str.1 = [6 x i8] c"%s/%s\00"
@.str.2 = [19 x i8] c"/easylinux/app/bin\00"
@.str.3 = [22 x i8] c"execl process error\0D\0A\00"
define i32 @procmgrStartUpProcess(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [50 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%7 = load i8*, i8** %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%10 = load i8*, i8** %3
%11 = call i32 @snprintf(i8* %9, i32 50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%12 = call i32 (...) @fork()
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %2
%16 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%17 = call i64 @execl(i8* %16, i32* null)
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @exit(i32 -1)
unreachable
22: ; preds = %15
%23 = call i32 @exit(i32 0)
unreachable
24: ; preds = %2
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Ready to startup process %s\0D\0A\00"
@.str.1 = [6 x i8] c"%s/%s\00"
@.str.2 = [19 x i8] c"/easylinux/app/bin\00"
@str = [21 x i8] c"execl process error\0D\00"
define i32 @procmgrStartUpProcess(i8* %0, i8* %1) {
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* %1)
%6 = call i32 @snprintf(i8* %4, i32 50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%7 = call i32 (...) @fork()
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = call i64 @execl(i8* %4, i32* null)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %9
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %2
ret i32 0
}