#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 binfrom6bit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int test_binfrom6bit(void) {
  if (binfrom6bit(0x35) != 0x05) {
    fprintf(stderr, "binfrom6bit() 1: Failed\n");
    return 0;
  }
  if (binfrom6bit(0x6D) != 0x35) {
    fprintf(stderr, "binfrom6bit() 2: Failed\n");
    return 0;
  }
  if (binfrom6bit(0x05) != -1) {
    fprintf(stderr, "binfrom6bit() 3: Failed\n");
    return 0;
  }
  if (binfrom6bit(0x5B) != -1) {
    fprintf(stderr, "binfrom6bit() 4: Failed\n");
    return 0;
  }
  fprintf(stderr, "binfrom6bit(): Passed\n");
  return 1;
}


x86 assembly (clang, -O0):
<test_binfrom6bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x35,%edi
call   1030 <binfrom6bit@plt>
cmp    $0x5,%eax
je     115c <test_binfrom6bit+0x3c>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1214 <test_binfrom6bit+0xf4>
mov    $0x6d,%edi
call   1030 <binfrom6bit@plt>
cmp    $0x35,%eax
je     1190 <test_binfrom6bit+0x70>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1214 <test_binfrom6bit+0xf4>
mov    $0x5,%edi
call   1030 <binfrom6bit@plt>
cmp    $0xffffffff,%eax
je     11c4 <test_binfrom6bit+0xa4>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe7f(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1214 <test_binfrom6bit+0xf4>
mov    $0x5b,%edi
call   1030 <binfrom6bit@plt>
cmp    $0xffffffff,%eax
je     11f8 <test_binfrom6bit+0xd8>
mov    0x2e02(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1214 <test_binfrom6bit+0xf4>
mov    0x2de1(%rip),%rax
mov    (%rax),%edi
lea    0xe5c(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_binfrom6bit>:
push   %rax
mov    $0x35,%edi
call   1030 <binfrom6bit@plt>
cmp    $0x5,%eax
jne    1160 <test_binfrom6bit+0x40>
mov    $0x6d,%edi
call   1030 <binfrom6bit@plt>
cmp    $0x35,%eax
jne    1172 <test_binfrom6bit+0x52>
mov    $0x5,%edi
call   1030 <binfrom6bit@plt>
cmp    $0xffffffff,%eax
je     118b <test_binfrom6bit+0x6b>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
jmp    1182 <test_binfrom6bit+0x62>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
jmp    1182 <test_binfrom6bit+0x62>
mov    0x2e67(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x5b,%edi
call   1030 <binfrom6bit@plt>
mov    0x2e44(%rip),%rcx
mov    (%rcx),%edi
cmp    $0xffffffff,%eax
je     11ac <test_binfrom6bit+0x8c>
lea    0xea1(%rip),%rsi
jmp    1182 <test_binfrom6bit+0x62>
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"binfrom6bit() 1: Failed\0A\00"
@.str.1 = [25 x i8] c"binfrom6bit() 2: Failed\0A\00"
@.str.2 = [25 x i8] c"binfrom6bit() 3: Failed\0A\00"
@.str.3 = [25 x i8] c"binfrom6bit() 4: Failed\0A\00"
@.str.4 = [23 x i8] c"binfrom6bit(): Passed\0A\00"
define i32 @test_binfrom6bit() {
%1 = alloca i32
%2 = call i32 @binfrom6bit(i32 53)
%3 = icmp ne i32 %2, 5
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %28
7: ; preds = %0
%8 = call i32 @binfrom6bit(i32 109)
%9 = icmp ne i32 %8, 53
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %28
13: ; preds = %7
%14 = call i32 @binfrom6bit(i32 5)
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %28
19: ; preds = %13
%20 = call i32 @binfrom6bit(i32 91)
%21 = icmp ne i32 %20, -1
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %28
25: ; preds = %19
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %1
br label %28
28: ; preds = %25, %22, %16, %10, %4
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"binfrom6bit() 1: Failed\0A\00"
@.str.1 = [25 x i8] c"binfrom6bit() 2: Failed\0A\00"
@.str.2 = [25 x i8] c"binfrom6bit() 3: Failed\0A\00"
@.str.3 = [25 x i8] c"binfrom6bit() 4: Failed\0A\00"
@.str.4 = [23 x i8] c"binfrom6bit(): Passed\0A\00"
define i32 @test_binfrom6bit() {
%1 = tail call i32 @binfrom6bit(i32 53)
%2 = icmp eq i32 %1, 5
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %26
6: ; preds = %0
%7 = tail call i32 @binfrom6bit(i32 109)
%8 = icmp eq i32 %7, 53
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %26
12: ; preds = %6
%13 = tail call i32 @binfrom6bit(i32 5)
%14 = icmp eq i32 %13, -1
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
br label %26
18: ; preds = %12
%19 = tail call i32 @binfrom6bit(i32 91)
%20 = icmp eq i32 %19, -1
%21 = load i32, i32* @stderr
br i1 %20, label %24, label %22
22: ; preds = %18
%23 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0))
br label %26
24: ; preds = %18
%25 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %24, %22, %15, %9, %3
%27 = phi i32 [ 0, %3 ], [ 0, %9 ], [ 0, %15 ], [ 0, %22 ], [ 1, %24 ]
ret i32 %27
}