#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 abs(unsigned int);
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int REQ_freq = 0;
  int REQ_tolerance = 0;
  const int avg[] = {1, 2, 4, 8, 16};
  int opendly = 0;
  int clkdiv = 0;
  int avg_i, Odly_i, Sdly_i, div_i;
  unsigned int freq;
  unsigned int ob_fun;
  int solution = 0;
  int op;
  int obj_max = 0, obj_clkdiv, obj_Odly, obj_Sdly, obj_avg;
  if (argc > 5 || argc < 2) {
    fprintf(stderr, "Operator error\n");
    return -1;
  }
  while ((op = getopt(argc, argv, "f:t:")) != -1) {
    switch (op) {
    case 'f':
      REQ_freq = atoi(optarg);
      break;
    case 't':
      REQ_tolerance = atoi(optarg);
      break;
    default:
      fprintf(stderr, "Unknow Operator [%c]\n", op);
      break;
    }
  }
  if (REQ_freq <= 0 || REQ_tolerance < 0) {
    fprintf(stderr, "Argument error\n");
    return -1;
  }
  printf("Request Frequency : [%d] , Frequency Tolerance: [%d]\n", REQ_freq,
         REQ_tolerance);
  int hit = 0;
  for (div_i = 1; div_i < 65536; div_i++) {
    if ((24000000 / div_i) < REQ_freq)
      break;
    for (Odly_i = 0; Odly_i < 262144; Odly_i++) {
      if ((24000000 / (div_i * (14 + Odly_i))) < REQ_freq)
        break;
      for (avg_i = 0; avg_i < 5; avg_i++) {
        for (Sdly_i = 1; Sdly_i < 256; Sdly_i++) {
          hit = 0;
          freq = 24000000 / (div_i * (Odly_i + avg[avg_i] * (14 + Sdly_i)));
          if (freq < REQ_freq)
            break;
          ob_fun = (div_i * 262144 + Odly_i) / avg[avg_i];
          if (freq == REQ_freq) {
            printf("\033[0;32;32m"
                   "[Conform] "
                   "\033[m");
            hit = 1;
          } else if (abs(freq - REQ_freq) < REQ_tolerance) {
            printf("\033[0;32;31m"
                   "[Similar][%d] "
                   "\033[m",
                   freq);
            hit = 1;
          }
          if (hit == 1) {
            if (ob_fun > obj_max) {
              obj_max = ob_fun;
              obj_clkdiv = div_i;
              obj_Odly = Odly_i;
              obj_Sdly = Sdly_i;
              obj_avg = avg[avg_i];
            }
            printf("Clock Divider : %d ,\t", div_i);
            printf("Open Dly : %d ,\t", Odly_i);
            printf("Sample Average : %d ,\t", avg[avg_i]);
            printf("Sample Dly : %d\n", Sdly_i);
            solution++;
          }
        }
      }
    }
  }
  printf("Feasible Solution count : %d\n", solution);
  printf("\n");
  printf("===============================================================\n");
  printf("\033[0;32;32m"
         "[Suggest Solution]\n"
         "\033[m");
  printf("\tClock Divider : %d ,\t", obj_clkdiv);
  printf("Open Dly : %d ,\t", obj_Odly);
  printf("Sample Average : %d ,\t", obj_avg);
  printf("Sample Dly : %d\n", obj_Sdly);
  printf("===============================================================\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    0xe82(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe7f(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe7d(%rip),%eax
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x5c(%rbp)
cmpl   $0x5,-0x8(%rbp)
jg     11c6 <main+0x76>
cmpl   $0x2,-0x8(%rbp)
jge    11e9 <main+0x99>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
lea    0xe3e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1564 <main+0x414>
jmp    11ee <main+0x9e>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe28(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x58(%rbp)
cmp    $0xffffffff,%eax
je     127d <main+0x12d>
mov    -0x58(%rbp),%eax
mov    %eax,-0x74(%rbp)
sub    $0x66,%eax
je     1232 <main+0xe2>
jmp    1221 <main+0xd1>
mov    -0x74(%rbp),%eax
sub    $0x74,%eax
je     1248 <main+0xf8>
jmp    125e <main+0x10e>
mov    0x2dbf(%rip),%rax
mov    (%rax),%edi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    1278 <main+0x128>
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    1278 <main+0x128>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
mov    -0x58(%rbp),%edx
lea    0xdb8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    11ee <main+0x9e>
cmpl   $0x0,-0x14(%rbp)
jle    1291 <main+0x141>
cmpl   $0x0,-0x18(%rbp)
jge    12b4 <main+0x164>
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
lea    0xd9e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1564 <main+0x414>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x70(%rbp)
movl   $0x1,-0x48(%rbp)
cmpl   $0x10000,-0x48(%rbp)
jge    14d7 <main+0x387>
mov    $0x16e3600,%eax
cltd
idivl  -0x48(%rbp)
cmp    -0x14(%rbp),%eax
jge    12fa <main+0x1aa>
jmp    14d7 <main+0x387>
movl   $0x0,-0x40(%rbp)
cmpl   $0x40000,-0x40(%rbp)
jge    14c4 <main+0x374>
mov    -0x48(%rbp),%ecx
mov    -0x40(%rbp),%eax
add    $0xe,%eax
imul   %eax,%ecx
mov    $0x16e3600,%eax
cltd
idiv   %ecx
cmp    -0x14(%rbp),%eax
jge    1330 <main+0x1e0>
jmp    14c4 <main+0x374>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x5,-0x3c(%rbp)
jge    14b1 <main+0x361>
movl   $0x1,-0x44(%rbp)
cmpl   $0x100,-0x44(%rbp)
jge    149e <main+0x34e>
movl   $0x0,-0x70(%rbp)
mov    -0x48(%rbp),%ecx
mov    -0x40(%rbp),%eax
movslq -0x3c(%rbp),%rdx
mov    -0x30(%rbp,%rdx,4),%edx
mov    -0x44(%rbp),%esi
add    $0xe,%esi
imul   %esi,%edx
add    %edx,%eax
imul   %eax,%ecx
mov    $0x16e3600,%eax
cltd
idiv   %ecx
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1394 <main+0x244>
jmp    149e <main+0x34e>
mov    -0x48(%rbp),%eax
shl    $0x12,%eax
add    -0x40(%rbp),%eax
movslq -0x3c(%rbp),%rcx
cltd
idivl  -0x30(%rbp,%rcx,4)
mov    %eax,-0x50(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    13cf <main+0x27f>
lea    0xcc9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x70(%rbp)
jmp    1400 <main+0x2b0>
mov    -0x4c(%rbp),%edi
sub    -0x14(%rbp),%edi
call   1030 <abs@plt>
cmp    -0x18(%rbp),%eax
jge    13fb <main+0x2ab>
mov    -0x4c(%rbp),%esi
lea    0xcb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x70(%rbp)
jmp    1400 <main+0x2b0>
cmpl   $0x1,-0x70(%rbp)
jne    148b <main+0x33b>
mov    -0x50(%rbp),%eax
cmp    -0x5c(%rbp),%eax
jbe    1439 <main+0x2e9>
mov    -0x50(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x68(%rbp)
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x48(%rbp),%esi
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%esi
lea    0xc65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xc60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0xc66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1490 <main+0x340>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1348 <main+0x1f8>
jmp    14a3 <main+0x353>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1337 <main+0x1e7>
jmp    14b6 <main+0x366>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1301 <main+0x1b1>
jmp    14c9 <main+0x379>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    12d6 <main+0x186>
mov    -0x54(%rbp),%esi
lea    0xc11(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x60(%rbp),%esi
lea    0xc56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x64(%rbp),%esi
lea    0xb8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x6c(%rbp),%esi
lea    0xb8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%esi
lea    0xb92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %edi,%ebx
lea    -0x6(%rbx),%eax
cmp    $0xfffffffc,%eax
jae    118d <main+0x2d>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
jmp    140c <main+0x2ac>
mov    %rsi,%r14
lea    0xe8d(%rip),%r15
mov    0x2e5a(%rip),%rbp
mov    0x2e33(%rip),%r13
lea    0xe7d(%rip),%r12
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1070 <getopt@plt>
cmp    $0xffffffff,%eax
je     120a <main+0xaa>
cmp    $0x74,%eax
je     11ee <main+0x8e>
cmp    $0x66,%eax
je     11fc <main+0x9c>
mov    0x0(%r13),%edi
mov    %r12,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
jmp    11c0 <main+0x60>
mov    0x0(%rbp),%edi
call   1080 <atoi@plt>
mov    %eax,0x8(%rsp)
jmp    11c0 <main+0x60>
mov    0x0(%rbp),%edi
call   1080 <atoi@plt>
mov    %eax,0x10(%rsp)
jmp    11c0 <main+0x60>
mov    0x10(%rsp),%r15d
test   %r15d,%r15d
jle    1401 <main+0x2a1>
cmpl   $0x0,0x8(%rsp)
js     1401 <main+0x2a1>
lea    0xe25(%rip),%rdi
mov    %r15d,%esi
mov    0x8(%rsp),%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ecx
movl   $0x0,0x14(%rsp)
xor    %esi,%esi
jmp    1263 <main+0x103>
nopl   0x0(%rax)
mov    0xc(%rsp),%ecx
add    $0x1,%ecx
cmp    $0x10000,%ecx
je     141d <main+0x2bd>
mov    $0x16e3600,%eax
xor    %edx,%edx
div    %ecx
cmp    %r15d,%eax
jl     141d <main+0x2bd>
mov    %ecx,0xc(%rsp)
mov    %ecx,%eax
shl    $0x12,%eax
mov    %rax,0x38(%rsp)
xor    %ebx,%ebx
jmp    129b <main+0x13b>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
cmp    $0x40000,%ebx
je     1250 <main+0xf0>
lea    0xe(%rbx),%ecx
imul   0xc(%rsp),%ecx
mov    $0x16e3600,%eax
xor    %edx,%edx
div    %ecx
cmp    %r15d,%eax
jl     1250 <main+0xf0>
mov    0x38(%rsp),%rax
add    %ebx,%eax
mov    %eax,0x30(%rsp)
xor    %ecx,%ecx
jmp    12cf <main+0x16f>
mov    0x40(%rsp),%rcx
add    $0x1,%rcx
cmp    $0x5,%rcx
je     1290 <main+0x130>
lea    0xd2a(%rip),%rax
mov    %rcx,0x40(%rsp)
mov    (%rax,%rcx,4),%ecx
lea    (%rcx,%rcx,4),%eax
lea    (%rax,%rax,2),%r12d
add    %ebx,%r12d
mov    0xc(%rsp),%eax
imul   %eax,%r12d
mov    %rcx,0x18(%rsp)
imul   %ecx,%eax
mov    %eax,0x34(%rsp)
mov    $0x1,%r13d
jmp    1373 <main+0x213>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe1b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd94(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd95(%rip),%rdi
mov    0x18(%rsp),%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd99(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,%esi
add    $0x1,%esi
mov    0x10(%rsp),%r15d
add    $0x1,%r13d
add    0x34(%rsp),%r12d
cmp    $0x100,%r13d
je     12c0 <main+0x160>
mov    $0x16e3600,%eax
xor    %edx,%edx
idiv   %r12d
cmp    %r15d,%eax
jb     12c0 <main+0x160>
mov    %eax,%ebp
mov    0x30(%rsp),%eax
cltd
idivl  0x18(%rsp)
mov    %eax,%r14d
mov    %ebp,%eax
sub    %r15d,%eax
jne    13b0 <main+0x250>
mov    %esi,%r15d
lea    0xce0(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    13d0 <main+0x270>
xchg   %ax,%ax
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
cmp    0x8(%rsp),%ecx
jge    135d <main+0x1fd>
mov    %esi,%r15d
lea    0xcd6(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    0x14(%rsp),%r14d
mov    0xc(%rsp),%esi
jbe    1310 <main+0x1b0>
mov    %r14d,0x14(%rsp)
mov    %esi,0x20(%rsp)
mov    %ebx,%eax
mov    %ebx,0x24(%rsp)
mov    %r13d,0x2c(%rsp)
mov    0x18(%rsp),%rax
mov    %eax,0x28(%rsp)
jmp    1310 <main+0x1b0>
mov    0x0(%r13),%edi
lea    0xc33(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xffffffff,%ebx
jmp    14a4 <main+0x344>
lea    0xcce(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd0a(%rip),%rbp
mov    %rbp,%rdi
call   1040 <puts@plt>
lea    0xcc3(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xcd6(%rip),%rdi
mov    0x20(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc4c(%rip),%rdi
mov    0x24(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc4b(%rip),%rdi
mov    0x28(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc50(%rip),%rdi
mov    0x2c(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.avg = [5 x i32] [i32 1, i32 2, i32 4, i32 8, i32 16]
@stderr = global i32 0
@.str = [16 x i8] c"Operator error\0A\00"
@.str.1 = [5 x i8] c"f:t:\00"
@optarg = global i32 0
@.str.2 = [22 x i8] c"Unknow Operator [%c]\0A\00"
@.str.3 = [16 x i8] c"Argument error\0A\00"
@.str.4 = [54 x i8] c"Request Frequency : [%d] , Frequency Tolerance: [%d]\0A\00"
@.str.5 = [24 x i8] c"\1B[0;32;32m[Conform] \1B[m\00"
@.str.6 = [28 x i8] c"\1B[0;32;31m[Similar][%d] \1B[m\00"
@.str.7 = [22 x i8] c"Clock Divider : %d ,\09\00"
@.str.8 = [17 x i8] c"Open Dly : %d ,\09\00"
@.str.9 = [23 x i8] c"Sample Average : %d ,\09\00"
@.str.10 = [17 x i8] c"Sample Dly : %d\0A\00"
@.str.11 = [30 x i8] c"Feasible Solution count : %d\0A\00"
@.str.12 = [2 x i8] c"\0A\00"
@.str.13 = [65 x i8] c"===============================================================\0A\00"
@.str.14 = [33 x i8] c"\1B[0;32;32m[Suggest Solution]\0A\1B[m\00"
@.str.15 = [23 x i8] c"\09Clock Divider : %d ,\09\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [5 x i32]
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
%25 = bitcast [5 x i32]* %8 to i8*
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %17
store i32 0, i32* %19
%26 = load i32, i32* %4
%27 = icmp sgt i32 %26, 5
br i1 %27, label %31, label %28
28: ; preds = %2
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 2
br i1 %30, label %31, label %34
31: ; preds = %28, %2
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %200
34: ; preds = %28
br label %35
35: ; preds = %52, %34
%36 = load i32, i32* %4
%37 = load i8**, i8*** %5
%38 = call i32 @getopt(i32 %36, i8** %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i32 %38, i32* %18
%39 = icmp ne i32 %38, -1
br i1 %39, label %40, label %53
40: ; preds = %35
%41 = load i32, i32* %18
switch i32 %41, label %48 [
i32 102, label %42
i32 116, label %45
]
42: ; preds = %40
%43 = load i32, i32* @optarg
%44 = call i32 @atoi(i32 %43)
store i32 %44, i32* %6
br label %52
45: ; preds = %40
%46 = load i32, i32* @optarg
%47 = call i32 @atoi(i32 %46)
store i32 %47, i32* %7
br label %52
48: ; preds = %40
%49 = load i32, i32* @stderr
%50 = load i32, i32* %18
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %48, %45, %42
br label %35
53: ; preds = %35
%54 = load i32, i32* %6
%55 = icmp sle i32 %54, 0
br i1 %55, label %59, label %56
56: ; preds = %53
%57 = load i32, i32* %7
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %56, %53
%60 = load i32, i32* @stderr
%61 = call i32 (i32, i8*, ...) @fprintf(i32 %60, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
store i32 -1, i32* %3
br label %200
62: ; preds = %56
%63 = load i32, i32* %6
%64 = load i32, i32* %7
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i32 %63, i32 %64)
store i32 0, i32* %24
store i32 1, i32* %14
br label %66
66: ; preds = %182, %62
%67 = load i32, i32* %14
%68 = icmp slt i32 %67, 65536
br i1 %68, label %69, label %185
69: ; preds = %66
%70 = load i32, i32* %14
%71 = sdiv i32 24000000, %70
%72 = load i32, i32* %6
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %75
74: ; preds = %69
br label %185
75: ; preds = %69
store i32 0, i32* %12
br label %76
76: ; preds = %178, %75
%77 = load i32, i32* %12
%78 = icmp slt i32 %77, 262144
br i1 %78, label %79, label %181
79: ; preds = %76
%80 = load i32, i32* %14
%81 = load i32, i32* %12
%82 = add nsw i32 14, %81
%83 = mul nsw i32 %80, %82
%84 = sdiv i32 24000000, %83
%85 = load i32, i32* %6
%86 = icmp slt i32 %84, %85
br i1 %86, label %87, label %88
87: ; preds = %79
br label %181
88: ; preds = %79
store i32 0, i32* %11
br label %89
89: ; preds = %174, %88
%90 = load i32, i32* %11
%91 = icmp slt i32 %90, 5
br i1 %91, label %92, label %177
92: ; preds = %89
store i32 1, i32* %13
br label %93
93: ; preds = %170, %92
%94 = load i32, i32* %13
%95 = icmp slt i32 %94, 256
br i1 %95, label %96, label %173
96: ; preds = %93
store i32 0, i32* %24
%97 = load i32, i32* %14
%98 = load i32, i32* %12
%99 = load i32, i32* %11
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %100
%102 = load i32, i32* %101
%103 = load i32, i32* %13
%104 = add nsw i32 14, %103
%105 = mul nsw i32 %102, %104
%106 = add nsw i32 %98, %105
%107 = mul nsw i32 %97, %106
%108 = sdiv i32 24000000, %107
store i32 %108, i32* %15
%109 = load i32, i32* %15
%110 = load i32, i32* %6
%111 = icmp ult i32 %109, %110
br i1 %111, label %112, label %113
112: ; preds = %96
br label %173
113: ; preds = %96
%114 = load i32, i32* %14
%115 = mul nsw i32 %114, 262144
%116 = load i32, i32* %12
%117 = add nsw i32 %115, %116
%118 = load i32, i32* %11
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %119
%121 = load i32, i32* %120
%122 = sdiv i32 %117, %121
store i32 %122, i32* %16
%123 = load i32, i32* %15
%124 = load i32, i32* %6
%125 = icmp eq i32 %123, %124
br i1 %125, label %126, label %128
126: ; preds = %113
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %24
br label %139
128: ; preds = %113
%129 = load i32, i32* %15
%130 = load i32, i32* %6
%131 = sub i32 %129, %130
%132 = call i32 @abs(i32 %131)
%133 = load i32, i32* %7
%134 = icmp slt i32 %132, %133
br i1 %134, label %135, label %138
135: ; preds = %128
%136 = load i32, i32* %15
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %136)
store i32 1, i32* %24
br label %138
138: ; preds = %135, %128
br label %139
139: ; preds = %138, %126
%140 = load i32, i32* %24
%141 = icmp eq i32 %140, 1
br i1 %141, label %142, label %169
142: ; preds = %139
%143 = load i32, i32* %16
%144 = load i32, i32* %19
%145 = icmp ugt i32 %143, %144
br i1 %145, label %146, label %155
146: ; preds = %142
%147 = load i32, i32* %16
store i32 %147, i32* %19
%148 = load i32, i32* %14
store i32 %148, i32* %20
%149 = load i32, i32* %12
store i32 %149, i32* %21
%150 = load i32, i32* %13
store i32 %150, i32* %22
%151 = load i32, i32* %11
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %152
%154 = load i32, i32* %153
store i32 %154, i32* %23
br label %155
155: ; preds = %146, %142
%156 = load i32, i32* %14
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %156)
%158 = load i32, i32* %12
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %158)
%160 = load i32, i32* %11
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %161
%163 = load i32, i32* %162
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %163)
%165 = load i32, i32* %13
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %165)
%167 = load i32, i32* %17
%168 = add nsw i32 %167, 1
store i32 %168, i32* %17
br label %169
169: ; preds = %155, %139
br label %170
170: ; preds = %169
%171 = load i32, i32* %13
%172 = add nsw i32 %171, 1
store i32 %172, i32* %13
br label %93
173: ; preds = %112, %93
br label %174
174: ; preds = %173
%175 = load i32, i32* %11
%176 = add nsw i32 %175, 1
store i32 %176, i32* %11
br label %89
177: ; preds = %89
br label %178
178: ; preds = %177
%179 = load i32, i32* %12
%180 = add nsw i32 %179, 1
store i32 %180, i32* %12
br label %76
181: ; preds = %87, %76
br label %182
182: ; preds = %181
%183 = load i32, i32* %14
%184 = add nsw i32 %183, 1
store i32 %184, i32* %14
br label %66
185: ; preds = %74, %66
%186 = load i32, i32* %17
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i32 %186)
%188 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.13, i64 0, i64 0))
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0))
%191 = load i32, i32* %20
%192 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0), i32 %191)
%193 = load i32, i32* %21
%194 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %193)
%195 = load i32, i32* %23
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %195)
%197 = load i32, i32* %22
%198 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %197)
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.13, i64 0, i64 0))
br label %200
200: ; preds = %185, %59, %31
%201 = load i32, i32* %3
ret i32 %201
}

LLVM IR (-O2):
@__const.main.avg = [5 x i32] [i32 1, i32 2, i32 4, i32 8, i32 16]
@stderr = global i32 0
@.str = [16 x i8] c"Operator error\0A\00"
@.str.1 = [5 x i8] c"f:t:\00"
@optarg = global i32 0
@.str.2 = [22 x i8] c"Unknow Operator [%c]\0A\00"
@.str.3 = [16 x i8] c"Argument error\0A\00"
@.str.4 = [54 x i8] c"Request Frequency : [%d] , Frequency Tolerance: [%d]\0A\00"
@.str.5 = [24 x i8] c"\1B[0;32;32m[Conform] \1B[m\00"
@.str.6 = [28 x i8] c"\1B[0;32;31m[Similar][%d] \1B[m\00"
@.str.7 = [22 x i8] c"Clock Divider : %d ,\09\00"
@.str.8 = [17 x i8] c"Open Dly : %d ,\09\00"
@.str.9 = [23 x i8] c"Sample Average : %d ,\09\00"
@.str.10 = [17 x i8] c"Sample Dly : %d\0A\00"
@.str.11 = [30 x i8] c"Feasible Solution count : %d\0A\00"
@.str.14 = [33 x i8] c"\1B[0;32;32m[Suggest Solution]\0A\1B[m\00"
@.str.15 = [23 x i8] c"\09Clock Divider : %d ,\09\00"
@str.16 = [64 x i8] c"===============================================================\00"
define i32 @main(i32 %0, i8** %1) {
%3 = add i32 %0, -6
%4 = icmp ult i32 %3, -4
br i1 %4, label %5, label %16
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %153
8: ; preds = %19, %21
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
switch i32 %9, label %21 [
i32 -1, label %24
i32 102, label %10
i32 116, label %13
]
10: ; preds = %8
%11 = load i32, i32* @optarg
%12 = tail call i32 @atoi(i32 %11)
br label %19
13: ; preds = %8
%14 = load i32, i32* @optarg
%15 = tail call i32 @atoi(i32 %14)
br label %16
16: ; preds = %2, %13
%17 = phi i32 [ %15, %13 ], [ 0, %2 ]
%18 = phi i32 [ %20, %13 ], [ 0, %2 ]
br label %19
19: ; preds = %16, %10
%20 = phi i32 [ %18, %16 ], [ %12, %10 ]
br label %8
21: ; preds = %8
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %9)
br label %8
24: ; preds = %8
%25 = icmp slt i32 %20, 1
%26 = icmp slt i32 %17, 0
%27 = select i1 %25, i1 true, i1 %26
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i32, i32* @stderr
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %153
31: ; preds = %24
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i32 %20, i32 %17)
br label %33
33: ; preds = %31, %129
%34 = phi i32 [ undef, %31 ], [ %135, %129 ]
%35 = phi i32 [ undef, %31 ], [ %134, %129 ]
%36 = phi i32 [ undef, %31 ], [ %133, %129 ]
%37 = phi i32 [ undef, %31 ], [ %132, %129 ]
%38 = phi i32 [ 0, %31 ], [ %131, %129 ]
%39 = phi i32 [ 0, %31 ], [ %130, %129 ]
%40 = phi i32 [ 1, %31 ], [ %136, %129 ]
%41 = udiv i32 24000000, %40
%42 = icmp slt i32 %41, %20
br i1 %42, label %138, label %43
43: ; preds = %33
%44 = shl nsw i32 %40, 18
br label %45
45: ; preds = %43, %126
%46 = phi i32 [ %34, %43 ], [ %123, %126 ]
%47 = phi i32 [ %35, %43 ], [ %122, %126 ]
%48 = phi i32 [ %36, %43 ], [ %121, %126 ]
%49 = phi i32 [ %37, %43 ], [ %120, %126 ]
%50 = phi i32 [ %38, %43 ], [ %119, %126 ]
%51 = phi i32 [ %39, %43 ], [ %118, %126 ]
%52 = phi i32 [ 0, %43 ], [ %127, %126 ]
%53 = add nuw nsw i32 %52, 14
%54 = mul nuw nsw i32 %53, %40
%55 = udiv i32 24000000, %54
%56 = icmp slt i32 %55, %20
br i1 %56, label %129, label %57
57: ; preds = %45
%58 = add nuw nsw i32 %52, %44
br label %59
59: ; preds = %57, %117
%60 = phi i64 [ 0, %57 ], [ %124, %117 ]
%61 = phi i32 [ %46, %57 ], [ %123, %117 ]
%62 = phi i32 [ %47, %57 ], [ %122, %117 ]
%63 = phi i32 [ %48, %57 ], [ %121, %117 ]
%64 = phi i32 [ %49, %57 ], [ %120, %117 ]
%65 = phi i32 [ %50, %57 ], [ %119, %117 ]
%66 = phi i32 [ %51, %57 ], [ %118, %117 ]
%67 = getelementptr inbounds [5 x i32], [5 x i32]* @__const.main.avg, i64 0, i64 %60
%68 = load i32, i32* %67
br label %69
69: ; preds = %59, %108
%70 = phi i32 [ %61, %59 ], [ %114, %108 ]
%71 = phi i32 [ %62, %59 ], [ %113, %108 ]
%72 = phi i32 [ %63, %59 ], [ %112, %108 ]
%73 = phi i32 [ %64, %59 ], [ %111, %108 ]
%74 = phi i32 [ %65, %59 ], [ %110, %108 ]
%75 = phi i32 [ %66, %59 ], [ %109, %108 ]
%76 = phi i32 [ 1, %59 ], [ %115, %108 ]
%77 = add nuw nsw i32 %76, 14
%78 = mul nsw i32 %68, %77
%79 = add nsw i32 %78, %52
%80 = mul nsw i32 %79, %40
%81 = sdiv i32 24000000, %80
%82 = icmp ult i32 %81, %20
br i1 %82, label %117, label %83
83: ; preds = %69
%84 = sdiv i32 %58, %68
%85 = icmp eq i32 %81, %20
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
br label %94
88: ; preds = %83
%89 = sub i32 %81, %20
%90 = tail call i32 @llvm.abs.i32(i32 %89, i1 true)
%91 = icmp slt i32 %90, %17
br i1 %91, label %92, label %108
92: ; preds = %88
%93 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %81)
br label %94
94: ; preds = %86, %92
%95 = icmp ugt i32 %84, %74
br i1 %95, label %96, label %97
96: ; preds = %94
br label %97
97: ; preds = %96, %94
%98 = phi i32 [ %84, %96 ], [ %74, %94 ]
%99 = phi i32 [ %40, %96 ], [ %73, %94 ]
%100 = phi i32 [ %52, %96 ], [ %72, %94 ]
%101 = phi i32 [ %76, %96 ], [ %71, %94 ]
%102 = phi i32 [ %68, %96 ], [ %70, %94 ]
%103 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i32 %40)
%104 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %52)
%105 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %68)
%106 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %76)
%107 = add nsw i32 %75, 1
br label %108
108: ; preds = %88, %97
%109 = phi i32 [ %107, %97 ], [ %75, %88 ]
%110 = phi i32 [ %98, %97 ], [ %74, %88 ]
%111 = phi i32 [ %99, %97 ], [ %73, %88 ]
%112 = phi i32 [ %100, %97 ], [ %72, %88 ]
%113 = phi i32 [ %101, %97 ], [ %71, %88 ]
%114 = phi i32 [ %102, %97 ], [ %70, %88 ]
%115 = add nuw nsw i32 %76, 1
%116 = icmp eq i32 %115, 256
br i1 %116, label %117, label %69
117: ; preds = %108, %69
%118 = phi i32 [ %109, %108 ], [ %75, %69 ]
%119 = phi i32 [ %110, %108 ], [ %74, %69 ]
%120 = phi i32 [ %111, %108 ], [ %73, %69 ]
%121 = phi i32 [ %112, %108 ], [ %72, %69 ]
%122 = phi i32 [ %113, %108 ], [ %71, %69 ]
%123 = phi i32 [ %114, %108 ], [ %70, %69 ]
%124 = add nuw nsw i64 %60, 1
%125 = icmp eq i64 %124, 5
br i1 %125, label %126, label %59
126: ; preds = %117
%127 = add nuw nsw i32 %52, 1
%128 = icmp eq i32 %127, 262144
br i1 %128, label %129, label %45
129: ; preds = %126, %45
%130 = phi i32 [ %118, %126 ], [ %51, %45 ]
%131 = phi i32 [ %119, %126 ], [ %50, %45 ]
%132 = phi i32 [ %120, %126 ], [ %49, %45 ]
%133 = phi i32 [ %121, %126 ], [ %48, %45 ]
%134 = phi i32 [ %122, %126 ], [ %47, %45 ]
%135 = phi i32 [ %123, %126 ], [ %46, %45 ]
%136 = add nuw nsw i32 %40, 1
%137 = icmp eq i32 %136, 65536
br i1 %137, label %138, label %33
138: ; preds = %33, %129
%139 = phi i32 [ %39, %33 ], [ %130, %129 ]
%140 = phi i32 [ %37, %33 ], [ %132, %129 ]
%141 = phi i32 [ %36, %33 ], [ %133, %129 ]
%142 = phi i32 [ %35, %33 ], [ %134, %129 ]
%143 = phi i32 [ %34, %33 ], [ %135, %129 ]
%144 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.11, i64 0, i64 0), i32 %139)
%145 = tail call i32 @putchar(i32 10)
%146 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.16, i64 0, i64 0))
%147 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0))
%148 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.15, i64 0, i64 0), i32 %140)
%149 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 %141)
%150 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %143)
%151 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i64 0, i64 0), i32 %142)
%152 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str.16, i64 0, i64 0))
br label %153
153: ; preds = %138, %28, %5
%154 = phi i32 [ -1, %5 ], [ -1, %28 ], [ 0, %138 ]
ret i32 %154
}