#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*/ abort();
int /*<<< orphan*/ create_file(char *, int /*<<< orphan*/);
char *malloc(scalar_t__);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ waitpid(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  char *funct, *bin_path;
  pid_t child;
  if (argc != 2) {
    printf("ERROR: need the path to generation binaries\n");
    abort();
  }
  bin_path = argv[1];
  funct = malloc(strlen(bin_path) + 16);
  sprintf(funct, "%s/gencos", bin_path);
  child = create_file(funct, 0);
  waitpid(child, NULL, 0);
  sprintf(funct, "%s/gensin", bin_path);
  child = create_file(funct, 0);
  waitpid(child, NULL, 0);
  sprintf(funct, "%s/gentan", bin_path);
  child = create_file(funct, 0);
  waitpid(child, NULL, 0);
  sprintf(funct, "%s/genatan", bin_path);
  child = create_file(funct, 0);
  waitpid(child, NULL, 0);
  sprintf(funct, "%s/genatan2", bin_path);
  child = create_file(funct, 0);
  waitpid(child, NULL, 0);
  sprintf(funct, "%s/genacos", bin_path);
  child = create_file(funct, 0);
  waitpid(child, NULL, 0);
  sprintf(funct, "%s/genasin", bin_path);
  child = create_file(funct, 0);
  waitpid(child, NULL, 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11a3 <main+0x33>
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x10,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe56(%rip),%rsi
call   1090 <sprintf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe30(%rip),%rsi
call   1090 <sprintf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe0a(%rip),%rsi
call   1090 <sprintf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xde4(%rip),%rsi
call   1090 <sprintf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xdbf(%rip),%rsi
call   1090 <sprintf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd9b(%rip),%rsi
call   1090 <sprintf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd76(%rip),%rsi
call   1090 <sprintf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    12b0 <main+0x140>
mov    0x8(%rsi),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x10(%rax),%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe64(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
lea    0xe47(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
lea    0xe2a(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
lea    0xe0d(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
lea    0xdf1(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
lea    0xdd6(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
lea    0xdba(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1090 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <create_file@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <waitpid@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xd94(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"ERROR: need the path to generation binaries\0A\00"
@.str.1 = [10 x i8] c"%s/gencos\00"
@.str.2 = [10 x i8] c"%s/gensin\00"
@.str.3 = [10 x i8] c"%s/gentan\00"
@.str.4 = [11 x i8] c"%s/genatan\00"
@.str.5 = [12 x i8] c"%s/genatan2\00"
@.str.6 = [11 x i8] c"%s/genacos\00"
@.str.7 = [11 x i8] c"%s/genasin\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
store i8* %17, i8** %7
%18 = load i8*, i8** %7
%19 = call i64 @strlen(i8* %18)
%20 = add nsw i64 %19, 16
%21 = call i8* @malloc(i64 %20)
store i8* %21, i8** %6
%22 = load i8*, i8** %6
%23 = load i8*, i8** %7
%24 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = load i8*, i8** %6
%26 = call i32 @create_file(i8* %25, i32 0)
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = call i32 @waitpid(i32 %27, i32* null, i32 0)
%29 = load i8*, i8** %6
%30 = load i8*, i8** %7
%31 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = load i8*, i8** %6
%33 = call i32 @create_file(i8* %32, i32 0)
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = call i32 @waitpid(i32 %34, i32* null, i32 0)
%36 = load i8*, i8** %6
%37 = load i8*, i8** %7
%38 = call i32 @sprintf(i8* %36, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %37)
%39 = load i8*, i8** %6
%40 = call i32 @create_file(i8* %39, i32 0)
store i32 %40, i32* %8
%41 = load i32, i32* %8
%42 = call i32 @waitpid(i32 %41, i32* null, i32 0)
%43 = load i8*, i8** %6
%44 = load i8*, i8** %7
%45 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %44)
%46 = load i8*, i8** %6
%47 = call i32 @create_file(i8* %46, i32 0)
store i32 %47, i32* %8
%48 = load i32, i32* %8
%49 = call i32 @waitpid(i32 %48, i32* null, i32 0)
%50 = load i8*, i8** %6
%51 = load i8*, i8** %7
%52 = call i32 @sprintf(i8* %50, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %51)
%53 = load i8*, i8** %6
%54 = call i32 @create_file(i8* %53, i32 0)
store i32 %54, i32* %8
%55 = load i32, i32* %8
%56 = call i32 @waitpid(i32 %55, i32* null, i32 0)
%57 = load i8*, i8** %6
%58 = load i8*, i8** %7
%59 = call i32 @sprintf(i8* %57, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %58)
%60 = load i8*, i8** %6
%61 = call i32 @create_file(i8* %60, i32 0)
store i32 %61, i32* %8
%62 = load i32, i32* %8
%63 = call i32 @waitpid(i32 %62, i32* null, i32 0)
%64 = load i8*, i8** %6
%65 = load i8*, i8** %7
%66 = call i32 @sprintf(i8* %64, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %65)
%67 = load i8*, i8** %6
%68 = call i32 @create_file(i8* %67, i32 0)
store i32 %68, i32* %8
%69 = load i32, i32* %8
%70 = call i32 @waitpid(i32 %69, i32* null, i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"%s/gencos\00"
@.str.2 = [10 x i8] c"%s/gensin\00"
@.str.3 = [10 x i8] c"%s/gentan\00"
@.str.4 = [11 x i8] c"%s/genatan\00"
@.str.5 = [12 x i8] c"%s/genatan2\00"
@.str.6 = [11 x i8] c"%s/genacos\00"
@.str.7 = [11 x i8] c"%s/genasin\00"
@str = [44 x i8] c"ERROR: need the path to generation binaries\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @strlen(i8* dereferenceable(1) %9)
%11 = add nsw i64 %10, 16
%12 = tail call i8* @malloc(i64 %11)
%13 = tail call i32 @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%14 = tail call i32 @create_file(i8* %12, i32 0)
%15 = tail call i32 @waitpid(i32 %14, i32* null, i32 0)
%16 = tail call i32 @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%17 = tail call i32 @create_file(i8* %12, i32 0)
%18 = tail call i32 @waitpid(i32 %17, i32* null, i32 0)
%19 = tail call i32 @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%20 = tail call i32 @create_file(i8* %12, i32 0)
%21 = tail call i32 @waitpid(i32 %20, i32* null, i32 0)
%22 = tail call i32 @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %9)
%23 = tail call i32 @create_file(i8* %12, i32 0)
%24 = tail call i32 @waitpid(i32 %23, i32* null, i32 0)
%25 = tail call i32 @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%26 = tail call i32 @create_file(i8* %12, i32 0)
%27 = tail call i32 @waitpid(i32 %26, i32* null, i32 0)
%28 = tail call i32 @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %9)
%29 = tail call i32 @create_file(i8* %12, i32 0)
%30 = tail call i32 @waitpid(i32 %29, i32* null, i32 0)
%31 = tail call i32 @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i8* %9)
%32 = tail call i32 @create_file(i8* %12, i32 0)
%33 = tail call i32 @waitpid(i32 %32, i32* null, i32 0)
ret i32 0
}