#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 */
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int knx_parse_bool(char *, int);
float knx_parse_float(char *);
int knx_parse_int(char *, int, int);
int knx_parse_uint(char *, int, int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  bool b;
  uint32_t ui;
  int32_t i;
  float f;
  char *test01 = "\x00";
  b = knx_parse_bool(test01, 7);
  assert(b == false);
  char *test02 = "\x01";
  b = knx_parse_bool(test02, 7);
  assert(b == true);
  b = knx_parse_bool(test02, 6);
  assert(b == false);
  char *test03 = "\x05";
  ui = knx_parse_uint(test03, 5, 3);
  assert(ui == 5);
  ui = knx_parse_uint(test03, 6, 2);
  assert(ui == 1);
  i = knx_parse_int(test03, 5, 3);
  assert(i == -1);
  i = knx_parse_int(test03, 6, 2);
  assert(i == 1);
  char *test03b = "\x12";
  i = knx_parse_int(test03b, 0, 8);
  assert(i == 18);
  char *test04 = "\x03\x35";
  ui = knx_parse_uint(test04, 6, 10);
  assert(ui == 821);
  i = knx_parse_int(test04, 6, 10);
  assert(i == -309);
  char *test05 = "\x67\x7e\xf6\x42";
  f = knx_parse_float(test05);
  assert(f == 123.24688f);
  printf("                               \n               ,o888888o.     8 "
         "8888     ,88' \n            . 8888     `88.   8 8888    ,88'  \n     "
         "      ,8 8888       `8b  8 8888   ,88'   \n           88 8888        "
         "`8b 8 8888  ,88'    \n           88 8888         88 8 8888 ,88'     "
         "\n           88 8888         88 8 8888 88'      \n           88 8888 "
         "       ,8P 8 888888<       \n           `8 8888       ,8P  8 8888 "
         "`Y8.     \n            ` 8888     ,88'   8 8888   `Y8.   \n          "
         "     `8888888P'     8 8888     `Y8. \n");
  ;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe87(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    $0x7,%esi
call   1050 <knx_parse_bool@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe5c(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    $0x7,%esi
call   1050 <knx_parse_bool@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x30(%rbp),%rdi
mov    $0x6,%esi
call   1050 <knx_parse_bool@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xe0f(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1070 <knx_parse_uint@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x5,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x38(%rbp),%rdi
mov    $0x6,%esi
mov    $0x2,%edx
call   1070 <knx_parse_uint@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x38(%rbp),%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1040 <knx_parse_int@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x38(%rbp),%rdi
mov    $0x6,%esi
mov    $0x2,%edx
call   1040 <knx_parse_int@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xd6a(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <knx_parse_int@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x12,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xd3d(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    $0x6,%esi
mov    $0xa,%edx
call   1070 <knx_parse_uint@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x335,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x48(%rbp),%rdi
mov    $0x6,%esi
mov    $0xa,%edx
call   1040 <knx_parse_int@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xfffffecb,-0x1c(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xce1(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
call   1080 <knx_parse_float@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
movss  0xcb3(%rip),%xmm1
ucomiss %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xcab(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xe9c(%rip),%rdi
mov    $0x7,%esi
call   1050 <knx_parse_bool@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xe80(%rip),%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1050 <knx_parse_bool@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1050 <knx_parse_bool@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xe46(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1070 <knx_parse_uint@plt>
xor    %edi,%edi
cmp    $0x5,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x2,%edx
call   1070 <knx_parse_uint@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x3,%edx
call   1040 <knx_parse_int@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x2,%edx
call   1040 <knx_parse_int@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xdc1(%rip),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1040 <knx_parse_int@plt>
xor    %edi,%edi
cmp    $0x12,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xda2(%rip),%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0xa,%edx
call   1070 <knx_parse_uint@plt>
xor    %edi,%edi
cmp    $0x335,%eax
sete   %dil
call   1060 <assert@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0xa,%edx
call   1040 <knx_parse_int@plt>
xor    %edi,%edi
cmp    $0xfffffecb,%eax
sete   %dil
call   1060 <assert@plt>
lea    0xd5a(%rip),%rdi
call   1080 <knx_parse_float@plt>
cmpeqss 0xd3d(%rip),%xmm0
movd   %xmm0,%edi
and    $0x1,%edi
call   1060 <assert@plt>
lea    0xd3e(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] zeroinitializer
@.str.1 = [2 x i8] c"\01\00"
@.str.2 = [2 x i8] c"\05\00"
@.str.3 = [2 x i8] c"\12\00"
@.str.4 = [3 x i8] c"\035\00"
@.str.5 = [5 x i8] c"g~\F6B\00"
@.str.6 = [503 x i8] c" \0A ,o888888o. 8 8888 ,88' \0A . 8888 `88. 8 8888 ,88' \0A ,8 8888 `8b 8 8888 ,88' \0A 88 8888 `8b 8 8888 ,88' \0A 88 8888 88 8 8888 ,88' \0A 88 8888 88 8 8888 88' \0A 88 8888 ,8P 8 888888< \0A `8 8888 ,8P 8 8888 `Y8. \0A ` 8888 ,88' 8 8888 `Y8. \0A `8888888P' 8 8888 `Y8. \0A\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 float
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %10
%16 = load i8*, i8** %10
%17 = call i32 @knx_parse_bool(i8* %16, i32 7)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %11
%22 = load i8*, i8** %11
%23 = call i32 @knx_parse_bool(i8* %22, i32 7)
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = icmp eq i32 %24, 1
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load i8*, i8** %11
%29 = call i32 @knx_parse_bool(i8* %28, i32 6)
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %12
%34 = load i8*, i8** %12
%35 = call i32 @knx_parse_uint(i8* %34, i32 5, i32 3)
store i32 %35, i32* %7
%36 = load i32, i32* %7
%37 = icmp eq i32 %36, 5
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
%40 = load i8*, i8** %12
%41 = call i32 @knx_parse_uint(i8* %40, i32 6, i32 2)
store i32 %41, i32* %7
%42 = load i32, i32* %7
%43 = icmp eq i32 %42, 1
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = load i8*, i8** %12
%47 = call i32 @knx_parse_int(i8* %46, i32 5, i32 3)
store i32 %47, i32* %8
%48 = load i32, i32* %8
%49 = icmp eq i32 %48, -1
%50 = zext i1 %49 to i32
%51 = call i32 @assert(i32 %50)
%52 = load i8*, i8** %12
%53 = call i32 @knx_parse_int(i8* %52, i32 6, i32 2)
store i32 %53, i32* %8
%54 = load i32, i32* %8
%55 = icmp eq i32 %54, 1
%56 = zext i1 %55 to i32
%57 = call i32 @assert(i32 %56)
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %13
%58 = load i8*, i8** %13
%59 = call i32 @knx_parse_int(i8* %58, i32 0, i32 8)
store i32 %59, i32* %8
%60 = load i32, i32* %8
%61 = icmp eq i32 %60, 18
%62 = zext i1 %61 to i32
%63 = call i32 @assert(i32 %62)
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %14
%64 = load i8*, i8** %14
%65 = call i32 @knx_parse_uint(i8* %64, i32 6, i32 10)
store i32 %65, i32* %7
%66 = load i32, i32* %7
%67 = icmp eq i32 %66, 821
%68 = zext i1 %67 to i32
%69 = call i32 @assert(i32 %68)
%70 = load i8*, i8** %14
%71 = call i32 @knx_parse_int(i8* %70, i32 6, i32 10)
store i32 %71, i32* %8
%72 = load i32, i32* %8
%73 = icmp eq i32 %72, -309
%74 = zext i1 %73 to i32
%75 = call i32 @assert(i32 %74)
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8** %15
%76 = load i8*, i8** %15
%77 = call float @knx_parse_float(i8* %76)
store float %77, float* %9
%78 = load float, float* %9
%79 = fcmp oeq float %78, 0x405ECFCCE0000000
%80 = zext i1 %79 to i32
%81 = call i32 @assert(i32 %80)
%82 = call i32 @printf(i8* getelementptr inbounds ([503 x i8], [503 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] zeroinitializer
@.str.1 = [2 x i8] c"\01\00"
@.str.2 = [2 x i8] c"\05\00"
@.str.3 = [2 x i8] c"\12\00"
@.str.4 = [3 x i8] c"\035\00"
@.str.5 = [5 x i8] c"g~\F6B\00"
@str = [502 x i8] c" \0A ,o888888o. 8 8888 ,88' \0A . 8888 `88. 8 8888 ,88' \0A ,8 8888 `8b 8 8888 ,88' \0A 88 8888 `8b 8 8888 ,88' \0A 88 8888 88 8 8888 ,88' \0A 88 8888 88 8 8888 88' \0A 88 8888 ,8P 8 888888< \0A `8 8888 ,8P 8 8888 `Y8. \0A ` 8888 ,88' 8 8888 `Y8. \0A `8888888P' 8 8888 `Y8. \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @knx_parse_bool(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 7)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @knx_parse_bool(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 7)
%8 = icmp eq i32 %7, 1
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = tail call i32 @knx_parse_bool(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 6)
%12 = icmp eq i32 %11, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 @knx_parse_uint(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 5, i32 3)
%16 = icmp eq i32 %15, 5
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = tail call i32 @knx_parse_uint(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 6, i32 2)
%20 = icmp eq i32 %19, 1
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = tail call i32 @knx_parse_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 5, i32 3)
%24 = icmp eq i32 %23, -1
%25 = zext i1 %24 to i32
%26 = tail call i32 @assert(i32 %25)
%27 = tail call i32 @knx_parse_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 6, i32 2)
%28 = icmp eq i32 %27, 1
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = tail call i32 @knx_parse_int(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 8)
%32 = icmp eq i32 %31, 18
%33 = zext i1 %32 to i32
%34 = tail call i32 @assert(i32 %33)
%35 = tail call i32 @knx_parse_uint(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 6, i32 10)
%36 = icmp eq i32 %35, 821
%37 = zext i1 %36 to i32
%38 = tail call i32 @assert(i32 %37)
%39 = tail call i32 @knx_parse_int(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 6, i32 10)
%40 = icmp eq i32 %39, -309
%41 = zext i1 %40 to i32
%42 = tail call i32 @assert(i32 %41)
%43 = tail call float @knx_parse_float(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%44 = fcmp oeq float %43, 0x405ECFCCE0000000
%45 = zext i1 %44 to i32
%46 = tail call i32 @assert(i32 %45)
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([502 x i8], [502 x i8]* @str, i64 0, i64 0))
ret i32 0
}