#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 */
char *find_build_path();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *);
int /*<<< orphan*/ start_child(char *, int, char **);
void start_children(char *prefix, int argc, char *argv[]) {
  char server_name[100];
  char client_name[100];
  char *build_path = find_build_path();
  sprintf(server_name, "%s/%s/%s-%s", build_path, prefix, prefix, "server");
  sprintf(client_name, "%s/%s/%s-%s", build_path, prefix, prefix, "client");
  start_child(server_name, argc, argv);
  start_child(client_name, argc, argv);
  free(build_path);
}


x86 assembly (clang, -O0):
<start_children>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1050 <find_build_path@plt>
mov    %rax,-0xf8(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0xf8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%r8
lea    0xe82(%rip),%rsi
lea    0xe87(%rip),%r9
call   1060 <sprintf@plt>
lea    -0xf0(%rbp),%rdi
mov    -0xf8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%r8
lea    0xe59(%rip),%rsi
lea    0xe65(%rip),%r9
call   1060 <sprintf@plt>
lea    -0x80(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <start_child@plt>
lea    -0xf0(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <start_child@plt>
mov    -0xf8(%rbp),%rdi
call   1030 <free@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_children>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%rbp
xor    %eax,%eax
call   1050 <find_build_path@plt>
mov    %rax,%rbx
lea    0xe95(%rip),%r12
lea    0xe9a(%rip),%r9
mov    %rsp,%rdi
mov    %r12,%rsi
mov    %rax,%rdx
mov    %rbp,%rcx
mov    %rbp,%r8
call   1060 <sprintf@plt>
lea    0xe86(%rip),%r9
lea    0x70(%rsp),%r13
mov    %r13,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
mov    %rbp,%r8
call   1060 <sprintf@plt>
mov    %rsp,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
call   1040 <start_child@plt>
mov    %r13,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
call   1040 <start_child@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%s/%s/%s-%s\00"
@.str.1 = [7 x i8] c"server\00"
@.str.2 = [7 x i8] c"client\00"
define void @start_children(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%10 = call i8* (...) @find_build_path()
store i8* %10, i8** %9
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%12 = load i8*, i8** %9
%13 = load i8*, i8** %4
%14 = load i8*, i8** %4
%15 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13, i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%17 = load i8*, i8** %9
%18 = load i8*, i8** %4
%19 = load i8*, i8** %4
%20 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %18, i8* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%22 = load i32, i32* %5
%23 = load i8**, i8*** %6
%24 = call i32 @start_child(i8* %21, i32 %22, i8** %23)
%25 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%26 = load i32, i32* %5
%27 = load i8**, i8*** %6
%28 = call i32 @start_child(i8* %25, i32 %26, i8** %27)
%29 = load i8*, i8** %9
%30 = call i32 @free(i8* %29)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s/%s/%s-%s\00"
@.str.1 = [7 x i8] c"server\00"
@.str.2 = [7 x i8] c"client\00"
define void @start_children(i8* %0, i32 %1, i8** %2) {
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%8 = tail call i8* (...) @find_build_path()
%9 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %0, i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %0, i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @start_child(i8* %6, i32 %1, i8** %2)
%12 = call i32 @start_child(i8* %7, i32 %1, i8** %2)
%13 = call i32 @free(i8* %8)
ret void
}