#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*/ assert(int);
int cmp(int /*<<< orphan*/, int /*<<< orphan*/);
int effective_length(int /*<<< orphan*/);
int /*<<< orphan*/ parse(char *, int);
int /*<<< orphan*/ to_number(int, int);
void testSanity() {
  assert(cmp(to_number(1, 4), to_number(1, 5)) == 0);
  assert(cmp(to_number(2, 4), to_number(1, 5)) == 1);
  assert(cmp(to_number(2, 4), to_number(1, 5)) == 1);
  assert(cmp(parse("0002", 2), to_number(2, 2)) == 0);
  assert(cmp(parse("00FF", 2), to_number(255, 2)) == 0);
  assert(cmp(parse("0002", 4), to_number(2, 2)) == 0);
  assert(cmp(parse("00FF", 4), to_number(255, 2)) == 0);
  assert(effective_length(parse("00", 4)) == 0);
  assert(effective_length(parse("FF", 4)) == 1);
  assert(effective_length(parse("FFFFFFFF", 4)) == 4);
}


x86 assembly (clang, -O0):
<testSanity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x1,%edi
mov    $0x4,%esi
call   1070 <to_number@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x1,%edi
mov    $0x5,%esi
call   1070 <to_number@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
call   1050 <cmp@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x2,%edi
mov    $0x4,%esi
call   1070 <to_number@plt>
mov    %eax,-0x18(%rbp)
mov    $0x1,%edi
mov    $0x5,%esi
call   1070 <to_number@plt>
mov    -0x18(%rbp),%edi
mov    %eax,%esi
call   1050 <cmp@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x2,%edi
mov    $0x4,%esi
call   1070 <to_number@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1,%edi
mov    $0x5,%esi
call   1070 <to_number@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1050 <cmp@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdf0(%rip),%rdi
mov    $0x2,%esi
call   1060 <parse@plt>
mov    %eax,-0x10(%rbp)
mov    $0x2,%esi
mov    %esi,%edi
call   1070 <to_number@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1050 <cmp@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xdbb(%rip),%rdi
mov    $0x2,%esi
call   1060 <parse@plt>
mov    %eax,-0xc(%rbp)
mov    $0xff,%edi
mov    $0x2,%esi
call   1070 <to_number@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1050 <cmp@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd79(%rip),%rdi
mov    $0x4,%esi
call   1060 <parse@plt>
mov    %eax,-0x8(%rbp)
mov    $0x2,%esi
mov    %esi,%edi
call   1070 <to_number@plt>
mov    -0x8(%rbp),%edi
mov    %eax,%esi
call   1050 <cmp@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd44(%rip),%rdi
mov    $0x4,%esi
call   1060 <parse@plt>
mov    %eax,-0x4(%rbp)
mov    $0xff,%edi
mov    $0x2,%esi
call   1070 <to_number@plt>
mov    -0x4(%rbp),%edi
mov    %eax,%esi
call   1050 <cmp@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xd0c(%rip),%rdi
mov    $0x4,%esi
call   1060 <parse@plt>
mov    %eax,%edi
call   1030 <effective_length@plt>
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xce1(%rip),%rdi
mov    $0x4,%esi
call   1060 <parse@plt>
mov    %eax,%edi
call   1030 <effective_length@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    0xcbf(%rip),%rdi
mov    $0x4,%esi
call   1060 <parse@plt>
mov    %eax,%edi
call   1030 <effective_length@plt>
cmp    $0x4,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testSanity>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%edi
mov    $0x4,%esi
call   1070 <to_number@plt>
mov    %eax,%ebx
mov    $0x1,%edi
mov    $0x5,%esi
call   1070 <to_number@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <cmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    $0x2,%edi
mov    $0x4,%esi
call   1070 <to_number@plt>
mov    %eax,%ebx
mov    $0x1,%edi
mov    $0x5,%esi
call   1070 <to_number@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <cmp@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
mov    $0x2,%edi
mov    $0x4,%esi
call   1070 <to_number@plt>
mov    %eax,%ebx
mov    $0x1,%edi
mov    $0x5,%esi
call   1070 <to_number@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <cmp@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe01(%rip),%r14
mov    %r14,%rdi
mov    $0x2,%esi
call   1060 <parse@plt>
mov    %eax,%ebx
mov    $0x2,%edi
mov    $0x2,%esi
call   1070 <to_number@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <cmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xdcb(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1060 <parse@plt>
mov    %eax,%ebp
mov    $0xff,%edi
mov    $0x2,%esi
call   1070 <to_number@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <cmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1060 <parse@plt>
mov    %eax,%ebp
mov    $0x2,%edi
mov    $0x2,%esi
call   1070 <to_number@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <cmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1060 <parse@plt>
mov    %eax,%ebx
mov    $0xff,%edi
mov    $0x2,%esi
call   1070 <to_number@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <cmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xd2d(%rip),%rdi
mov    $0x4,%esi
call   1060 <parse@plt>
mov    %eax,%edi
call   1030 <effective_length@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xd05(%rip),%rdi
mov    $0x4,%esi
call   1060 <parse@plt>
mov    %eax,%edi
call   1030 <effective_length@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xce5(%rip),%rdi
mov    $0x4,%esi
call   1060 <parse@plt>
mov    %eax,%edi
call   1030 <effective_length@plt>
xor    %edi,%edi
cmp    $0x4,%eax
sete   %dil
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <assert@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"0002\00"
@.str.1 = [5 x i8] c"00FF\00"
@.str.2 = [3 x i8] c"00\00"
@.str.3 = [3 x i8] c"FF\00"
@.str.4 = [9 x i8] c"FFFFFFFF\00"
define void @testSanity() {
%1 = call i32 @to_number(i32 1, i32 4)
%2 = call i32 @to_number(i32 1, i32 5)
%3 = call i32 @cmp(i32 %1, i32 %2)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = call i32 @to_number(i32 2, i32 4)
%8 = call i32 @to_number(i32 1, i32 5)
%9 = call i32 @cmp(i32 %7, i32 %8)
%10 = icmp eq i32 %9, 1
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @to_number(i32 2, i32 4)
%14 = call i32 @to_number(i32 1, i32 5)
%15 = call i32 @cmp(i32 %13, i32 %14)
%16 = icmp eq i32 %15, 1
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = call i32 @parse(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2)
%20 = call i32 @to_number(i32 2, i32 2)
%21 = call i32 @cmp(i32 %19, i32 %20)
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i32
%24 = call i32 @assert(i32 %23)
%25 = call i32 @parse(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 2)
%26 = call i32 @to_number(i32 255, i32 2)
%27 = call i32 @cmp(i32 %25, i32 %26)
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = call i32 @parse(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%32 = call i32 @to_number(i32 2, i32 2)
%33 = call i32 @cmp(i32 %31, i32 %32)
%34 = icmp eq i32 %33, 0
%35 = zext i1 %34 to i32
%36 = call i32 @assert(i32 %35)
%37 = call i32 @parse(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%38 = call i32 @to_number(i32 255, i32 2)
%39 = call i32 @cmp(i32 %37, i32 %38)
%40 = icmp eq i32 %39, 0
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = call i32 @parse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 4)
%44 = call i32 @effective_length(i32 %43)
%45 = icmp eq i32 %44, 0
%46 = zext i1 %45 to i32
%47 = call i32 @assert(i32 %46)
%48 = call i32 @parse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 4)
%49 = call i32 @effective_length(i32 %48)
%50 = icmp eq i32 %49, 1
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = call i32 @parse(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 4)
%54 = call i32 @effective_length(i32 %53)
%55 = icmp eq i32 %54, 4
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"0002\00"
@.str.1 = [5 x i8] c"00FF\00"
@.str.2 = [3 x i8] c"00\00"
@.str.3 = [3 x i8] c"FF\00"
@.str.4 = [9 x i8] c"FFFFFFFF\00"
define void @testSanity() {
%1 = tail call i32 @to_number(i32 1, i32 4)
%2 = tail call i32 @to_number(i32 1, i32 5)
%3 = tail call i32 @cmp(i32 %1, i32 %2)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @to_number(i32 2, i32 4)
%8 = tail call i32 @to_number(i32 1, i32 5)
%9 = tail call i32 @cmp(i32 %7, i32 %8)
%10 = icmp eq i32 %9, 1
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @to_number(i32 2, i32 4)
%14 = tail call i32 @to_number(i32 1, i32 5)
%15 = tail call i32 @cmp(i32 %13, i32 %14)
%16 = icmp eq i32 %15, 1
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = tail call i32 @parse(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2)
%20 = tail call i32 @to_number(i32 2, i32 2)
%21 = tail call i32 @cmp(i32 %19, i32 %20)
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i32 @parse(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 2)
%26 = tail call i32 @to_number(i32 255, i32 2)
%27 = tail call i32 @cmp(i32 %25, i32 %26)
%28 = icmp eq i32 %27, 0
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = tail call i32 @parse(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%32 = tail call i32 @to_number(i32 2, i32 2)
%33 = tail call i32 @cmp(i32 %31, i32 %32)
%34 = icmp eq i32 %33, 0
%35 = zext i1 %34 to i32
%36 = tail call i32 @assert(i32 %35)
%37 = tail call i32 @parse(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%38 = tail call i32 @to_number(i32 255, i32 2)
%39 = tail call i32 @cmp(i32 %37, i32 %38)
%40 = icmp eq i32 %39, 0
%41 = zext i1 %40 to i32
%42 = tail call i32 @assert(i32 %41)
%43 = tail call i32 @parse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 4)
%44 = tail call i32 @effective_length(i32 %43)
%45 = icmp eq i32 %44, 0
%46 = zext i1 %45 to i32
%47 = tail call i32 @assert(i32 %46)
%48 = tail call i32 @parse(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 4)
%49 = tail call i32 @effective_length(i32 %48)
%50 = icmp eq i32 %49, 1
%51 = zext i1 %50 to i32
%52 = tail call i32 @assert(i32 %51)
%53 = tail call i32 @parse(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 4)
%54 = tail call i32 @effective_length(i32 %53)
%55 = icmp eq i32 %54, 4
%56 = zext i1 %55 to i32
%57 = tail call i32 @assert(i32 %56)
ret void
}