#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 **calloc(int, int);
int /*<<< orphan*/ err(int, char *);
char **args_for_file(char *path) {
  char **pianoteq_args;
  if (!(pianoteq_args = calloc(6, sizeof(char **))))
    err(1, "malloc failed");
  pianoteq_args[1] = "--midi";
  pianoteq_args[2] = path;
  pianoteq_args[3] = "--headless";
  pianoteq_args[4] = "--play-and-quit";
  pianoteq_args[5] = (char *)NULL;
  return pianoteq_args;
}


x86 assembly (clang, -O0):
<args_for_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x6,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    115a <args_for_file+0x3a>
mov    $0x1,%edi
lea    0xeab(%rip),%rsi
call   1040 <err@plt>
mov    -0x10(%rbp),%rax
lea    0xea9(%rip),%rcx
mov    %rcx,0x8(%rax)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x10(%rbp),%rax
lea    0xe95(%rip),%rcx
mov    %rcx,0x18(%rax)
mov    -0x10(%rbp),%rax
lea    0xe91(%rip),%rcx
mov    %rcx,0x20(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x28(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<args_for_file>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x6,%edi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114f <args_for_file+0x2f>
lea    0xebb(%rip),%rsi
mov    $0x1,%edi
call   1040 <err@plt>
lea    0xeb8(%rip),%rax
mov    %rax,0x8(%rbx)
mov    %r14,0x10(%rbx)
lea    0xeb0(%rip),%rax
mov    %rax,0x18(%rbx)
lea    0xeb0(%rip),%rax
mov    %rax,0x20(%rbx)
movq   $0x0,0x28(%rbx)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"malloc failed\00"
@.str.1 = [7 x i8] c"--midi\00"
@.str.2 = [11 x i8] c"--headless\00"
@.str.3 = [16 x i8] c"--play-and-quit\00"
define i8** @args_for_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i8**
store i8* %0, i8** %2
%4 = call i8** @calloc(i32 6, i32 8)
store i8** %4, i8*** %3
%5 = icmp ne i8** %4, null
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 @err(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i8**, i8*** %3
%10 = getelementptr inbounds i8*, i8** %9, i64 1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %10
%11 = load i8*, i8** %2
%12 = load i8**, i8*** %3
%13 = getelementptr inbounds i8*, i8** %12, i64 2
store i8* %11, i8** %13
%14 = load i8**, i8*** %3
%15 = getelementptr inbounds i8*, i8** %14, i64 3
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %15
%16 = load i8**, i8*** %3
%17 = getelementptr inbounds i8*, i8** %16, i64 4
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %17
%18 = load i8**, i8*** %3
%19 = getelementptr inbounds i8*, i8** %18, i64 5
store i8* null, i8** %19
%20 = load i8**, i8*** %3
ret i8** %20
}

LLVM IR (-O2):
@.str = [14 x i8] c"malloc failed\00"
@.str.1 = [7 x i8] c"--midi\00"
@.str.2 = [11 x i8] c"--headless\00"
@.str.3 = [16 x i8] c"--play-and-quit\00"
define noalias i8** @args_for_file(i8* %0) {
%2 = tail call i8** @calloc(i32 6, i32 8)
%3 = icmp eq i8** %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = getelementptr inbounds i8*, i8** %2, i64 1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds i8*, i8** %2, i64 2
store i8* %0, i8** %8
%9 = getelementptr inbounds i8*, i8** %2, i64 3
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %9
%10 = getelementptr inbounds i8*, i8** %2, i64 4
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds i8*, i8** %2, i64 5
store i8* null, i8** %11
ret i8** %2
}