#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 GetMaxChars(int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *, ...);
void TestGetMaxChars() {
  printf("\n-------------------------------------------------------------------"
         "---------\n");
  printf("  Test GetMaxChars()\n");
  printf("---------------------------------------------------------------------"
         "-------\n");
  {
    printf("Get max chars %5d == %-5d: ", 8, 1);
    assert(GetMaxChars(8) == 1);
    printf("[OK]\n");
  };
  {
    printf("Get max chars %5d == %-5d: ", 16, 2);
    assert(GetMaxChars(16) == 2);
    printf("[OK]\n");
  };
  {
    printf("Get max chars %5d == %-5d: ", 9, 1);
    assert(GetMaxChars(9) == 1);
    printf("[OK]\n");
  };
  {
    printf("Get max chars %5d == %-5d: ", 7, 0);
    assert(GetMaxChars(7) == 0);
    printf("[OK]\n");
  };
  {
    printf("Get max chars %5d == %-5d: ", -5, 0);
    assert(GetMaxChars(-5) == 0);
    printf("[OK]\n");
  };
  {
    printf("Get max chars %5d == %-5d: ", 80, 10);
    assert(GetMaxChars(80) == 10);
    printf("[OK]\n");
  };
  printf("---------------------------------------------------------------------"
         "-------\n");
  printf("  Done.\n");
  printf("---------------------------------------------------------------------"
         "-------\n\n");
}


x86 assembly (clang, -O0):
<TestGetMaxChars>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
mov    $0x8,%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x8,%edi
call   1050 <GetMaxChars@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
mov    $0x10,%esi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x10,%edi
call   1050 <GetMaxChars@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x9,%edi
call   1050 <GetMaxChars@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe40(%rip),%rdi
mov    $0x7,%esi
xor    %edx,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x7,%edi
call   1050 <GetMaxChars@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe03(%rip),%rdi
mov    $0xfffffffb,%esi
xor    %edx,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xfffffffb,%edi
call   1050 <GetMaxChars@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdc6(%rip),%rdi
mov    $0x50,%esi
mov    $0xa,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x50,%edi
call   1050 <GetMaxChars@plt>
cmp    $0xa,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestGetMaxChars>:
push   %r15
push   %r14
push   %rbx
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf12(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xe8d(%rip),%r15
mov    %r15,%rdi
mov    $0x8,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x8,%edi
call   1060 <GetMaxChars@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xed9(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    $0x10,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x10,%edi
call   1060 <GetMaxChars@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    $0x9,%esi
mov    $0x1,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x9,%edi
call   1060 <GetMaxChars@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    $0x7,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x7,%edi
call   1060 <GetMaxChars@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    $0xfffffffb,%esi
xor    %edx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xfffffffb,%edi
call   1060 <GetMaxChars@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    $0x50,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x50,%edi
call   1060 <GetMaxChars@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
call   1050 <assert@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xdcb(%rip),%rdi
call   1030 <puts@plt>
lea    0xdc7(%rip),%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [79 x i8] c"\0A----------------------------------------------------------------------------\0A\00"
@.str.1 = [22 x i8] c" Test GetMaxChars()\0A\00"
@.str.2 = [78 x i8] c"----------------------------------------------------------------------------\0A\00"
@.str.3 = [28 x i8] c"Get max chars %5d == %-5d: \00"
@.str.4 = [6 x i8] c"[OK]\0A\00"
@.str.5 = [9 x i8] c" Done.\0A\00"
@.str.6 = [79 x i8] c"----------------------------------------------------------------------------\0A\0A\00"
define void @TestGetMaxChars() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 8, i32 1)
%5 = call i32 @GetMaxChars(i32 8)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 16, i32 2)
%11 = call i32 @GetMaxChars(i32 16)
%12 = icmp eq i32 %11, 2
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 9, i32 1)
%17 = call i32 @GetMaxChars(i32 9)
%18 = icmp eq i32 %17, 1
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 7, i32 0)
%23 = call i32 @GetMaxChars(i32 7)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 -5, i32 0)
%29 = call i32 @GetMaxChars(i32 -5)
%30 = icmp eq i32 %29, 0
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 80, i32 10)
%35 = call i32 @GetMaxChars(i32 80)
%36 = icmp eq i32 %35, 10
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0))
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.3 = [28 x i8] c"Get max chars %5d == %-5d: \00"
@str = [78 x i8] c"\0A----------------------------------------------------------------------------\00"
@str.7 = [21 x i8] c" Test GetMaxChars()\00"
@str.14 = [5 x i8] c"[OK]\00"
@str.15 = [77 x i8] c"----------------------------------------------------------------------------\00"
@str.16 = [8 x i8] c" Done.\00"
@str.17 = [78 x i8] c"----------------------------------------------------------------------------\0A\00"
define void @TestGetMaxChars() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.7, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.15, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 8, i32 1)
%5 = tail call i32 @GetMaxChars(i32 8)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.14, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 16, i32 2)
%11 = tail call i32 @GetMaxChars(i32 16)
%12 = icmp eq i32 %11, 2
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.14, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 9, i32 1)
%17 = tail call i32 @GetMaxChars(i32 9)
%18 = icmp eq i32 %17, 1
%19 = zext i1 %18 to i32
%20 = tail call i32 @assert(i32 %19)
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.14, i64 0, i64 0))
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 7, i32 0)
%23 = tail call i32 @GetMaxChars(i32 7)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.14, i64 0, i64 0))
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 -5, i32 0)
%29 = tail call i32 @GetMaxChars(i32 -5)
%30 = icmp eq i32 %29, 0
%31 = zext i1 %30 to i32
%32 = tail call i32 @assert(i32 %31)
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.14, i64 0, i64 0))
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i32 80, i32 10)
%35 = tail call i32 @GetMaxChars(i32 80)
%36 = icmp eq i32 %35, 10
%37 = zext i1 %36 to i32
%38 = tail call i32 @assert(i32 %37)
%39 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.14, i64 0, i64 0))
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @str.15, i64 0, i64 0))
%41 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.16, i64 0, i64 0))
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.17, i64 0, i64 0))
ret void
}