#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 meu_biosequip();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int equip = meu_biosequip();
  printf("diskete present: %s\n", equip & 1 ? "True" : "False");
  equip >>= 1;
  printf("Math coprocessor installed: %s\n", equip & 1 ? "True" : "False");
  equip >>= 3;
  printf("Initial video mode: %d\n", equip & 0b11);
  equip >>= 2;
  printf("Number of disketes: %d\n", (equip & 0b11) + 1);
  equip >>= 3;
  printf("Number of RS-232 ports: %d\n", equip & 0b111);
  equip >>= 3;
  printf("Game adapter installed: %s\n", equip & 0b1 ? "True" : "False");
  equip >>= 1;
  printf("Internal modem installed: %s\n", equip & 0b1 ? "True" : "False");
  equip >>= 1;
  printf("Number of printers installed: %d\n", equip & 0b11);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <meu_biosequip@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
and    $0x1,%ecx
lea    0xed4(%rip),%rsi
lea    0xec8(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
and    $0x1,%ecx
lea    0xea2(%rip),%rsi
lea    0xe96(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sar    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
and    $0x3,%esi
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sar    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
and    $0x3,%esi
add    $0x1,%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sar    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
and    $0x7,%esi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sar    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
and    $0x1,%ecx
lea    0xe16(%rip),%rsi
lea    0xe0a(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
and    $0x1,%ecx
lea    0xde4(%rip),%rsi
lea    0xdd8(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
and    $0x3,%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <meu_biosequip@plt>
mov    %eax,%ebx
test   $0x1,%bl
lea    0xee2(%rip),%r15
lea    0xed6(%rip),%r14
mov    %r14,%rsi
cmove  %r15,%rsi
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x2,%bl
mov    %r14,%rsi
cmove  %r15,%rsi
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%esi
shr    $0x4,%esi
and    $0x3,%esi
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%esi
shr    $0x6,%esi
and    $0x3,%esi
add    $0x1,%esi
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%esi
shr    $0x9,%esi
and    $0x7,%esi
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x1000,%ebx
mov    %r14,%rsi
cmove  %r15,%rsi
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x2000,%ebx
cmove  %r15,%r14
lea    0xecb(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
shr    $0xe,%ebx
and    $0x3,%ebx
lea    0xed2(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"diskete present: %s\0A\00"
@.str.1 = [5 x i8] c"True\00"
@.str.2 = [6 x i8] c"False\00"
@.str.3 = [32 x i8] c"Math coprocessor installed: %s\0A\00"
@.str.4 = [24 x i8] c"Initial video mode: %d\0A\00"
@.str.5 = [24 x i8] c"Number of disketes: %d\0A\00"
@.str.6 = [28 x i8] c"Number of RS-232 ports: %d\0A\00"
@.str.7 = [28 x i8] c"Game adapter installed: %s\0A\00"
@.str.8 = [30 x i8] c"Internal modem installed: %s\0A\00"
@.str.9 = [34 x i8] c"Number of printers installed: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @meu_biosequip()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, 1
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* %2
%11 = ashr i32 %10, 1
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = and i32 %12, 1
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%18 = load i32, i32* %2
%19 = ashr i32 %18, 3
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = and i32 %20, 3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %2
%24 = ashr i32 %23, 2
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = and i32 %25, 3
%27 = add nsw i32 %26, 1
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %2
%30 = ashr i32 %29, 3
store i32 %30, i32* %2
%31 = load i32, i32* %2
%32 = and i32 %31, 7
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %2
%35 = ashr i32 %34, 3
store i32 %35, i32* %2
%36 = load i32, i32* %2
%37 = and i32 %36, 1
%38 = icmp ne i32 %37, 0
%39 = zext i1 %38 to i64
%40 = select i1 %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %40)
%42 = load i32, i32* %2
%43 = ashr i32 %42, 1
store i32 %43, i32* %2
%44 = load i32, i32* %2
%45 = and i32 %44, 1
%46 = icmp ne i32 %45, 0
%47 = zext i1 %46 to i64
%48 = select i1 %46, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %48)
%50 = load i32, i32* %2
%51 = ashr i32 %50, 1
store i32 %51, i32* %2
%52 = load i32, i32* %2
%53 = and i32 %52, 3
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32 %53)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"diskete present: %s\0A\00"
@.str.1 = [5 x i8] c"True\00"
@.str.2 = [6 x i8] c"False\00"
@.str.3 = [32 x i8] c"Math coprocessor installed: %s\0A\00"
@.str.4 = [24 x i8] c"Initial video mode: %d\0A\00"
@.str.5 = [24 x i8] c"Number of disketes: %d\0A\00"
@.str.6 = [28 x i8] c"Number of RS-232 ports: %d\0A\00"
@.str.7 = [28 x i8] c"Game adapter installed: %s\0A\00"
@.str.8 = [30 x i8] c"Internal modem installed: %s\0A\00"
@.str.9 = [34 x i8] c"Number of printers installed: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @meu_biosequip()
%2 = and i32 %1, 1
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = and i32 %1, 2
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%10 = lshr i32 %1, 4
%11 = and i32 %10, 3
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %11)
%13 = lshr i32 %1, 6
%14 = and i32 %13, 3
%15 = add nuw nsw i32 %14, 1
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = lshr i32 %1, 9
%18 = and i32 %17, 7
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %18)
%20 = and i32 %1, 4096
%21 = icmp eq i32 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i8* %22)
%24 = and i32 %1, 8192
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %26)
%28 = lshr i32 %1, 14
%29 = and i32 %28, 3
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32 %29)
ret i32 0
}