#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 */
int atoi(char *const);
int /*<<< orphan*/ commit_kit(char *);
int /*<<< orphan*/ escape_dq(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ gen_arg_str(int, char *const *, int, char *);
int getopt(int, char *const *, char *);
scalar_t__ is_num(char *const);
int optind;
int /*<<< orphan*/ printf(char *);
int read_kit_file(int, char **);
int /*<<< orphan*/ save_kit_file(int, char **);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *const, char const *);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char *);
void cmd_do(int argc, char *const argv[]) {
  const char AfterCmd[] = "after";
  const char ManyCmd[] = "many";
  const char EndMany[] = "EOF";
  const char BaseMes[] = "[kit]add plan ";
  const char ManyMes[] = "[kit]add many plans";
  char buffer[128][128] = {{0}};
  char opts[128][128];
  char mes[128];
  int i, num, pointer, n_opt = 0, many_flg = 0, opts_len = 1;
  if (getopt(argc, argv, "n") != -1) {
    n_opt = 1;
  }
  num = read_kit_file(127, buffer);
  pointer = 0;
  while (optind < argc) {
    if (strcmp(argv[optind], AfterCmd) == 0) {
      if (pointer == 0) {
        pointer = num;
      }
    } else if (strcmp(argv[optind], ManyCmd) == 0) {
      many_flg = 1;
    } else if (is_num(argv[optind]) == 0) {
      pointer = atoi(argv[optind]);
    } else {
      break;
    }
    optind++;
  }
  if (many_flg) {
    printf("Input commit messages and press Enter. Finally input \"EOF\".\n");
    opts_len = 0;
    while (1) {
      printf(">");
      scanf("%s", mes);
      if (strlen(mes) > 0) {
        if (strcmp(mes, EndMany) == 0) {
          break;
        } else {
          if ((mes[0] != '"') || (mes[strlen(mes) - 1] != '"')) {
            strcpy(opts[opts_len], "\"");
            strcat(opts[opts_len], mes);
            strcat(opts[opts_len], "\"");
          } else {
            strcpy(opts[opts_len], mes);
          }
          opts_len++;
        }
      }
    }
    if (opts_len == 0) {
      exit(1);
    }
  } else {
    gen_arg_str(argc, argv, optind, opts[0]);
  }
  for (i = num + opts_len - 1; i > pointer; i--) {
    strcpy(buffer[i], buffer[i - opts_len]);
  }
  for (i = 0; i < opts_len; i++) {
    strcpy(buffer[i + pointer], opts[i]);
  }
  save_kit_file(num + opts_len, buffer);
  if (n_opt == 0) {
    if (opts_len == 1) {
      strcpy(mes, BaseMes);
      escape_dq(opts[0]);
      strcat(mes, opts[0]);
    } else {
      strcpy(mes, ManyMes);
    }
    commit_kit(mes);
  }
}


x86 assembly (clang, -O0):
<cmd_do>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80f0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xde8(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xde2(%rip),%ax
mov    %ax,-0x12(%rbp)
mov    0xdda(%rip),%eax
mov    %eax,-0x1b(%rbp)
mov    0xdd5(%rip),%al
mov    %al,-0x17(%rbp)
mov    0xdcd(%rip),%eax
mov    %eax,-0x1f(%rbp)
mov    0xdc7(%rip),%rax
mov    %rax,-0x2e(%rbp)
mov    0xdc5(%rip),%eax
mov    %eax,-0x26(%rbp)
mov    0xdbf(%rip),%ax
mov    %ax,-0x22(%rbp)
mov    0xdb7(%rip),%al
mov    %al,-0x20(%rbp)
mov    0xe00(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xdfd(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xdfb(%rip),%eax
mov    %eax,-0x40(%rbp)
lea    -0x4050(%rbp),%rdi
xor    %esi,%esi
mov    $0x4000,%edx
call   1080 <memset@plt>
movl   $0x0,-0x80e0(%rbp)
movl   $0x0,-0x80e4(%rbp)
movl   $0x1,-0x80e8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd57(%rip),%rdx
call   10f0 <getopt@plt>
cmp    $0xffffffff,%eax
je     12df <cmd_do+0xdf>
movl   $0x1,-0x80e0(%rbp)
lea    -0x4050(%rbp),%rsi
mov    $0x7f,%edi
call   1090 <read_kit_file@plt>
mov    %eax,-0x80d8(%rbp)
movl   $0x0,-0x80dc(%rbp)
mov    0x2ce1(%rip),%rax
mov    (%rax),%eax
cmp    -0x4(%rbp),%eax
jge    13f5 <cmd_do+0x1f5>
mov    -0x10(%rbp),%rax
mov    0x2ccb(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x16(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1355 <cmd_do+0x155>
cmpl   $0x0,-0x80dc(%rbp)
jne    1350 <cmd_do+0x150>
mov    -0x80d8(%rbp),%eax
mov    %eax,-0x80dc(%rbp)
jmp    13db <cmd_do+0x1db>
mov    -0x10(%rbp),%rax
mov    0x2c88(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x1b(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1389 <cmd_do+0x189>
movl   $0x1,-0x80e4(%rbp)
jmp    13d6 <cmd_do+0x1d6>
mov    -0x10(%rbp),%rax
mov    0x2c54(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   10c0 <is_num@plt>
cmp    $0x0,%rax
jne    13cc <cmd_do+0x1cc>
mov    -0x10(%rbp),%rax
mov    0x2c33(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1100 <atoi@plt>
mov    %eax,-0x80dc(%rbp)
jmp    13d1 <cmd_do+0x1d1>
jmp    13f5 <cmd_do+0x1f5>
jmp    13d6 <cmd_do+0x1d6>
jmp    13db <cmd_do+0x1db>
mov    0x2c06(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    0x2bfa(%rip),%rax
mov    %ecx,(%rax)
jmp    1300 <cmd_do+0x100>
cmpl   $0x0,-0x80e4(%rbp)
je     155b <cmd_do+0x35b>
lea    0xc17(%rip),%rdi
call   1070 <printf@plt>
movl   $0x0,-0x80e8(%rbp)
lea    0xc3e(%rip),%rdi
call   1070 <printf@plt>
lea    -0x80d0(%rbp),%rsi
lea    0xc2d(%rip),%rdi
call   10d0 <scanf@plt>
lea    -0x80d0(%rbp),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%eax
jle    153a <cmd_do+0x33a>
lea    -0x80d0(%rbp),%rdi
lea    -0x1f(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    146b <cmd_do+0x26b>
jmp    153f <cmd_do+0x33f>
movsbl -0x80d0(%rbp),%eax
cmp    $0x22,%eax
jne    149d <cmd_do+0x29d>
lea    -0x80d0(%rbp),%rdi
call   1060 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x80d0(%rbp,%rax,1),%eax
ff
cmp    $0x22,%eax
je     1505 <cmd_do+0x305>
movslq -0x80e8(%rbp),%rax
lea    -0x8050(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
lea    0xba9(%rip),%rsi
call   1030 <strcpy@plt>
movslq -0x80e8(%rbp),%rax
lea    -0x8050(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
lea    -0x80d0(%rbp),%rsi
call   1110 <strcat@plt>
movslq -0x80e8(%rbp),%rax
lea    -0x8050(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
lea    0xb67(%rip),%rsi
call   1110 <strcat@plt>
jmp    1526 <cmd_do+0x326>
movslq -0x80e8(%rbp),%rax
lea    -0x8050(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
lea    -0x80d0(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x80e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80e8(%rbp)
jmp    153a <cmd_do+0x33a>
jmp    1418 <cmd_do+0x218>
cmpl   $0x0,-0x80e8(%rbp)
jne    1556 <cmd_do+0x356>
mov    $0x1,%edi
call   1120 <exit@plt>
jmp    1577 <cmd_do+0x377>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2a7f(%rip),%rax
mov    (%rax),%edx
lea    -0x8050(%rbp),%rcx
call   1040 <gen_arg_str@plt>
mov    -0x80d8(%rbp),%eax
add    -0x80e8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x80d4(%rbp)
mov    -0x80d4(%rbp),%eax
cmp    -0x80dc(%rbp),%eax
jle    15e8 <cmd_do+0x3e8>
movslq -0x80d4(%rbp),%rax
lea    -0x4050(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
mov    -0x80d4(%rbp),%eax
sub    -0x80e8(%rbp),%eax
cltq
lea    -0x4050(%rbp),%rsi
shl    $0x7,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x80d4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x80d4(%rbp)
jmp    158c <cmd_do+0x38c>
movl   $0x0,-0x80d4(%rbp)
mov    -0x80d4(%rbp),%eax
cmp    -0x80e8(%rbp),%eax
jge    164e <cmd_do+0x44e>
mov    -0x80d4(%rbp),%eax
add    -0x80dc(%rbp),%eax
cltq
lea    -0x4050(%rbp),%rdi
shl    $0x7,%rax
add    %rax,%rdi
movslq -0x80d4(%rbp),%rax
lea    -0x8050(%rbp),%rsi
shl    $0x7,%rax
add    %rax,%rsi
call   1030 <strcpy@plt>
mov    -0x80d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80d4(%rbp)
jmp    15f2 <cmd_do+0x3f2>
mov    -0x80d8(%rbp),%edi
add    -0x80e8(%rbp),%edi
lea    -0x4050(%rbp),%rsi
call   10e0 <save_kit_file@plt>
cmpl   $0x0,-0x80e0(%rbp)
jne    16d0 <cmd_do+0x4d0>
cmpl   $0x1,-0x80e8(%rbp)
jne    16b4 <cmd_do+0x4b4>
lea    -0x80d0(%rbp),%rdi
lea    -0x2e(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x8050(%rbp),%rdi
call   1050 <escape_dq@plt>
lea    -0x80d0(%rbp),%rdi
lea    -0x8050(%rbp),%rsi
call   1110 <strcat@plt>
jmp    16c4 <cmd_do+0x4c4>
lea    -0x80d0(%rbp),%rdi
lea    -0x50(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x80d0(%rbp),%rdi
call   10b0 <commit_kit@plt>
add    $0x80f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_do>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80e8,%rsp
mov    %rsi,%rbx
mov    %edi,%r15d
movw   $0x72,0x2c(%rsp)
movl   $0x65746661,0x28(%rsp)
65
movb   $0x0,0x1c(%rsp)
movl   $0x796e616d,0x18(%rsp)
79
movl   $0x464f45,0x24(%rsp)
movabs $0x206e616c702064,%rax
mov    %rax,0x37(%rsp)
movabs $0x6464615d74696b5b,%rax
61 64 64
mov    %rax,0x30(%rsp)
movaps 0xdf0(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movl   $0x736e61,0x50(%rsp)
lea    0x40e0(%rsp),%r14
xor    %r12d,%r12d
mov    $0x4000,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1090 <memset@plt>
lea    0xd7c(%rip),%rdx
mov    %r15d,%edi
mov    %rbx,%rsi
call   1100 <getopt@plt>
mov    %eax,0x20(%rsp)
mov    $0x7f,%edi
mov    %r14,%rsi
call   10a0 <read_kit_file@plt>
mov    %rax,0x8(%rsp)
mov    0x2d22(%rip),%rbp
mov    0x0(%rbp),%eax
cmp    %r15d,%eax
jge    143f <cmd_do+0x22f>
movl   $0x0,0x14(%rsp)
lea    0x28(%rsp),%r14
lea    0x18(%rsp),%r13
xor    %r12d,%r12d
jmp    1307 <cmd_do+0xf7>
nopl   0x0(%rax)
test   %r12d,%r12d
cmove  0x8(%rsp),%r12d
mov    0x0(%rbp),%eax
add    $0x1,%eax
mov    %eax,0x0(%rbp)
cmp    %r15d,%eax
jge    136a <cmd_do+0x15a>
cltq
mov    (%rbx,%rax,8),%rdi
mov    %r14,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     12f0 <cmd_do+0xe0>
movslq 0x0(%rbp),%rax
mov    (%rbx,%rax,8),%rdi
mov    %r13,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1360 <cmd_do+0x150>
movslq 0x0(%rbp),%rax
mov    (%rbx,%rax,8),%rdi
call   10d0 <is_num@plt>
test   %rax,%rax
jne    136a <cmd_do+0x15a>
movslq 0x0(%rbp),%rax
mov    (%rbx,%rax,8),%rdi
call   1110 <atoi@plt>
mov    %eax,%r12d
jmp    12f9 <cmd_do+0xe9>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movl   $0x1,0x14(%rsp)
jmp    12f9 <cmd_do+0xe9>
cmpl   $0x0,0x14(%rsp)
je     143f <cmd_do+0x22f>
lea    0xca5(%rip),%rdi
call   1050 <puts@plt>
xor    %r13d,%r13d
lea    0xc91(%rip),%rbx
lea    0x60(%rsp),%rbp
lea    0xc88(%rip),%r14
jmp    13d0 <cmd_do+0x1c0>
mov    %r13d,%eax
shl    $0x7,%rax
lea    (%rsp,%rax,1),%r15
add    $0xe0,%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   1120 <strcat@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1120 <strcat@plt>
add    $0x1,%r13d
mov    $0x3e,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10e0 <scanf@plt>
mov    %rbp,%rdi
call   1080 <strlen@plt>
test   %eax,%eax
jle    13d0 <cmd_do+0x1c0>
mov    %rbp,%rdi
lea    0x24(%rsp),%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     145d <cmd_do+0x24d>
cmpb   $0x22,0x60(%rsp)
jne    1399 <cmd_do+0x189>
mov    %rbp,%rdi
call   1080 <strlen@plt>
cltq
cmpb   $0x22,-0x1(%rax,%rbp,1)
jne    1399 <cmd_do+0x189>
mov    %r13d,%eax
shl    $0x7,%rax
lea    (%rsp,%rax,1),%rdi
add    $0xe0,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
add    $0x1,%r13d
jmp    13d0 <cmd_do+0x1c0>
mov    0x0(%rbp),%edx
lea    0xe0(%rsp),%rcx
mov    %r15d,%edi
mov    %rbx,%rsi
call   1060 <gen_arg_str@plt>
mov    $0x1,%r13d
jmp    1466 <cmd_do+0x256>
test   %r13d,%r13d
je     1582 <cmd_do+0x372>
mov    0x8(%rsp),%rax
add    %r13d,%eax
add    $0xffffffff,%eax
mov    %r13d,%r14d
movslq %r12d,%r15
cmp    %r12d,%eax
jle    14b9 <cmd_do+0x2a9>
movslq %eax,%rbp
mov    %rbp,%rax
shl    $0x7,%rax
lea    (%rsp,%rax,1),%rbx
add    $0x40e0,%rbx
mov    %r14,%r12
shl    $0x7,%r12
neg    %r12
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%r12,1),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
add    $0xffffffffffffffff,%rbp
add    $0xffffffffffffff80,%rbx
cmp    %r15,%rbp
jg     14a0 <cmd_do+0x290>
mov    0x8(%rsp),%rax
add    %r13d,%eax
mov    %rax,0x8(%rsp)
test   %r13d,%r13d
je     1509 <cmd_do+0x2f9>
shl    $0x7,%r15
lea    (%rsp,%r15,1),%rbx
add    $0x40e0,%rbx
lea    0xe0(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
sub    $0xffffffffffffff80,%rbx
sub    $0xffffffffffffff80,%rbp
add    $0xffffffffffffffff,%r14
jne    14f0 <cmd_do+0x2e0>
lea    0x40e0(%rsp),%rsi
mov    0x8(%rsp),%rdi
call   10f0 <save_kit_file@plt>
cmpl   $0xffffffff,0x20(%rsp)
jne    1570 <cmd_do+0x360>
cmp    $0x1,%r13d
jne    1557 <cmd_do+0x347>
lea    0x60(%rsp),%rbx
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <strcpy@plt>
lea    0xe0(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <escape_dq@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1120 <strcat@plt>
jmp    1566 <cmd_do+0x356>
lea    0x60(%rsp),%rdi
lea    0x40(%rsp),%rsi
call   1040 <strcpy@plt>
lea    0x60(%rsp),%rdi
call   10c0 <commit_kit@plt>
add    $0x80e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
@__const.cmd_do.AfterCmd = [6 x i8] c"after\00"
@__const.cmd_do.ManyCmd = [5 x i8] c"many\00"
@__const.cmd_do.EndMany = [4 x i8] c"EOF\00"
@__const.cmd_do.BaseMes = [15 x i8] c"[kit]add plan \00"
@__const.cmd_do.ManyMes = [20 x i8] c"[kit]add many plans\00"
@.str = [2 x i8] c"n\00"
@optind = global i32 0
@.str.1 = [61 x i8] c"Input commit messages and press Enter. Finally input \22EOF\22.\0A\00"
@.str.2 = [2 x i8] c">\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"\22\00"
define void @cmd_do(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [6 x i8]
%6 = alloca [5 x i8]
%7 = alloca [4 x i8]
%8 = alloca [15 x i8]
%9 = alloca [20 x i8]
%10 = alloca [128 x [128 x i8]]
%11 = alloca [128 x [128 x i8]]
%12 = alloca [128 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%19 = bitcast [6 x i8]* %5 to i8*
%20 = bitcast [5 x i8]* %6 to i8*
%21 = bitcast [4 x i8]* %7 to i8*
%22 = bitcast [15 x i8]* %8 to i8*
%23 = bitcast [20 x i8]* %9 to i8*
%24 = bitcast [128 x [128 x i8]]* %10 to i8*
store i32 0, i32* %16
store i32 0, i32* %17
store i32 1, i32* %18
%25 = load i32, i32* %3
%26 = load i8**, i8*** %4
%27 = call i32 @getopt(i32 %25, i8** %26, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%28 = icmp ne i32 %27, -1
br i1 %28, label %29, label %30
29: ; preds = %2
store i32 1, i32* %16
br label %30
30: ; preds = %29, %2
%31 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %10, i64 0, i64 0
%32 = bitcast [128 x i8]* %31 to i8**
%33 = call i32 @read_kit_file(i32 127, i8** %32)
store i32 %33, i32* %14
store i32 0, i32* %15
br label %34
34: ; preds = %81, %30
%35 = load i32, i32* @optind
%36 = load i32, i32* %3
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %84
38: ; preds = %34
%39 = load i8**, i8*** %4
%40 = load i32, i32* @optind
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = getelementptr inbounds [6 x i8], [6 x i8]* %5, i64 0, i64 0
%45 = call i64 @strcmp(i8* %43, i8* %44)
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %53
47: ; preds = %38
%48 = load i32, i32* %15
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = load i32, i32* %14
store i32 %51, i32* %15
br label %52
52: ; preds = %50, %47
br label %81
53: ; preds = %38
%54 = load i8**, i8*** %4
%55 = load i32, i32* @optind
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8*, i8** %54, i64 %56
%58 = load i8*, i8** %57
%59 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%60 = call i64 @strcmp(i8* %58, i8* %59)
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %53
store i32 1, i32* %17
br label %80
63: ; preds = %53
%64 = load i8**, i8*** %4
%65 = load i32, i32* @optind
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8*, i8** %64, i64 %66
%68 = load i8*, i8** %67
%69 = call i64 @is_num(i8* %68)
%70 = icmp eq i64 %69, 0
br i1 %70, label %71, label %78
71: ; preds = %63
%72 = load i8**, i8*** %4
%73 = load i32, i32* @optind
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8*, i8** %72, i64 %74
%76 = load i8*, i8** %75
%77 = call i32 @atoi(i8* %76)
store i32 %77, i32* %15
br label %79
78: ; preds = %63
br label %84
79: ; preds = %71
br label %80
80: ; preds = %79, %62
br label %81
81: ; preds = %80, %52
%82 = load i32, i32* @optind
%83 = add nsw i32 %82, 1
store i32 %83, i32* @optind
br label %34
84: ; preds = %78, %34
%85 = load i32, i32* %17
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %151
87: ; preds = %84
%88 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %18
br label %89
89: ; preds = %87, %144
%90 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%91 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%92 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %91)
%93 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%94 = call i32 @strlen(i8* %93)
%95 = icmp sgt i32 %94, 0
br i1 %95, label %96, label %144
96: ; preds = %89
%97 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%98 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 0
%99 = call i64 @strcmp(i8* %97, i8* %98)
%100 = icmp eq i64 %99, 0
br i1 %100, label %101, label %102
101: ; preds = %96
br label %145
102: ; preds = %96
%103 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = icmp ne i32 %105, 34
br i1 %106, label %116, label %107
107: ; preds = %102
%108 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%109 = call i32 @strlen(i8* %108)
%110 = sub nsw i32 %109, 1
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 %111
%113 = load i8, i8* %112
%114 = sext i8 %113 to i32
%115 = icmp ne i32 %114, 34
br i1 %115, label %116, label %133
116: ; preds = %107, %102
%117 = load i32, i32* %18
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %118
%120 = getelementptr inbounds [128 x i8], [128 x i8]* %119, i64 0, i64 0
%121 = call i32 @strcpy(i8* %120, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%122 = load i32, i32* %18
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %123
%125 = getelementptr inbounds [128 x i8], [128 x i8]* %124, i64 0, i64 0
%126 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%127 = call i32 @strcat(i8* %125, i8* %126)
%128 = load i32, i32* %18
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %129
%131 = getelementptr inbounds [128 x i8], [128 x i8]* %130, i64 0, i64 0
%132 = call i32 @strcat(i8* %131, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %140
133: ; preds = %107
%134 = load i32, i32* %18
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %135
%137 = getelementptr inbounds [128 x i8], [128 x i8]* %136, i64 0, i64 0
%138 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%139 = call i32 @strcpy(i8* %137, i8* %138)
br label %140
140: ; preds = %133, %116
%141 = load i32, i32* %18
%142 = add nsw i32 %141, 1
store i32 %142, i32* %18
br label %143
143: ; preds = %140
br label %144
144: ; preds = %143, %89
br label %89
145: ; preds = %101
%146 = load i32, i32* %18
%147 = icmp eq i32 %146, 0
br i1 %147, label %148, label %150
148: ; preds = %145
%149 = call i32 @exit(i32 1)
unreachable
150: ; preds = %145
br label %158
151: ; preds = %84
%152 = load i32, i32* %3
%153 = load i8**, i8*** %4
%154 = load i32, i32* @optind
%155 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 0
%156 = getelementptr inbounds [128 x i8], [128 x i8]* %155, i64 0, i64 0
%157 = call i32 @gen_arg_str(i32 %152, i8** %153, i32 %154, i8* %156)
br label %158
158: ; preds = %151, %150
%159 = load i32, i32* %14
%160 = load i32, i32* %18
%161 = add nsw i32 %159, %160
%162 = sub nsw i32 %161, 1
store i32 %162, i32* %13
br label %163
163: ; preds = %179, %158
%164 = load i32, i32* %13
%165 = load i32, i32* %15
%166 = icmp sgt i32 %164, %165
br i1 %166, label %167, label %182
167: ; preds = %163
%168 = load i32, i32* %13
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %10, i64 0, i64 %169
%171 = getelementptr inbounds [128 x i8], [128 x i8]* %170, i64 0, i64 0
%172 = load i32, i32* %13
%173 = load i32, i32* %18
%174 = sub nsw i32 %172, %173
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %10, i64 0, i64 %175
%177 = getelementptr inbounds [128 x i8], [128 x i8]* %176, i64 0, i64 0
%178 = call i32 @strcpy(i8* %171, i8* %177)
br label %179
179: ; preds = %167
%180 = load i32, i32* %13
%181 = add nsw i32 %180, -1
store i32 %181, i32* %13
br label %163
182: ; preds = %163
store i32 0, i32* %13
br label %183
183: ; preds = %199, %182
%184 = load i32, i32* %13
%185 = load i32, i32* %18
%186 = icmp slt i32 %184, %185
br i1 %186, label %187, label %202
187: ; preds = %183
%188 = load i32, i32* %13
%189 = load i32, i32* %15
%190 = add nsw i32 %188, %189
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %10, i64 0, i64 %191
%193 = getelementptr inbounds [128 x i8], [128 x i8]* %192, i64 0, i64 0
%194 = load i32, i32* %13
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 %195
%197 = getelementptr inbounds [128 x i8], [128 x i8]* %196, i64 0, i64 0
%198 = call i32 @strcpy(i8* %193, i8* %197)
br label %199
199: ; preds = %187
%200 = load i32, i32* %13
%201 = add nsw i32 %200, 1
store i32 %201, i32* %13
br label %183
202: ; preds = %183
%203 = load i32, i32* %14
%204 = load i32, i32* %18
%205 = add nsw i32 %203, %204
%206 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %10, i64 0, i64 0
%207 = bitcast [128 x i8]* %206 to i8**
%208 = call i32 @save_kit_file(i32 %205, i8** %207)
%209 = load i32, i32* %16
%210 = icmp eq i32 %209, 0
br i1 %210, label %211, label %232
211: ; preds = %202
%212 = load i32, i32* %18
%213 = icmp eq i32 %212, 1
br i1 %213, label %214, label %225
214: ; preds = %211
%215 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%216 = getelementptr inbounds [15 x i8], [15 x i8]* %8, i64 0, i64 0
%217 = call i32 @strcpy(i8* %215, i8* %216)
%218 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 0
%219 = getelementptr inbounds [128 x i8], [128 x i8]* %218, i64 0, i64 0
%220 = call i32 @escape_dq(i8* %219)
%221 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%222 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %11, i64 0, i64 0
%223 = getelementptr inbounds [128 x i8], [128 x i8]* %222, i64 0, i64 0
%224 = call i32 @strcat(i8* %221, i8* %223)
br label %229
225: ; preds = %211
%226 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%227 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%228 = call i32 @strcpy(i8* %226, i8* %227)
br label %229
229: ; preds = %225, %214
%230 = getelementptr inbounds [128 x i8], [128 x i8]* %12, i64 0, i64 0
%231 = call i32 @commit_kit(i8* %230)
br label %232
232: ; preds = %229, %202
ret void
}

LLVM IR (-O2):
@__const.cmd_do.AfterCmd = [6 x i8] c"after\00"
@__const.cmd_do.ManyCmd = [5 x i8] c"many\00"
@__const.cmd_do.BaseMes = [15 x i8] c"[kit]add plan \00"
@__const.cmd_do.ManyMes = [20 x i8] c"[kit]add many plans\00"
@.str = [2 x i8] c"n\00"
@optind = global i32 0
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [2 x i8] c"\22\00"
@str = [60 x i8] c"Input commit messages and press Enter. Finally input \22EOF\22.\00"
define void @cmd_do(i32 %0, i8** %1) {
%3 = alloca [6 x i8]
%4 = alloca [5 x i8]
%5 = alloca i32
%6 = alloca [15 x i8]
%7 = alloca [20 x i8]
%8 = alloca [128 x [128 x i8]]
%9 = alloca [128 x [128 x i8]]
%10 = alloca [128 x i8]
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%13 = bitcast i32* %5 to i8*
store i32 4607813, i32* %5
%14 = getelementptr inbounds [15 x i8], [15 x i8]* %6, i64 0, i64 0
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %8, i64 0, i64 0, i64 0
%17 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %9, i64 0, i64 0, i64 0
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 0
%19 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i32 %19, -1
%21 = bitcast [128 x [128 x i8]]* %8 to i8**
%22 = call i32 @read_kit_file(i32 127, i8** %21)
%23 = load i32, i32* @optind
%24 = icmp slt i32 %23, %0
br i1 %24, label %25, label %105
25: ; preds = %2, %57
%26 = phi i32 [ %61, %57 ], [ %23, %2 ]
%27 = phi i32 [ %59, %57 ], [ 0, %2 ]
%28 = phi i32 [ %58, %57 ], [ 0, %2 ]
%29 = sext i32 %26 to i64
%30 = getelementptr inbounds i8*, i8** %1, i64 %29
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* %11)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %25
%35 = icmp eq i32 %28, 0
%36 = select i1 %35, i32 %22, i32 %28
br label %57
37: ; preds = %25
%38 = load i32, i32* @optind
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %1, i64 %39
%41 = load i8*, i8** %40
%42 = call i64 @strcmp(i8* %41, i8* %12)
%43 = icmp eq i64 %42, 0
br i1 %43, label %57, label %44
44: ; preds = %37
%45 = load i32, i32* @optind
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %1, i64 %46
%48 = load i8*, i8** %47
%49 = call i64 @is_num(i8* %48)
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %63
51: ; preds = %44
%52 = load i32, i32* @optind
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %1, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @atoi(i8* %55)
br label %57
57: ; preds = %34, %37, %51
%58 = phi i32 [ %56, %51 ], [ %36, %34 ], [ %28, %37 ]
%59 = phi i32 [ %27, %51 ], [ %27, %34 ], [ 1, %37 ]
%60 = load i32, i32* @optind
%61 = add nsw i32 %60, 1
store i32 %61, i32* @optind
%62 = icmp slt i32 %61, %0
br i1 %62, label %25, label %63
63: ; preds = %57, %44
%64 = phi i32 [ %58, %57 ], [ %28, %44 ]
%65 = phi i32 [ %59, %57 ], [ %27, %44 ]
%66 = icmp eq i32 %65, 0
br i1 %66, label %105, label %67
67: ; preds = %63
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
br label %69
69: ; preds = %99, %67
%70 = phi i32 [ %100, %99 ], [ 0, %67 ]
br label %71
71: ; preds = %69, %71
%72 = call i32 @putchar(i32 62)
%73 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %18)
%74 = call i32 @strlen(i8* %18)
%75 = icmp sgt i32 %74, 0
br i1 %75, label %76, label %71
76: ; preds = %71
%77 = call i64 @strcmp(i8* %18, i8* %13)
%78 = icmp eq i64 %77, 0
br i1 %78, label %101, label %79
79: ; preds = %76
%80 = load i8, i8* %18
%81 = icmp eq i8 %80, 34
br i1 %81, label %82, label %89
82: ; preds = %79
%83 = call i32 @strlen(i8* %18)
%84 = add nsw i32 %83, -1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds [128 x i8], [128 x i8]* %10, i64 0, i64 %85
%87 = load i8, i8* %86
%88 = icmp eq i8 %87, 34
br i1 %88, label %95, label %89
89: ; preds = %82, %79
%90 = zext i32 %70 to i64
%91 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %9, i64 0, i64 %90, i64 0
%92 = call i32 @strcpy(i8* %91, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%93 = call i32 @strcat(i8* %91, i8* %18)
%94 = call i32 @strcat(i8* %91, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %99
95: ; preds = %82
%96 = zext i32 %70 to i64
%97 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %9, i64 0, i64 %96, i64 0
%98 = call i32 @strcpy(i8* %97, i8* %18)
br label %99
99: ; preds = %95, %89
%100 = add nuw nsw i32 %70, 1
br label %69
101: ; preds = %76
%102 = icmp eq i32 %70, 0
br i1 %102, label %103, label %109
103: ; preds = %101
%104 = call i32 @exit(i32 1)
unreachable
105: ; preds = %2, %63
%106 = phi i32 [ %64, %63 ], [ 0, %2 ]
%107 = load i32, i32* @optind
%108 = call i32 @gen_arg_str(i32 %0, i8** %1, i32 %107, i8* %17)
br label %109
109: ; preds = %101, %105
%110 = phi i32 [ %64, %101 ], [ %106, %105 ]
%111 = phi i32 [ %70, %101 ], [ 1, %105 ]
%112 = add nsw i32 %111, %22
%113 = add i32 %112, -1
%114 = icmp sgt i32 %113, %110
br i1 %114, label %115, label %119
115: ; preds = %109
%116 = sext i32 %113 to i64
%117 = zext i32 %111 to i64
%118 = sext i32 %110 to i64
br label %124
119: ; preds = %124, %109
%120 = icmp eq i32 %111, 0
br i1 %120, label %140, label %121
121: ; preds = %119
%122 = sext i32 %110 to i64
%123 = zext i32 %111 to i64
br label %132
124: ; preds = %115, %124
%125 = phi i64 [ %116, %115 ], [ %130, %124 ]
%126 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %8, i64 0, i64 %125, i64 0
%127 = sub nsw i64 %125, %117
%128 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %8, i64 0, i64 %127, i64 0
%129 = call i32 @strcpy(i8* %126, i8* %128)
%130 = add nsw i64 %125, -1
%131 = icmp sgt i64 %130, %118
br i1 %131, label %124, label %119
132: ; preds = %121, %132
%133 = phi i64 [ 0, %121 ], [ %138, %132 ]
%134 = add nsw i64 %133, %122
%135 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %8, i64 0, i64 %134, i64 0
%136 = getelementptr inbounds [128 x [128 x i8]], [128 x [128 x i8]]* %9, i64 0, i64 %133, i64 0
%137 = call i32 @strcpy(i8* %135, i8* %136)
%138 = add nuw nsw i64 %133, 1
%139 = icmp eq i64 %138, %123
br i1 %139, label %140, label %132
140: ; preds = %132, %119
%141 = call i32 @save_kit_file(i32 %112, i8** %21)
br i1 %20, label %142, label %152
142: ; preds = %140
%143 = icmp eq i32 %111, 1
br i1 %143, label %144, label %148
144: ; preds = %142
%145 = call i32 @strcpy(i8* %18, i8* %14)
%146 = call i32 @escape_dq(i8* %17)
%147 = call i32 @strcat(i8* %18, i8* %17)
br label %150
148: ; preds = %142
%149 = call i32 @strcpy(i8* %18, i8* %15)
br label %150
150: ; preds = %148, %144
%151 = call i32 @commit_kit(i8* %18)
br label %152
152: ; preds = %150, %140
ret void
}