// File: mouda[P]LTE_random_access-simulate/parse.cpp
// Function: lineParsing(int, char**)
void lineParsing (int argc, char** argv) {
  if (argc == 1) {
    showHelp();
    exit(0);
  }
  else {

    for (int i = 1; i < argc; i++) {
      if (!strcmp(argv[i], "-help")) {
        showHelp();
        exit(0);
      }
      else if (!strcmp(argv[i], "-end")) {
        lte::EndNum = atoi(argv[++i]);
	cerr << "EndNum = \t" << lte::EndNum << endl;
      }
      else if (!strcmp(argv[i], "-rand")) {
        lte::RandomBackoffIndex = atoi(argv[++i]);
	cerr << "Random Backoff Index = \t" << lte::RandomBackoffIndex << endl;
      }
      else if (!strcmp(argv[i], "-type")) {
        if (!strcmp(argv[++i], "uniform")) {
          lte::traffic_type = uniform_start;
	  cerr << "traffic type = \t" << "uniform\n";
	}
        else if (!strcmp(argv[i], "beta")) {
          lte::traffic_type = beta_start;
	  cerr << "traffic type = \t" << "beta\n";
	}
        else {
          cerr << "false traffic type " << argv[i] << endl;
          exit(1);
        }
      } 
      else if (!strcmp(argv[i], "-max")) {
	lte::MAX = atoi(argv[++i]);
	cerr << "limit of retransmition = \t" << lte::MAX << endl;
      }
      else if (!strcmp(argv[i], "-pre")) {
	double part = atoi(argv[++i]);
	if ((part >= 1) && (part <= 54)) {
	    lte::preambleNum = part;
	    cerr << "Num. of preamble for machine = \t" 
              << lte::preambleNum <<endl;
	}
      }
      else {
        cerr << "false argument " << argv[i] << endl;
        exit(1);
      }
    }

  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x1, -0x4(%rbp)
jne 0x3c61
callq 0x3bb0
xorl %edi, %edi
callq 0x3380
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x4019
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x5144d(%rip), %rsi     # 0x550d4
callq 0x3400
cmpl $0x0, %eax
jne 0x3c9d
callq 0x3bb0
xorl %edi, %edi
callq 0x3380
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x5142a(%rip), %rsi     # 0x550da
callq 0x3400
cmpl $0x0, %eax
jne 0x3d16
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3440
movl %eax, %ecx
leaq 0x615e8(%rip), %rax     # 0x652c4
movl %ecx, (%rax)
movq 0x6130b(%rip), %rdi     # 0x64ff0
leaq 0x513f3(%rip), %rsi     # 0x550df
callq 0x32e0
movq %rax, %rdi
leaq 0x615c9(%rip), %rax     # 0x652c4
movl (%rax), %esi
callq 0x34a0
movq %rax, %rdi
movq 0x612b4(%rip), %rsi     # 0x64fc0
callq 0x3310
jmp 0x4007
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x513c1(%rip), %rsi     # 0x550ea
callq 0x3400
cmpl $0x0, %eax
jne 0x3d8f
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3440
movl %eax, %ecx
leaq 0x6157b(%rip), %rax     # 0x652d0
movl %ecx, (%rax)
movq 0x61292(%rip), %rdi     # 0x64ff0
leaq 0x5138b(%rip), %rsi     # 0x550f0
callq 0x32e0
movq %rax, %rdi
leaq 0x6155c(%rip), %rax     # 0x652d0
movl (%rax), %esi
callq 0x34a0
movq %rax, %rdi
movq 0x6123b(%rip), %rsi     # 0x64fc0
callq 0x3310
jmp 0x4005
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x51367(%rip), %rsi     # 0x55109
callq 0x3400
cmpl $0x0, %eax
jne 0x3e9e
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x51344(%rip), %rsi     # 0x5510f
callq 0x3400
cmpl $0x0, %eax
jne 0x3e09
leaq 0x61500(%rip), %rax     # 0x652dc
movl $0x2, (%rax)
movq 0x61207(%rip), %rdi     # 0x64ff0
leaq 0x51327(%rip), %rsi     # 0x55117
callq 0x32e0
movq %rax, %rdi
leaq 0x51329(%rip), %rsi     # 0x55128
callq 0x32e0
jmp 0x3e99
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x51315(%rip), %rsi     # 0x55131
callq 0x3400
cmpl $0x0, %eax
jne 0x3e57
leaq 0x614af(%rip), %rax     # 0x652dc
movl $0x3, (%rax)
movq 0x611b6(%rip), %rdi     # 0x64ff0
leaq 0x512d6(%rip), %rsi     # 0x55117
callq 0x32e0
movq %rax, %rdi
leaq 0x512e6(%rip), %rsi     # 0x55136
callq 0x32e0
jmp 0x3e97
movq 0x61192(%rip), %rdi     # 0x64ff0
leaq 0x512d7(%rip), %rsi     # 0x5513c
callq 0x32e0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x32e0
movq %rax, %rdi
movq 0x61138(%rip), %rsi     # 0x64fc0
callq 0x3310
movl $0x1, %edi
callq 0x3380
jmp 0x3e99
jmp 0x4003
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x5129f(%rip), %rsi     # 0x55150
callq 0x3400
cmpl $0x0, %eax
jne 0x3f17
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3440
movl %eax, %ecx
leaq 0x613ef(%rip), %rax     # 0x652cc
movl %ecx, (%rax)
movq 0x6110a(%rip), %rdi     # 0x64ff0
leaq 0x51268(%rip), %rsi     # 0x55155
callq 0x32e0
movq %rax, %rdi
leaq 0x613d0(%rip), %rax     # 0x652cc
movl (%rax), %esi
callq 0x34a0
movq %rax, %rdi
movq 0x610b3(%rip), %rsi     # 0x64fc0
callq 0x3310
jmp 0x4001
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x51246(%rip), %rsi     # 0x55170
callq 0x3400
cmpl $0x0, %eax
jne 0x3fbf
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x3440
cvtsi2sd %eax, %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x20(%rbp), %xmm0
movsd 0x510a1(%rip), %xmm1    # 0x55008
ucomisd %xmm1, %xmm0
jb 0x3fbd
movsd 0x5109b(%rip), %xmm0    # 0x55010
ucomisd -0x20(%rbp), %xmm0
jb 0x3fbd
cvttsd2si -0x20(%rbp), %ecx
leaq 0x61338(%rip), %rax     # 0x652c0
movl %ecx, (%rax)
movq 0x6105f(%rip), %rdi     # 0x64ff0
leaq 0x511dd(%rip), %rsi     # 0x55175
callq 0x32e0
movq %rax, %rdi
leaq 0x61319(%rip), %rax     # 0x652c0
movl (%rax), %esi
callq 0x34a0
movq %rax, %rdi
movq 0x61008(%rip), %rsi     # 0x64fc0
callq 0x3310
jmp 0x3fff
movq 0x6102a(%rip), %rdi     # 0x64ff0
leaq 0x511c9(%rip), %rsi     # 0x55196
callq 0x32e0
movq %rax, %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x32e0
movq %rax, %rdi
movq 0x60fd0(%rip), %rsi     # 0x64fc0
callq 0x3310
movl $0x1, %edi
callq 0x3380
jmp 0x4001
jmp 0x4003
jmp 0x4005
jmp 0x4007
jmp 0x4009
jmp 0x400b
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3c68
jmp 0x401b
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)