#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 /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, ...);
int /*<<< orphan*/ test_DNA(int, int);
int main(int argc, char *argv[]) {
  int i;
  int ploidy;
  int verbose;
  char vopt;
  if (argc > 1) {
    int scanstat = sscanf(argv[1], "%d", &ploidy);
    if (scanstat != 1) {
      printf("Error:\n");
      printf("%s is not an integer. Exiting program.\n", argv[1]);
      return 0;
    }
    if (argc > 2) {
      scanstat = sscanf(argv[2], "%c", &vopt);
      if (scanstat != 1) {
        verbose = 0;
      } else {
        verbose = (vopt == 'v') ? 1 : 0;
      }
    } else {
      verbose = 0;
    }
  } else {
    ploidy = 3;
    verbose = 0;
  }
  test_DNA(ploidy, verbose);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1209 <main+0xd9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea1(%rip),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
je     11a7 <main+0x77>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1229 <main+0xf9>
cmpl   $0x2,-0x8(%rbp)
jle    11fd <main+0xcd>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe73(%rip),%rsi
lea    -0x1d(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
je     11e4 <main+0xb4>
movl   $0x0,-0x1c(%rbp)
jmp    11f8 <main+0xc8>
movsbl -0x1d(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x76,%edx
cmove  %ecx,%eax
mov    %eax,-0x1c(%rbp)
jmp    1204 <main+0xd4>
movl   $0x0,-0x1c(%rbp)
jmp    1217 <main+0xe7>
movl   $0x3,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1050 <test_DNA@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x2,%edi
jl     11a3 <main+0x63>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xea3(%rip),%rsi
xor    %r14d,%r14d
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11bc <main+0x7c>
cmp    $0x3,%ebp
jb     11ae <main+0x6e>
mov    0x10(%rbx),%rdi
lea    0xeaa(%rip),%rsi
xor    %r14d,%r14d
lea    0xb(%rsp),%rdx
xor    %eax,%eax
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11ae <main+0x6e>
xor    %r14d,%r14d
cmpb   $0x76,0xb(%rsp)
sete   %r14b
jmp    11ae <main+0x6e>
movl   $0x3,0xc(%rsp)
xor    %r14d,%r14d
mov    0xc(%rsp),%edi
mov    %r14d,%esi
call   1060 <test_DNA@plt>
jmp    11da <main+0x9a>
lea    0xe6b(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rsi
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"Error:\0A\00"
@.str.2 = [40 x i8] c"%s is not an integer. Exiting program.\0A\00"
@.str.3 = [3 x i8] c"%c\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 i32
%9 = alloca i8
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %46
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
store i32 %17, i32* %10
%18 = load i32, i32* %10
%19 = icmp ne i32 %18, 1
br i1 %19, label %20, label %26
20: ; preds = %13
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %24)
store i32 0, i32* %3
br label %51
26: ; preds = %13
%27 = load i32, i32* %4
%28 = icmp sgt i32 %27, 2
br i1 %28, label %29, label %44
29: ; preds = %26
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 2
%32 = load i8*, i8** %31
%33 = call i32 (i8*, i8*, ...) @sscanf(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %9)
store i32 %33, i32* %10
%34 = load i32, i32* %10
%35 = icmp ne i32 %34, 1
br i1 %35, label %36, label %37
36: ; preds = %29
store i32 0, i32* %8
br label %43
37: ; preds = %29
%38 = load i8, i8* %9
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 118
%41 = zext i1 %40 to i64
%42 = select i1 %40, i32 1, i32 0
store i32 %42, i32* %8
br label %43
43: ; preds = %37, %36
br label %45
44: ; preds = %26
store i32 0, i32* %8
br label %45
45: ; preds = %44, %43
br label %47
46: ; preds = %2
store i32 3, i32* %7
store i32 0, i32* %8
br label %47
47: ; preds = %46, %45
%48 = load i32, i32* %7
%49 = load i32, i32* %8
%50 = call i32 @test_DNA(i32 %48, i32 %49)
store i32 0, i32* %3
br label %51
51: ; preds = %47, %20
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [40 x i8] c"%s is not an integer. Exiting program.\0A\00"
@.str.3 = [3 x i8] c"%c\00"
@str = [7 x i8] c"Error:\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i8
%5 = bitcast i32* %3 to i8*
%6 = icmp sgt i32 %0, 1
br i1 %6, label %7, label %27
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = call i32 (i8*, i8*, ...) @sscanf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %23
12: ; preds = %7
%13 = icmp ugt i32 %0, 2
br i1 %13, label %14, label %28
14: ; preds = %12
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
%17 = call i32 (i8*, i8*, ...) @sscanf(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %28
19: ; preds = %14
%20 = load i8, i8* %4
%21 = icmp eq i8 %20, 118
%22 = zext i1 %21 to i32
br label %28
23: ; preds = %7
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%25 = load i8*, i8** %8
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %32
27: ; preds = %2
store i32 3, i32* %3
br label %28
28: ; preds = %12, %14, %19, %27
%29 = phi i32 [ 0, %27 ], [ 0, %12 ], [ 0, %14 ], [ %22, %19 ]
%30 = load i32, i32* %3
%31 = call i32 @test_DNA(i32 %30, i32 %29)
br label %32
32: ; preds = %23, %28
ret i32 0
}