#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*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ WUNTRACED;
char *find_build_path();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *);
int /*<<< orphan*/ start_child(char *, int, char **);
int /*<<< orphan*/ waitpid(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
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");
  pid_t c1_id = start_child(server_name, argc, argv);
  pid_t c2_id = start_child(client_name, argc, argv);
  waitpid(c1_id, NULL, WUNTRACED);
  waitpid(c2_id, NULL, WUNTRACED);
  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    0xe72(%rip),%rsi
lea    0xe77(%rip),%r9
call   1070 <sprintf@plt>
lea    -0xf0(%rbp),%rdi
mov    -0xf8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%r8
lea    0xe49(%rip),%rsi
lea    0xe55(%rip),%r9
call   1070 <sprintf@plt>
lea    -0x80(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <start_child@plt>
mov    %eax,-0xfc(%rbp)
lea    -0xf0(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1040 <start_child@plt>
mov    %eax,-0x100(%rbp)
mov    -0xfc(%rbp),%edi
mov    0x2de1(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1060 <waitpid@plt>
mov    -0x100(%rbp),%edi
mov    0x2dc9(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1060 <waitpid@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,%r13
lea    0xe85(%rip),%r12
lea    0xe8a(%rip),%r9
mov    %rsp,%rdi
mov    %r12,%rsi
mov    %rax,%rdx
mov    %rbp,%rcx
mov    %rbp,%r8
call   1070 <sprintf@plt>
lea    0xe76(%rip),%r9
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    %rbp,%rcx
mov    %rbp,%r8
call   1070 <sprintf@plt>
mov    %rsp,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
call   1040 <start_child@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r15d,%esi
mov    %r14,%rdx
call   1040 <start_child@plt>
mov    %eax,%ebx
mov    0x2e03(%rip),%r14
mov    (%r14),%edx
mov    %ebp,%edi
xor    %esi,%esi
call   1060 <waitpid@plt>
mov    (%r14),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1060 <waitpid@plt>
mov    %r13,%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"
@WUNTRACED = global i32 0
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*
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%12 = call i8* (...) @find_build_path()
store i8* %12, i8** %9
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%14 = load i8*, i8** %9
%15 = load i8*, i8** %4
%16 = load i8*, i8** %4
%17 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15, i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%19 = load i8*, i8** %9
%20 = load i8*, i8** %4
%21 = load i8*, i8** %4
%22 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %20, i8* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%24 = load i32, i32* %5
%25 = load i8**, i8*** %6
%26 = call i32 @start_child(i8* %23, i32 %24, i8** %25)
store i32 %26, i32* %10
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%28 = load i32, i32* %5
%29 = load i8**, i8*** %6
%30 = call i32 @start_child(i8* %27, i32 %28, i8** %29)
store i32 %30, i32* %11
%31 = load i32, i32* %10
%32 = load i32, i32* @WUNTRACED
%33 = call i32 @waitpid(i32 %31, i32* null, i32 %32)
%34 = load i32, i32* %11
%35 = load i32, i32* @WUNTRACED
%36 = call i32 @waitpid(i32 %34, i32* null, i32 %35)
%37 = load i8*, i8** %9
%38 = call i32 @free(i8* %37)
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"
@WUNTRACED = global i32 0
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 = load i32, i32* @WUNTRACED
%14 = call i32 @waitpid(i32 %11, i32* null, i32 %13)
%15 = load i32, i32* @WUNTRACED
%16 = call i32 @waitpid(i32 %12, i32* null, i32 %15)
%17 = call i32 @free(i8* %8)
ret void
}