#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*/ puts(char *);
scalar_t__ test_decode_with_encode();
scalar_t__ test_encode();
scalar_t__ test_parser();
scalar_t__ test_strlen();
scalar_t__ test_validation();
int main() {
  int ret = 0;
  if (test_encode()) {
    puts("encode success.");
    if (test_decode_with_encode()) {
      puts("decode success.");
    } else {
      puts("decode failure.");
      ret = 1;
    }
    if (test_validation()) {
      puts("validation success.");
    } else {
      puts("validation failure.");
      ret = 1;
    }
    if (test_parser()) {
      puts("parser success.");
    } else {
      puts("parser failure.");
      ret = 1;
    }
    if (test_strlen()) {
      puts("strlen success.");
    } else {
      puts("strlen failure.");
      ret = 1;
    }
  } else {
    puts("encode failure.");
    ret = 1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1050 <test_encode@plt>
cmp    $0x0,%rax
je     126c <main+0x10c>
lea    0xe72(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1070 <test_decode_with_encode@plt>
cmp    $0x0,%rax
je     11b5 <main+0x55>
lea    0xe65(%rip),%rdi
call   1040 <puts@plt>
jmp    11c8 <main+0x68>
lea    0xe64(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1060 <test_validation@plt>
cmp    $0x0,%rax
je     11ea <main+0x8a>
lea    0xe50(%rip),%rdi
call   1040 <puts@plt>
jmp    11fd <main+0x9d>
lea    0xe53(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1080 <test_parser@plt>
cmp    $0x0,%rax
je     121f <main+0xbf>
lea    0xe43(%rip),%rdi
call   1040 <puts@plt>
jmp    1232 <main+0xd2>
lea    0xe42(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x0,%al
call   1030 <test_strlen@plt>
cmp    $0x0,%rax
je     1254 <main+0xf4>
lea    0xe2e(%rip),%rdi
call   1040 <puts@plt>
jmp    1267 <main+0x107>
lea    0xe2d(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
jmp    127f <main+0x11f>
lea    0xe25(%rip),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <test_encode@plt>
test   %rax,%rax
je     121a <main+0xba>
lea    0xe85(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1070 <test_decode_with_encode@plt>
test   %rax,%rax
sete   %bpl
lea    0xe8b(%rip),%rax
lea    0xe74(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <test_validation@plt>
test   %rax,%rax
sete   %bl
lea    0xe8b(%rip),%rax
lea    0xe70(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1080 <test_parser@plt>
test   %rax,%rax
sete   %r14b
lea    0xe8a(%rip),%rax
lea    0xe73(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <test_strlen@plt>
test   %rax,%rax
sete   %al
lea    0xe86(%rip),%rcx
lea    0xe6f(%rip),%rdi
cmove  %rcx,%rdi
or     %r14b,%al
or     %bpl,%bl
or     %al,%bl
movzbl %bl,%ebx
jmp    1226 <main+0xc6>
mov    $0x1,%ebx
lea    0xe72(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"encode success.\00"
@.str.1 = [16 x i8] c"decode success.\00"
@.str.2 = [16 x i8] c"decode failure.\00"
@.str.3 = [20 x i8] c"validation success.\00"
@.str.4 = [20 x i8] c"validation failure.\00"
@.str.5 = [16 x i8] c"parser success.\00"
@.str.6 = [16 x i8] c"parser failure.\00"
@.str.7 = [16 x i8] c"strlen success.\00"
@.str.8 = [16 x i8] c"strlen failure.\00"
@.str.9 = [16 x i8] c"encode failure.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i64 (...) @test_encode()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %35
5: ; preds = %0
%6 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = call i64 (...) @test_decode_with_encode()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %13
11: ; preds = %5
%12 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %2
br label %13
13: ; preds = %11, %9
%14 = call i64 (...) @test_validation()
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %20
18: ; preds = %13
%19 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %2
br label %20
20: ; preds = %18, %16
%21 = call i64 (...) @test_parser()
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
br label %27
25: ; preds = %20
%26 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %2
br label %27
27: ; preds = %25, %23
%28 = call i64 (...) @test_strlen()
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %34
32: ; preds = %27
%33 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %2
br label %34
34: ; preds = %32, %30
br label %37
35: ; preds = %0
%36 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %2
br label %37
37: ; preds = %35, %34
%38 = load i32, i32* %2
ret i32 %38
}

LLVM IR (-O2):
@.str = [16 x i8] c"encode success.\00"
@.str.1 = [16 x i8] c"decode success.\00"
@.str.2 = [16 x i8] c"decode failure.\00"
@.str.3 = [20 x i8] c"validation success.\00"
@.str.4 = [20 x i8] c"validation failure.\00"
@.str.5 = [16 x i8] c"parser success.\00"
@.str.6 = [16 x i8] c"parser failure.\00"
@.str.7 = [16 x i8] c"strlen success.\00"
@.str.8 = [16 x i8] c"strlen failure.\00"
@.str.9 = [16 x i8] c"encode failure.\00"
define i32 @main() {
%1 = tail call i64 (...) @test_encode()
%2 = icmp eq i64 %1, 0
br i1 %2, label %24, label %3
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = tail call i64 (...) @test_decode_with_encode()
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
%9 = tail call i64 (...) @test_validation()
%10 = icmp eq i64 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0)
%12 = tail call i32 @puts(i8* dereferenceable(1) %11)
%13 = tail call i64 (...) @test_parser()
%14 = icmp eq i64 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0)
%16 = tail call i32 @puts(i8* dereferenceable(1) %15)
%17 = tail call i64 (...) @test_strlen()
%18 = icmp eq i64 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0)
%20 = select i1 %18, i1 true, i1 %14
%21 = select i1 %20, i1 true, i1 %10
%22 = select i1 %21, i1 true, i1 %6
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %3, %0
%25 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), %0 ], [ %19, %3 ]
%26 = phi i32 [ 1, %0 ], [ %23, %3 ]
%27 = tail call i32 @puts(i8* dereferenceable(1) %25)
ret i32 %26
}