#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*/ buf3;
typedef int /*<<< orphan*/ buf1;

/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int atoi(char *);
int /*<<< orphan*/ execl(char *, char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fork();
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ mycpy(char *, char *);
int /*<<< orphan*/ mylog(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, char *, int, char *, char *, char *, char *,
                          char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  char buf1[16];
  char buf2[16];
  char buf3[16];
  char *buf4;
  char *buf5;
  char buf6[16];
  char *buf7;
  int i, len;
  if (argc != 12)
    exit(0);
  strncpy(buf1, argv[1], sizeof(buf1));
  len = atoi(argv[2]);
  if (len < 16)
    memcpy(buf2, argv[3], len);
  else {
    char *buf = malloc(len + 20);
    if (buf) {
      snprintf(buf, len + 20, "String too long: %s", argv[3]);
      mylog(LOG_ERR, buf);
    }
  }
  mycpy(buf3, argv[4]);
  strncat(buf3, argv[5], sizeof(buf3) - 1);
  if (fork()) {
    execl("/bin/ls", "/bin/ls", argv[6], 0);
  }
  char *p;
  if (p = strchr(argv[7], '&'))
    *p = 0;
  if (p = strchr(argv[7], '`'))
    *p = 0;
  if (p = strchr(argv[7], ';'))
    *p = 0;
  if (p = strchr(argv[7], '|'))
    *p = 0;
  if (strlen(argv[7]) < 1024) {
    buf4 = malloc(20 + strlen(argv[7]));
    sprintf(buf4, "/bin/cat %s", argv[7]);
    system(buf4);
  }
  buf5 = malloc(strlen(argv[8]) + strlen(argv[9]) + 2);
  strcpy(buf5, argv[8]);
  strcat(buf5, argv[9]);
  memcpy(buf6, argv[10], strlen(argv[10]));
  buf7 = malloc(4 * 2 + 2);
  for (i = 0; i < 4; i++) {
    memcpy(buf7 + 4 * i, argv[11] + 4 * i, 2 + 2);
  }
  printf("\nGot %s, (%d) %s, %s, %s, %s, %s, %s\n", buf1, len, buf2, buf3, buf4,
         buf5, buf6, buf7);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0xc,-0x8(%rbp)
je     124a <main+0x2a>
xor    %edi,%edi
call   1110 <exit@plt>
lea    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x10,%edx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0x10,-0x70(%rbp)
jge    1293 <main+0x73>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    -0x70(%rbp),%edx
call   10c0 <memcpy@plt>
jmp    12e2 <main+0xc2>
mov    -0x70(%rbp),%edi
add    $0x14,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
je     12dd <main+0xbd>
mov    -0x78(%rbp),%rdi
mov    -0x70(%rbp),%esi
add    $0x14,%esi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rcx
lea    0xd3a(%rip),%rdx
call   1090 <snprintf@plt>
mov    0x2d06(%rip),%rax
mov    (%rax),%edi
mov    -0x78(%rbp),%rsi
call   1140 <mylog@plt>
jmp    12e2 <main+0xc2>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
call   10b0 <mycpy@plt>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%rsi
mov    $0xf,%edx
call   10a0 <strncat@plt>
mov    $0x0,%al
call   1130 <fork@plt>
cmp    $0x0,%rax
je     1333 <main+0x113>
mov    -0x10(%rbp),%rax
mov    0x30(%rax),%rdx
lea    0xceb(%rip),%rsi
xor    %ecx,%ecx
mov    %rsi,%rdi
call   1120 <execl@plt>
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
mov    $0x26,%esi
call   1070 <strchr@plt>
mov    %rax,-0x80(%rbp)
cmp    $0x0,%rax
je     135a <main+0x13a>
mov    -0x80(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
mov    $0x60,%esi
call   1070 <strchr@plt>
mov    %rax,-0x80(%rbp)
cmp    $0x0,%rax
je     1381 <main+0x161>
mov    -0x80(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
mov    $0x3b,%esi
call   1070 <strchr@plt>
mov    %rax,-0x80(%rbp)
cmp    $0x0,%rax
je     13a8 <main+0x188>
mov    -0x80(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
mov    $0x7c,%esi
call   1070 <strchr@plt>
mov    %rax,-0x80(%rbp)
cmp    $0x0,%rax
je     13cf <main+0x1af>
mov    -0x80(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
call   1050 <strlen@plt>
cmp    $0x400,%eax
jge    1423 <main+0x203>
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
add    $0x14,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x38(%rax),%rdx
lea    0xc07(%rip),%rsi
call   1100 <sprintf@plt>
mov    -0x48(%rbp),%rdi
call   1060 <system@plt>
mov    -0x10(%rbp),%rax
mov    0x40(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x94(%rbp)
mov    -0x10(%rbp),%rax
mov    0x48(%rax),%rdi
call   1050 <strlen@plt>
mov    -0x94(%rbp),%edi
add    %eax,%edi
add    $0x2,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x40(%rax),%rsi
call   1040 <strcpy@plt>
mov    -0x50(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x48(%rax),%rsi
call   10f0 <strcat@plt>
lea    -0x60(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x10(%rbp),%rax
mov    0x50(%rax),%rax
mov    %rax,-0x88(%rbp)
mov    -0x10(%rbp),%rax
mov    0x50(%rax),%rdi
call   1050 <strlen@plt>
mov    -0x90(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    %eax,%edx
call   10c0 <memcpy@plt>
mov    $0xa,%edi
call   10d0 <malloc@plt>
mov    %rax,-0x68(%rbp)
movl   $0x0,-0x6c(%rbp)
cmpl   $0x4,-0x6c(%rbp)
jge    150e <main+0x2ee>
mov    -0x68(%rbp),%rdi
mov    -0x6c(%rbp),%eax
shl    $0x2,%eax
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rax
mov    0x58(%rax),%rsi
mov    -0x6c(%rbp),%eax
shl    $0x2,%eax
cltq
add    %rax,%rsi
mov    $0x4,%edx
call   10c0 <memcpy@plt>
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    14ca <main+0x2aa>
lea    -0x20(%rbp),%rsi
mov    -0x70(%rbp),%edx
lea    -0x30(%rbp),%rcx
lea    -0x40(%rbp),%r8
mov    -0x48(%rbp),%r9
mov    -0x50(%rbp),%r11
lea    -0x60(%rbp),%r10
mov    -0x68(%rbp),%rax
lea    0xaf4(%rip),%rdi
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1080 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
cmp    $0xc,%edi
jne    148a <main+0x26a>
mov    %rsi,%rbx
mov    0x8(%rsi),%rsi
lea    0x20(%rsp),%rdi
mov    $0x10,%edx
call   1030 <strncpy@plt>
mov    0x10(%rbx),%rdi
call   10e0 <atoi@plt>
mov    %eax,%r14d
cmp    $0xf,%eax
jg     1271 <main+0x51>
mov    0x18(%rbx),%rsi
lea    0x10(%rsp),%rdi
mov    %r14d,%edx
call   10c0 <memcpy@plt>
jmp    12ac <main+0x8c>
mov    %r14d,%ebp
add    $0x14,%ebp
mov    %ebp,%edi
call   10d0 <malloc@plt>
test   %rax,%rax
je     12ac <main+0x8c>
mov    %rax,%r15
mov    0x18(%rbx),%rcx
lea    0xd6f(%rip),%rdx
mov    %rax,%rdi
mov    %ebp,%esi
call   1090 <snprintf@plt>
mov    0x2d36(%rip),%rax
mov    (%rax),%edi
mov    %r15,%rsi
call   1140 <mylog@plt>
mov    0x20(%rbx),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
call   10b0 <mycpy@plt>
mov    0x28(%rbx),%rsi
mov    %rbp,%rdi
mov    $0xf,%edx
call   10a0 <strncat@plt>
xor    %eax,%eax
call   1130 <fork@plt>
test   %rax,%rax
je     12ed <main+0xcd>
mov    0x30(%rbx),%rdx
lea    0xd31(%rip),%rdi
mov    %rdi,%rsi
xor    %ecx,%ecx
call   1120 <execl@plt>
mov    0x38(%rbx),%rbp
mov    %rbp,%rdi
mov    $0x26,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     130a <main+0xea>
movb   $0x0,(%rax)
mov    0x38(%rbx),%rbp
mov    %rbp,%rdi
mov    $0x60,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     1323 <main+0x103>
movb   $0x0,(%rax)
mov    0x38(%rbx),%rbp
mov    %rbp,%rdi
mov    $0x3b,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     133c <main+0x11c>
movb   $0x0,(%rax)
mov    0x38(%rbx),%rbp
mov    %rbp,%rdi
mov    $0x7c,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     1355 <main+0x135>
movb   $0x0,(%rax)
mov    0x38(%rbx),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
cmp    $0x3ff,%eax
jg     1393 <main+0x173>
mov    0x38(%rbx),%rdi
call   1050 <strlen@plt>
lea    0x14(%rax),%edi
call   10d0 <malloc@plt>
mov    %rax,%r15
mov    0x38(%rbx),%rdx
lea    0xc99(%rip),%rsi
mov    %rax,%rdi
call   1100 <sprintf@plt>
mov    %r15,%rdi
call   1060 <system@plt>
mov    0x40(%rbx),%rdi
call   1050 <strlen@plt>
mov    %eax,%ebp
mov    0x48(%rbx),%rdi
call   1050 <strlen@plt>
lea    (%rax,%rbp,1),%edi
add    $0x2,%edi
call   10d0 <malloc@plt>
mov    %rax,%r13
mov    0x40(%rbx),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    0x48(%rbx),%rsi
mov    %r13,%rdi
call   10f0 <strcat@plt>
mov    0x50(%rbx),%rbp
mov    %rbp,%rdi
call   1050 <strlen@plt>
lea    0x30(%rsp),%r12
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   10c0 <memcpy@plt>
mov    $0xa,%edi
call   10d0 <malloc@plt>
mov    %rax,%rbp
mov    0x58(%rbx),%rsi
mov    %rax,%rdi
mov    $0x4,%edx
call   10c0 <memcpy@plt>
lea    0x4(%rbp),%rdi
mov    0x58(%rbx),%rsi
add    $0x4,%rsi
mov    $0x4,%edx
call   10c0 <memcpy@plt>
lea    0x8(%rbp),%rdi
mov    0x58(%rbx),%rsi
add    $0x8,%rsi
mov    $0x4,%edx
call   10c0 <memcpy@plt>
lea    0xc(%rbp),%rdi
mov    0x58(%rbx),%rsi
add    $0xc,%rsi
mov    $0x4,%edx
call   10c0 <memcpy@plt>
sub    $0x8,%rsp
lea    0xbd2(%rip),%rdi
lea    0x28(%rsp),%rsi
lea    0x18(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %r14d,%edx
mov    %r15,%r9
push   %rbp
push   %r12
push   %r13
call   1080 <printf@plt>
add    $0x20,%rsp
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
call   1110 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"String too long: %s\00"
@LOG_ERR = global i32 0
@.str.1 = [8 x i8] c"/bin/ls\00"
@.str.2 = [12 x i8] c"/bin/cat %s\00"
@.str.3 = [38 x i8] c"\0AGot %s, (%d) %s, %s, %s, %s, %s, %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8]
%7 = alloca [16 x i8]
%8 = alloca [16 x i8]
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [16 x i8]
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 12
br i1 %18, label %19, label %21
19: ; preds = %2
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %2
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strncpy(i8* %22, i8* %25, i32 16)
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
%30 = call i32 @atoi(i8* %29)
store i32 %30, i32* %14
%31 = load i32, i32* %14
%32 = icmp slt i32 %31, 16
br i1 %32, label %33, label %40
33: ; preds = %21
%34 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
%38 = load i32, i32* %14
%39 = call i32 @memcpy(i8* %34, i8* %37, i32 %38)
br label %58
40: ; preds = %21
%41 = load i32, i32* %14
%42 = add nsw i32 %41, 20
%43 = call i8* @malloc(i32 %42)
store i8* %43, i8** %15
%44 = load i8*, i8** %15
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %57
46: ; preds = %40
%47 = load i8*, i8** %15
%48 = load i32, i32* %14
%49 = add nsw i32 %48, 20
%50 = load i8**, i8*** %5
%51 = getelementptr inbounds i8*, i8** %50, i64 3
%52 = load i8*, i8** %51
%53 = call i32 @snprintf(i8* %47, i32 %49, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %52)
%54 = load i32, i32* @LOG_ERR
%55 = load i8*, i8** %15
%56 = call i32 @mylog(i32 %54, i8* %55)
br label %57
57: ; preds = %46, %40
br label %58
58: ; preds = %57, %33
%59 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 4
%62 = load i8*, i8** %61
%63 = call i32 @mycpy(i8* %59, i8* %62)
%64 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%65 = load i8**, i8*** %5
%66 = getelementptr inbounds i8*, i8** %65, i64 5
%67 = load i8*, i8** %66
%68 = call i32 @strncat(i8* %64, i8* %67, i32 15)
%69 = call i64 (...) @fork()
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %76
71: ; preds = %58
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 6
%74 = load i8*, i8** %73
%75 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %74, i32 0)
br label %76
76: ; preds = %71, %58
%77 = load i8**, i8*** %5
%78 = getelementptr inbounds i8*, i8** %77, i64 7
%79 = load i8*, i8** %78
%80 = call i8* @strchr(i8* %79, i8 signext 38)
store i8* %80, i8** %16
%81 = icmp ne i8* %80, null
br i1 %81, label %82, label %84
82: ; preds = %76
%83 = load i8*, i8** %16
store i8 0, i8* %83
br label %84
84: ; preds = %82, %76
%85 = load i8**, i8*** %5
%86 = getelementptr inbounds i8*, i8** %85, i64 7
%87 = load i8*, i8** %86
%88 = call i8* @strchr(i8* %87, i8 signext 96)
store i8* %88, i8** %16
%89 = icmp ne i8* %88, null
br i1 %89, label %90, label %92
90: ; preds = %84
%91 = load i8*, i8** %16
store i8 0, i8* %91
br label %92
92: ; preds = %90, %84
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 7
%95 = load i8*, i8** %94
%96 = call i8* @strchr(i8* %95, i8 signext 59)
store i8* %96, i8** %16
%97 = icmp ne i8* %96, null
br i1 %97, label %98, label %100
98: ; preds = %92
%99 = load i8*, i8** %16
store i8 0, i8* %99
br label %100
100: ; preds = %98, %92
%101 = load i8**, i8*** %5
%102 = getelementptr inbounds i8*, i8** %101, i64 7
%103 = load i8*, i8** %102
%104 = call i8* @strchr(i8* %103, i8 signext 124)
store i8* %104, i8** %16
%105 = icmp ne i8* %104, null
br i1 %105, label %106, label %108
106: ; preds = %100
%107 = load i8*, i8** %16
store i8 0, i8* %107
br label %108
108: ; preds = %106, %100
%109 = load i8**, i8*** %5
%110 = getelementptr inbounds i8*, i8** %109, i64 7
%111 = load i8*, i8** %110
%112 = call i32 @strlen(i8* %111)
%113 = icmp slt i32 %112, 1024
br i1 %113, label %114, label %128
114: ; preds = %108
%115 = load i8**, i8*** %5
%116 = getelementptr inbounds i8*, i8** %115, i64 7
%117 = load i8*, i8** %116
%118 = call i32 @strlen(i8* %117)
%119 = add nsw i32 20, %118
%120 = call i8* @malloc(i32 %119)
store i8* %120, i8** %9
%121 = load i8*, i8** %9
%122 = load i8**, i8*** %5
%123 = getelementptr inbounds i8*, i8** %122, i64 7
%124 = load i8*, i8** %123
%125 = call i32 @sprintf(i8* %121, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %124)
%126 = load i8*, i8** %9
%127 = call i32 @system(i8* %126)
br label %128
128: ; preds = %114, %108
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 8
%131 = load i8*, i8** %130
%132 = call i32 @strlen(i8* %131)
%133 = load i8**, i8*** %5
%134 = getelementptr inbounds i8*, i8** %133, i64 9
%135 = load i8*, i8** %134
%136 = call i32 @strlen(i8* %135)
%137 = add nsw i32 %132, %136
%138 = add nsw i32 %137, 2
%139 = call i8* @malloc(i32 %138)
store i8* %139, i8** %10
%140 = load i8*, i8** %10
%141 = load i8**, i8*** %5
%142 = getelementptr inbounds i8*, i8** %141, i64 8
%143 = load i8*, i8** %142
%144 = call i32 @strcpy(i8* %140, i8* %143)
%145 = load i8*, i8** %10
%146 = load i8**, i8*** %5
%147 = getelementptr inbounds i8*, i8** %146, i64 9
%148 = load i8*, i8** %147
%149 = call i32 @strcat(i8* %145, i8* %148)
%150 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%151 = load i8**, i8*** %5
%152 = getelementptr inbounds i8*, i8** %151, i64 10
%153 = load i8*, i8** %152
%154 = load i8**, i8*** %5
%155 = getelementptr inbounds i8*, i8** %154, i64 10
%156 = load i8*, i8** %155
%157 = call i32 @strlen(i8* %156)
%158 = call i32 @memcpy(i8* %150, i8* %153, i32 %157)
%159 = call i8* @malloc(i32 10)
store i8* %159, i8** %12
store i32 0, i32* %13
br label %160
160: ; preds = %177, %128
%161 = load i32, i32* %13
%162 = icmp slt i32 %161, 4
br i1 %162, label %163, label %180
163: ; preds = %160
%164 = load i8*, i8** %12
%165 = load i32, i32* %13
%166 = mul nsw i32 4, %165
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds i8, i8* %164, i64 %167
%169 = load i8**, i8*** %5
%170 = getelementptr inbounds i8*, i8** %169, i64 11
%171 = load i8*, i8** %170
%172 = load i32, i32* %13
%173 = mul nsw i32 4, %172
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds i8, i8* %171, i64 %174
%176 = call i32 @memcpy(i8* %168, i8* %175, i32 4)
br label %177
177: ; preds = %163
%178 = load i32, i32* %13
%179 = add nsw i32 %178, 1
store i32 %179, i32* %13
br label %160
180: ; preds = %160
%181 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%182 = load i32, i32* %14
%183 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%184 = getelementptr inbounds [16 x i8], [16 x i8]* %8, i64 0, i64 0
%185 = load i8*, i8** %9
%186 = load i8*, i8** %10
%187 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%188 = load i8*, i8** %12
%189 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %181, i32 %182, i8* %183, i8* %184, i8* %185, i8* %186, i8* %187, i8* %188)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"String too long: %s\00"
@LOG_ERR = global i32 0
@.str.1 = [8 x i8] c"/bin/ls\00"
@.str.2 = [12 x i8] c"/bin/cat %s\00"
@.str.3 = [38 x i8] c"\0AGot %s, (%d) %s, %s, %s, %s, %s, %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i8]
%4 = alloca [16 x i8]
%5 = alloca [16 x i8]
%6 = alloca [16 x i8]
%7 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%11 = icmp eq i32 %0, 12
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = tail call i32 @exit(i32 0)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strncpy(i8* %7, i8* %16, i32 16)
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
%21 = icmp slt i32 %20, 16
br i1 %21, label %22, label %26
22: ; preds = %14
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = call i32 @memcpy(i8* %8, i8* %24, i32 %20)
br label %36
26: ; preds = %14
%27 = add nuw nsw i32 %20, 20
%28 = call i8* @malloc(i32 %27)
%29 = icmp eq i8* %28, null
br i1 %29, label %36, label %30
30: ; preds = %26
%31 = getelementptr inbounds i8*, i8** %1, i64 3
%32 = load i8*, i8** %31
%33 = call i32 @snprintf(i8* %28, i32 %27, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %32)
%34 = load i32, i32* @LOG_ERR
%35 = call i32 @mylog(i32 %34, i8* %28)
br label %36
36: ; preds = %26, %30, %22
%37 = getelementptr inbounds i8*, i8** %1, i64 4
%38 = load i8*, i8** %37
%39 = call i32 @mycpy(i8* %9, i8* %38)
%40 = getelementptr inbounds i8*, i8** %1, i64 5
%41 = load i8*, i8** %40
%42 = call i32 @strncat(i8* %9, i8* %41, i32 15)
%43 = call i64 (...) @fork()
%44 = icmp eq i64 %43, 0
br i1 %44, label %49, label %45
45: ; preds = %36
%46 = getelementptr inbounds i8*, i8** %1, i64 6
%47 = load i8*, i8** %46
%48 = call i32 @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %47, i32 0)
br label %49
49: ; preds = %45, %36
%50 = getelementptr inbounds i8*, i8** %1, i64 7
%51 = load i8*, i8** %50
%52 = call i8* @strchr(i8* dereferenceable(1) %51, i8 signext 38)
%53 = icmp eq i8* %52, null
br i1 %53, label %56, label %54
54: ; preds = %49
store i8 0, i8* %52
%55 = load i8*, i8** %50
br label %56
56: ; preds = %54, %49
%57 = phi i8* [ %55, %54 ], [ %51, %49 ]
%58 = call i8* @strchr(i8* dereferenceable(1) %57, i8 signext 96)
%59 = icmp eq i8* %58, null
br i1 %59, label %62, label %60
60: ; preds = %56
store i8 0, i8* %58
%61 = load i8*, i8** %50
br label %62
62: ; preds = %60, %56
%63 = phi i8* [ %61, %60 ], [ %57, %56 ]
%64 = call i8* @strchr(i8* dereferenceable(1) %63, i8 signext 59)
%65 = icmp eq i8* %64, null
br i1 %65, label %68, label %66
66: ; preds = %62
store i8 0, i8* %64
%67 = load i8*, i8** %50
br label %68
68: ; preds = %66, %62
%69 = phi i8* [ %67, %66 ], [ %63, %62 ]
%70 = call i8* @strchr(i8* dereferenceable(1) %69, i8 signext 124)
%71 = icmp eq i8* %70, null
br i1 %71, label %74, label %72
72: ; preds = %68
store i8 0, i8* %70
%73 = load i8*, i8** %50
br label %74
74: ; preds = %72, %68
%75 = phi i8* [ %73, %72 ], [ %69, %68 ]
%76 = call i32 @strlen(i8* %75)
%77 = icmp slt i32 %76, 1024
br i1 %77, label %78, label %86
78: ; preds = %74
%79 = load i8*, i8** %50
%80 = call i32 @strlen(i8* %79)
%81 = add nsw i32 %80, 20
%82 = call i8* @malloc(i32 %81)
%83 = load i8*, i8** %50
%84 = call i32 @sprintf(i8* dereferenceable(1) %82, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %83)
%85 = call i32 @system(i8* %82)
br label %86
86: ; preds = %78, %74
%87 = phi i8* [ %82, %78 ], [ undef, %74 ]
%88 = getelementptr inbounds i8*, i8** %1, i64 8
%89 = load i8*, i8** %88
%90 = call i32 @strlen(i8* %89)
%91 = getelementptr inbounds i8*, i8** %1, i64 9
%92 = load i8*, i8** %91
%93 = call i32 @strlen(i8* %92)
%94 = add i32 %90, 2
%95 = add i32 %94, %93
%96 = call i8* @malloc(i32 %95)
%97 = load i8*, i8** %88
%98 = call i32 @strcpy(i8* %96, i8* %97)
%99 = load i8*, i8** %91
%100 = call i32 @strcat(i8* %96, i8* %99)
%101 = getelementptr inbounds i8*, i8** %1, i64 10
%102 = load i8*, i8** %101
%103 = call i32 @strlen(i8* %102)
%104 = call i32 @memcpy(i8* %10, i8* %102, i32 %103)
%105 = call dereferenceable_or_null(10) i8* @malloc(i32 10)
%106 = getelementptr inbounds i8*, i8** %1, i64 11
%107 = load i8*, i8** %106
%108 = call i32 @memcpy(i8* %105, i8* %107, i32 4)
%109 = getelementptr inbounds i8, i8* %105, i64 4
%110 = load i8*, i8** %106
%111 = getelementptr inbounds i8, i8* %110, i64 4
%112 = call i32 @memcpy(i8* %109, i8* %111, i32 4)
%113 = getelementptr inbounds i8, i8* %105, i64 8
%114 = load i8*, i8** %106
%115 = getelementptr inbounds i8, i8* %114, i64 8
%116 = call i32 @memcpy(i8* %113, i8* %115, i32 4)
%117 = getelementptr inbounds i8, i8* %105, i64 12
%118 = load i8*, i8** %106
%119 = getelementptr inbounds i8, i8* %118, i64 12
%120 = call i32 @memcpy(i8* %117, i8* %119, i32 4)
%121 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %7, i32 %20, i8* %8, i8* %9, i8* %87, i8* %96, i8* %10, i8* %105)
ret i32 0
}