#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 *malloc(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *makeCommand(char *command) {
  int totLen = 0, srcLen = 0;
  char head[8];
  char *fullcommand = malloc((totLen = (srcLen = strlen(command)) + 7 + 2));
  char *cpycommand = malloc(srcLen);
  strcpy(cpycommand, command);
  char *cursor = cpycommand;
  while (cursor && *cursor != '\0') {
    if (*cursor == '\t' || *cursor == '\r' || *cursor == ' ' || *cursor == '\b')
      *cursor = '\t';
    cursor++;
  }
  fullcommand[0] = '*';
  fullcommand[1] = '\t';
  fullcommand[2] = ((strlen(command) + 7 + 2) / 1000) % 10 + '0';
  fullcommand[3] = ((strlen(command) + 7 + 2) / 100) % 10 + '0';
  fullcommand[4] = ((strlen(command) + 7 + 2) / 10) % 10 + '0';
  fullcommand[5] = ((strlen(command) + 7 + 2) / 1) % 10 + '0';
  fullcommand[6] = '\t';
  fullcommand[7] = '\0';
  strcat(fullcommand, cpycommand);
  fullcommand[totLen - 2] = '\t';
  fullcommand[totLen - 1] = '!';
  return fullcommand;
}


x86 assembly (clang, -O0):
<makeCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
mov    %edi,-0x10(%rbp)
add    $0x7,%edi
add    $0x2,%edi
mov    %edi,-0xc(%rbp)
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x30(%rbp)
mov    %al,-0x31(%rbp)
je     11bb <makeCommand+0x7b>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    11cb <makeCommand+0x8b>
jmp    1223 <makeCommand+0xe3>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
je     120b <makeCommand+0xcb>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xd,%eax
je     120b <makeCommand+0xcb>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     120b <makeCommand+0xcb>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x8,%eax
jne    1212 <makeCommand+0xd2>
mov    -0x30(%rbp),%rax
movb   $0x9,(%rax)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    119b <makeCommand+0x5b>
mov    -0x20(%rbp),%rax
movb   $0x2a,(%rax)
mov    -0x20(%rbp),%rax
movb   $0x9,0x1(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x7,%eax
add    $0x2,%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x7,%eax
add    $0x2,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x7,%eax
add    $0x2,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x7,%eax
add    $0x2,%eax
mov    $0x1,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x5(%rax)
mov    -0x20(%rbp),%rax
movb   $0x9,0x6(%rax)
mov    -0x20(%rbp),%rax
movb   $0x0,0x7(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x20(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
movb   $0x9,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x21,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeCommand>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %eax,%ebx
lea    0x9(%rbx),%edi
call   1050 <malloc@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
test   %r14,%r14
je     11ab <makeCommand+0x6b>
movabs $0x100002300,%rax
mov    %r14,%rcx
jmp    1197 <makeCommand+0x57>
cs nopw 0x0(%rax,%rax,1)
movb   $0x9,(%rcx)
add    $0x1,%rcx
movzbl (%rcx),%edx
cmp    $0x20,%rdx
ja     1193 <makeCommand+0x53>
bt     %rdx,%rax
jb     1190 <makeCommand+0x50>
test   %rdx,%rdx
jne    1193 <makeCommand+0x53>
movslq %ebx,%rbx
movw   $0x92a,(%r12)
mov    %r15,%rdi
call   1040 <strlen@plt>
add    $0x9,%eax
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x30,%al
mov    %al,0x2(%r12)
mov    %r15,%rdi
call   1040 <strlen@plt>
add    $0x9,%eax
cltq
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x30,%al
mov    %al,0x3(%r12)
mov    %r15,%rdi
call   1040 <strlen@plt>
add    $0x9,%eax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x30,%al
mov    %al,0x4(%r12)
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
add    $0x9,%ecx
movslq %ecx,%rcx
imul   $0x66666667,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x9,%eax
add    $0x30,%al
mov    %al,0x5(%r12)
movw   $0x9,0x6(%r12)
mov    %r12,%rdi
mov    %r14,%rsi
call   1060 <strcat@plt>
movw   $0x2109,0x7(%rbx,%r12,1)
21
mov    %r12,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @makeCommand(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [8 x i8]
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %4
%11 = add nsw i32 %10, 7
%12 = add nsw i32 %11, 2
store i32 %12, i32* %3
%13 = call i8* @malloc(i32 %12)
store i8* %13, i8** %6
%14 = load i32, i32* %4
%15 = call i8* @malloc(i32 %14)
store i8* %15, i8** %7
%16 = load i8*, i8** %7
%17 = load i8*, i8** %2
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = load i8*, i8** %7
store i8* %19, i8** %8
br label %20
20: ; preds = %52, %1
%21 = load i8*, i8** %8
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i8*, i8** %8
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br label %28
28: ; preds = %23, %20
%29 = phi i1 [ false, %20 ], [ %27, %23 ]
br i1 %29, label %30, label %55
30: ; preds = %28
%31 = load i8*, i8** %8
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 9
br i1 %34, label %50, label %35
35: ; preds = %30
%36 = load i8*, i8** %8
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 13
br i1 %39, label %50, label %40
40: ; preds = %35
%41 = load i8*, i8** %8
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 32
br i1 %44, label %50, label %45
45: ; preds = %40
%46 = load i8*, i8** %8
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 8
br i1 %49, label %50, label %52
50: ; preds = %45, %40, %35, %30
%51 = load i8*, i8** %8
store i8 9, i8* %51
br label %52
52: ; preds = %50, %45
%53 = load i8*, i8** %8
%54 = getelementptr inbounds i8, i8* %53, i32 1
store i8* %54, i8** %8
br label %20
55: ; preds = %28
%56 = load i8*, i8** %6
%57 = getelementptr inbounds i8, i8* %56, i64 0
store i8 42, i8* %57
%58 = load i8*, i8** %6
%59 = getelementptr inbounds i8, i8* %58, i64 1
store i8 9, i8* %59
%60 = load i8*, i8** %2
%61 = call i32 @strlen(i8* %60)
%62 = add nsw i32 %61, 7
%63 = add nsw i32 %62, 2
%64 = sdiv i32 %63, 1000
%65 = srem i32 %64, 10
%66 = add nsw i32 %65, 48
%67 = trunc i32 %66 to i8
%68 = load i8*, i8** %6
%69 = getelementptr inbounds i8, i8* %68, i64 2
store i8 %67, i8* %69
%70 = load i8*, i8** %2
%71 = call i32 @strlen(i8* %70)
%72 = add nsw i32 %71, 7
%73 = add nsw i32 %72, 2
%74 = sdiv i32 %73, 100
%75 = srem i32 %74, 10
%76 = add nsw i32 %75, 48
%77 = trunc i32 %76 to i8
%78 = load i8*, i8** %6
%79 = getelementptr inbounds i8, i8* %78, i64 3
store i8 %77, i8* %79
%80 = load i8*, i8** %2
%81 = call i32 @strlen(i8* %80)
%82 = add nsw i32 %81, 7
%83 = add nsw i32 %82, 2
%84 = sdiv i32 %83, 10
%85 = srem i32 %84, 10
%86 = add nsw i32 %85, 48
%87 = trunc i32 %86 to i8
%88 = load i8*, i8** %6
%89 = getelementptr inbounds i8, i8* %88, i64 4
store i8 %87, i8* %89
%90 = load i8*, i8** %2
%91 = call i32 @strlen(i8* %90)
%92 = add nsw i32 %91, 7
%93 = add nsw i32 %92, 2
%94 = sdiv i32 %93, 1
%95 = srem i32 %94, 10
%96 = add nsw i32 %95, 48
%97 = trunc i32 %96 to i8
%98 = load i8*, i8** %6
%99 = getelementptr inbounds i8, i8* %98, i64 5
store i8 %97, i8* %99
%100 = load i8*, i8** %6
%101 = getelementptr inbounds i8, i8* %100, i64 6
store i8 9, i8* %101
%102 = load i8*, i8** %6
%103 = getelementptr inbounds i8, i8* %102, i64 7
store i8 0, i8* %103
%104 = load i8*, i8** %6
%105 = load i8*, i8** %7
%106 = call i32 @strcat(i8* %104, i8* %105)
%107 = load i8*, i8** %6
%108 = load i32, i32* %3
%109 = sub nsw i32 %108, 2
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8, i8* %107, i64 %110
store i8 9, i8* %111
%112 = load i8*, i8** %6
%113 = load i32, i32* %3
%114 = sub nsw i32 %113, 1
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i8, i8* %112, i64 %115
store i8 33, i8* %116
%117 = load i8*, i8** %6
ret i8* %117
}

LLVM IR (-O2):
define i8* @makeCommand(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 9
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i8* @malloc(i32 %2)
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
%7 = icmp eq i8* %5, null
br i1 %7, label %14, label %8
8: ; preds = %1, %12
%9 = phi i8* [ %13, %12 ], [ %5, %1 ]
%10 = load i8, i8* %9
switch i8 %10, label %12 [
i8 0, label %14
i8 9, label %11
i8 13, label %11
i8 32, label %11
i8 8, label %11
]
11: ; preds = %8, %8, %8, %8
store i8 9, i8* %9
br label %12
12: ; preds = %8, %11
%13 = getelementptr inbounds i8, i8* %9, i64 1
br label %8
14: ; preds = %8, %1
%15 = add nsw i32 %2, 7
store i8 42, i8* %4
%16 = getelementptr inbounds i8, i8* %4, i64 1
store i8 9, i8* %16
%17 = tail call i32 @strlen(i8* %0)
%18 = add nsw i32 %17, 9
%19 = sdiv i32 %18, 1000
%20 = srem i32 %19, 10
%21 = trunc i32 %20 to i8
%22 = add nsw i8 %21, 48
%23 = getelementptr inbounds i8, i8* %4, i64 2
store i8 %22, i8* %23
%24 = tail call i32 @strlen(i8* %0)
%25 = add nsw i32 %24, 9
%26 = sdiv i32 %25, 100
%27 = srem i32 %26, 10
%28 = trunc i32 %27 to i8
%29 = add nsw i8 %28, 48
%30 = getelementptr inbounds i8, i8* %4, i64 3
store i8 %29, i8* %30
%31 = tail call i32 @strlen(i8* %0)
%32 = add nsw i32 %31, 9
%33 = sdiv i32 %32, 10
%34 = srem i32 %33, 10
%35 = trunc i32 %34 to i8
%36 = add nsw i8 %35, 48
%37 = getelementptr inbounds i8, i8* %4, i64 4
store i8 %36, i8* %37
%38 = tail call i32 @strlen(i8* %0)
%39 = add nsw i32 %38, 9
%40 = srem i32 %39, 10
%41 = trunc i32 %40 to i8
%42 = add nsw i8 %41, 48
%43 = getelementptr inbounds i8, i8* %4, i64 5
store i8 %42, i8* %43
%44 = getelementptr inbounds i8, i8* %4, i64 6
store i8 9, i8* %44
%45 = getelementptr inbounds i8, i8* %4, i64 7
store i8 0, i8* %45
%46 = tail call i32 @strcat(i8* %4, i8* %5)
%47 = sext i32 %15 to i64
%48 = getelementptr inbounds i8, i8* %4, i64 %47
store i8 9, i8* %48
%49 = add nsw i32 %2, 8
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %4, i64 %50
store i8 33, i8* %51
ret i8* %4
}