#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
void show_cap(unsigned int cap) {
  char str[80] = "[ ] ";
  str[1] = (cap & 0x00000001) ? 'X' : ' ';
  printf("%sCarrier detect\n", str);
  str[1] = (cap & 0x00000002) ? 'X' : ' ';
  printf("%sReceive data status\n", str);
  str[1] = (cap & 0x00000004) ? 'X' : ' ';
  printf("%sError count\n", str);
  str[1] = (cap & 0x00000008) ? 'X' : ' ';
  printf("%sDirect access to vertical blanking region\n", str);
  str[1] = (cap & 0x00000010) ? 'X' : ' ';
  printf("%sRaw mode\n", str);
  str[1] = (cap & 0x00000020) ? 'X' : ' ';
  printf("%sWeave deinterlacing\n", str);
  printf("\nPress Enter to continue: ");
  fgets(str, 80, stdin);
  return;
}


x86 assembly (clang, -O0):
<show_cap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1040 <memset@plt>
movb   $0x5b,-0x60(%rbp)
movb   $0x20,-0x5f(%rbp)
movb   $0x5d,-0x5e(%rbp)
movb   $0x20,-0x5d(%rbp)
mov    -0x4(%rbp),%edx
and    $0x1,%edx
mov    $0x20,%eax
mov    $0x58,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x5f(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edx
and    $0x2,%edx
mov    $0x20,%eax
mov    $0x58,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x5f(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edx
and    $0x4,%edx
mov    $0x20,%eax
mov    $0x58,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x5f(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edx
and    $0x8,%edx
mov    $0x20,%eax
mov    $0x58,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x5f(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edx
and    $0x10,%edx
mov    $0x20,%eax
mov    $0x58,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x5f(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edx
and    $0x20,%edx
mov    $0x20,%eax
mov    $0x58,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0x5f(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    0x2d72(%rip),%rax
mov    (%rax),%edx
mov    $0x50,%esi
call   1050 <fgets@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_cap>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %edi,%ebp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movb   $0x5b,(%rsp)
movw   $0x205d,0x2(%rsp)
test   $0x1,%bpl
mov    $0x20,%r15d
mov    $0x58,%ebx
mov    $0x58,%eax
cmove  %r15d,%eax
mov    %al,0x1(%rsp)
lea    0xe8b(%rip),%rdi
mov    %rsp,%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x2,%bpl
mov    $0x58,%eax
cmove  %r15d,%eax
mov    %al,0x1(%rsp)
lea    0xe78(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x4,%bpl
mov    $0x58,%eax
cmove  %r15d,%eax
mov    %al,0x1(%rsp)
lea    0xe6d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x8,%bpl
mov    $0x58,%eax
cmove  %r15d,%eax
mov    %al,0x1(%rsp)
lea    0xe5a(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x10,%bpl
mov    $0x58,%eax
cmove  %r15d,%eax
mov    %al,0x1(%rsp)
lea    0xe65(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
test   $0x20,%bpl
cmove  %r15d,%ebx
mov    %bl,0x1(%rsp)
lea    0xe54(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2dac(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
mov    $0x50,%esi
call   1040 <fgets@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"%sCarrier detect\0A\00"
@.str.1 = [23 x i8] c"%sReceive data status\0A\00"
@.str.2 = [15 x i8] c"%sError count\0A\00"
@.str.3 = [45 x i8] c"%sDirect access to vertical blanking region\0A\00"
@.str.4 = [12 x i8] c"%sRaw mode\0A\00"
@.str.5 = [23 x i8] c"%sWeave deinterlacing\0A\00"
@.str.6 = [27 x i8] c"\0APress Enter to continue: \00"
@stdin = global i32 0
define void @show_cap(i32 %0) {
%2 = alloca i32
%3 = alloca [80 x i8]
store i32 %0, i32* %2
%4 = bitcast [80 x i8]* %3 to i8*
%5 = bitcast i8* %4 to [80 x i8]*
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i32 0, i32 0
store i8 91, i8* %6
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i32 0, i32 1
store i8 32, i8* %7
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i32 0, i32 2
store i8 93, i8* %8
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i32 0, i32 3
store i8 32, i8* %9
%10 = load i32, i32* %2
%11 = and i32 %10, 1
%12 = icmp ne i32 %11, 0
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 88, i32 32
%15 = trunc i32 %14 to i8
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 1
store i8 %15, i8* %16
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* %2
%20 = and i32 %19, 2
%21 = icmp ne i32 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i32 88, i32 32
%24 = trunc i32 %23 to i8
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 1
store i8 %24, i8* %25
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = load i32, i32* %2
%29 = and i32 %28, 4
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i64
%32 = select i1 %30, i32 88, i32 32
%33 = trunc i32 %32 to i8
%34 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 1
store i8 %33, i8* %34
%35 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %35)
%37 = load i32, i32* %2
%38 = and i32 %37, 8
%39 = icmp ne i32 %38, 0
%40 = zext i1 %39 to i64
%41 = select i1 %39, i32 88, i32 32
%42 = trunc i32 %41 to i8
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 1
store i8 %42, i8* %43
%44 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %44)
%46 = load i32, i32* %2
%47 = and i32 %46, 16
%48 = icmp ne i32 %47, 0
%49 = zext i1 %48 to i64
%50 = select i1 %48, i32 88, i32 32
%51 = trunc i32 %50 to i8
%52 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 1
store i8 %51, i8* %52
%53 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %53)
%55 = load i32, i32* %2
%56 = and i32 %55, 32
%57 = icmp ne i32 %56, 0
%58 = zext i1 %57 to i64
%59 = select i1 %57, i32 88, i32 32
%60 = trunc i32 %59 to i8
%61 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 1
store i8 %60, i8* %61
%62 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %62)
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%65 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%66 = load i32, i32* @stdin
%67 = call i32 @fgets(i8* %65, i32 80, i32 %66)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%sCarrier detect\0A\00"
@.str.1 = [23 x i8] c"%sReceive data status\0A\00"
@.str.2 = [15 x i8] c"%sError count\0A\00"
@.str.3 = [45 x i8] c"%sDirect access to vertical blanking region\0A\00"
@.str.4 = [12 x i8] c"%sRaw mode\0A\00"
@.str.5 = [23 x i8] c"%sWeave deinterlacing\0A\00"
@.str.6 = [27 x i8] c"\0APress Enter to continue: \00"
@stdin = global i32 0
define void @show_cap(i32 %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
store i8 91, i8* %3
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 1
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 2
store i8 93, i8* %5
%6 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 3
store i8 32, i8* %6
%7 = and i32 %0, 1
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8 32, i8 88
store i8 %9, i8* %4
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3)
%11 = and i32 %0, 2
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i8 32, i8 88
store i8 %13, i8* %4
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%15 = and i32 %0, 4
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i8 32, i8 88
store i8 %17, i8* %4
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%19 = and i32 %0, 8
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i8 32, i8 88
store i8 %21, i8* %4
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%23 = and i32 %0, 16
%24 = icmp eq i32 %23, 0
%25 = select i1 %24, i8 32, i8 88
store i8 %25, i8* %4
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%27 = and i32 %0, 32
%28 = icmp eq i32 %27, 0
%29 = select i1 %28, i8 32, i8 88
store i8 %29, i8* %4
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%32 = load i32, i32* @stdin
%33 = call i32 @fgets(i8* %3, i32 80, i32 %32)
ret void
}