#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*/ create_file(char *, int /*<<< orphan*/);
int /*<<< orphan*/ err(int, char *);
char *malloc(scalar_t__);
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)
    err(1, "need the path to generation binaries");
  bin_path = argv[1];
  funct = malloc(strlen(bin_path) + 16);
  sprintf(funct, "%s/gencosh", bin_path);
  child = create_file(funct, 0);
  waitpid(child, NULL, 0);
  sprintf(funct, "%s/gensinh", bin_path);
  child = create_file(funct, 0);
  waitpid(child, NULL, 0);
  sprintf(funct, "%s/gentanh", 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     1191 <main+0x31>
mov    $0x1,%edi
lea    0xe74(%rip),%rsi
call   1040 <err@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rdi
add    $0x10,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe60(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1070 <create_file@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe3b(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1070 <create_file@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xe16(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1070 <create_file@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
je     117d <main+0x1d>
lea    0xe8d(%rip),%rsi
mov    $0x1,%edi
call   1040 <err@plt>
mov    0x8(%rbx),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0x10(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe89(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <create_file@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
lea    0xe6d(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <create_file@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
lea    0xe51(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1080 <sprintf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <create_file@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <waitpid@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [37 x i8] c"need the path to generation binaries\00"
@.str.1 = [11 x i8] c"%s/gencosh\00"
@.str.2 = [11 x i8] c"%s/gensinh\00"
@.str.3 = [11 x i8] c"%s/gentanh\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 %13
11: ; preds = %2
%12 = call i32 @err(i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %7
%17 = load i8*, i8** %7
%18 = call i64 @strlen(i8* %17)
%19 = add nsw i64 %18, 16
%20 = call i8* @malloc(i64 %19)
store i8* %20, i8** %6
%21 = load i8*, i8** %6
%22 = load i8*, i8** %7
%23 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = load i8*, i8** %6
%25 = call i32 @create_file(i8* %24, i32 0)
store i32 %25, i32* %8
%26 = load i32, i32* %8
%27 = call i32 @waitpid(i32 %26, i32* null, i32 0)
%28 = load i8*, i8** %6
%29 = load i8*, i8** %7
%30 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = load i8*, i8** %6
%32 = call i32 @create_file(i8* %31, i32 0)
store i32 %32, i32* %8
%33 = load i32, i32* %8
%34 = call i32 @waitpid(i32 %33, i32* null, i32 0)
%35 = load i8*, i8** %6
%36 = load i8*, i8** %7
%37 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %36)
%38 = load i8*, i8** %6
%39 = call i32 @create_file(i8* %38, i32 0)
store i32 %39, i32* %8
%40 = load i32, i32* %8
%41 = call i32 @waitpid(i32 %40, i32* null, i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"need the path to generation binaries\00"
@.str.1 = [11 x i8] c"%s/gencosh\00"
@.str.2 = [11 x i8] c"%s/gensinh\00"
@.str.3 = [11 x i8] c"%s/gentanh\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strlen(i8* dereferenceable(1) %8)
%10 = add nsw i64 %9, 16
%11 = tail call i8* @malloc(i64 %10)
%12 = tail call i32 @sprintf(i8* dereferenceable(1) %11, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%13 = tail call i32 @create_file(i8* %11, i32 0)
%14 = tail call i32 @waitpid(i32 %13, i32* null, i32 0)
%15 = tail call i32 @sprintf(i8* dereferenceable(1) %11, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%16 = tail call i32 @create_file(i8* %11, i32 0)
%17 = tail call i32 @waitpid(i32 %16, i32* null, i32 0)
%18 = tail call i32 @sprintf(i8* dereferenceable(1) %11, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%19 = tail call i32 @create_file(i8* %11, i32 0)
%20 = tail call i32 @waitpid(i32 %19, i32* null, i32 0)
ret i32 0
}