#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, int, char *);
int /*<<< orphan*/ stderr;
scalar_t__ testBCD(int const, char **);
scalar_t__ testINT(int const, char **);
int main(const int argc, char **argv) {
  int i;
  for (i = 0; i < argc; i++) {
    printf("argv[%d] '%s'\n", i, argv[i]);
  }
  if (testINT(argc, argv) == 0) {
    fprintf(stderr, "### INT tests failed ###\n");
    return -1;
  }
  if (testBCD(argc, argv) == 0) {
    fprintf(stderr, "### BCD tests failed ###\n");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1192 <main+0x52>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x1d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <testINT@plt>
cmp    $0x0,%rax
jne    11c9 <main+0x89>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
lea    0xe57(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1207 <main+0xc7>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <testBCD@plt>
cmp    $0x0,%rax
jne    1200 <main+0xc0>
mov    0x2dfa(%rip),%rax
mov    (%rax),%edi
lea    0xe3a(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1207 <main+0xc7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %edi,%r14d
test   %edi,%edi
jle    1177 <main+0x37>
mov    %r14d,%ebx
xor    %ebp,%ebp
lea    0xea2(%rip),%r15
xchg   %ax,%ax
mov    (%r12,%rbp,8),%rdx
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1160 <main+0x20>
mov    %r14d,%edi
mov    %r12,%rsi
call   1050 <testINT@plt>
test   %rax,%rax
je     11a5 <main+0x65>
mov    %r14d,%edi
mov    %r12,%rsi
call   1060 <testBCD@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    11bf <main+0x7f>
lea    0xe86(%rip),%rsi
jmp    11ac <main+0x6c>
lea    0xe63(%rip),%rsi
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"argv[%d] '%s'\0A\00"
@stderr = global i32 0
@.str.1 = [26 x i8] c"### INT tests failed ###\0A\00"
@.str.2 = [26 x i8] c"### BCD tests failed ###\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i32, i32* %6
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %17)
br label %19
19: ; preds = %11
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %7
22: ; preds = %7
%23 = load i32, i32* %4
%24 = load i8**, i8*** %5
%25 = call i64 @testINT(i32 %23, i8** %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %39
30: ; preds = %22
%31 = load i32, i32* %4
%32 = load i8**, i8*** %5
%33 = call i64 @testBCD(i32 %31, i8** %32)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %30
%36 = load i32, i32* @stderr
%37 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %39
38: ; preds = %30
store i32 0, i32* %3
br label %39
39: ; preds = %38, %35, %27
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
@.str = [15 x i8] c"argv[%d] '%s'\0A\00"
@stderr = global i32 0
@.str.1 = [26 x i8] c"### INT tests failed ###\0A\00"
@.str.2 = [26 x i8] c"### BCD tests failed ###\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %10, i8* %9)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i64 @testINT(i32 %0, i8** %1)
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = tail call i64 @testBCD(i32 %0, i8** %1)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %17, %14
%21 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), %14 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), %17 ]
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* %21)
br label %24
24: ; preds = %20, %17
%25 = phi i32 [ 0, %17 ], [ -1, %20 ]
ret i32 %25
}