#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 CDC_CD_R;
int CDC_DVD;
int CDC_DVD_R;
int CDC_DVD_RAM;
int /*<<< orphan*/ vdev_property_add(char *, char *);
int /*<<< orphan*/ vdev_property_free_all();
int /*<<< orphan*/ vdev_property_print();
int stat_optical_print_caps(int capabilities) {
  vdev_property_add("VDEV_OPTICAL_CD_R",
                    (capabilities & CDC_CD_R) == 0 ? "0" : "1");
  vdev_property_add("VDEV_OPTICAL_CD_RW",
                    (capabilities & CDC_CD_R) == 0 ? "0" : "1");
  vdev_property_add("VDEV_OPTICAL_DVD",
                    (capabilities & CDC_DVD) == 0 ? "0" : "1");
  vdev_property_add("VDEV_OPTICAL_DVD_R",
                    (capabilities & CDC_DVD_R) == 0 ? "0" : "1");
  vdev_property_add("VDEV_OPTICAL_DVD_RAM",
                    (capabilities & CDC_DVD_RAM) == 0 ? "0" : "1");
  vdev_property_print();
  vdev_property_free_all();
  return 0;
}


x86 assembly (clang, -O0):
<stat_optical_print_caps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    0x2e93(%rip),%rax
and    (%rax),%ecx
lea    0xec6(%rip),%rsi
lea    0xebd(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
lea    0xe9d(%rip),%rdi
call   1030 <vdev_property_add@plt>
mov    -0x4(%rbp),%ecx
mov    0x2e66(%rip),%rax
and    (%rax),%ecx
lea    0xe99(%rip),%rsi
lea    0xe90(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
lea    0xe86(%rip),%rdi
call   1030 <vdev_property_add@plt>
mov    -0x4(%rbp),%ecx
mov    0x2e49(%rip),%rax
and    (%rax),%ecx
lea    0xe6c(%rip),%rsi
lea    0xe63(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
lea    0xe6c(%rip),%rdi
call   1030 <vdev_property_add@plt>
mov    -0x4(%rbp),%ecx
mov    0x2e04(%rip),%rax
and    (%rax),%ecx
lea    0xe3f(%rip),%rsi
lea    0xe36(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
lea    0xe50(%rip),%rdi
call   1030 <vdev_property_add@plt>
mov    -0x4(%rbp),%ecx
mov    0x2dcf(%rip),%rax
and    (%rax),%ecx
lea    0xe12(%rip),%rsi
lea    0xe09(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rsi
lea    0xe36(%rip),%rdi
call   1030 <vdev_property_add@plt>
mov    $0x0,%al
call   1040 <vdev_property_print@plt>
mov    $0x0,%al
call   1050 <vdev_property_free_all@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stat_optical_print_caps>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
mov    0x2e98(%rip),%r15
mov    (%r15),%eax
and    %edi,%eax
lea    0xec6(%rip),%r14
lea    0xec1(%rip),%rbx
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xe9f(%rip),%rdi
call   1030 <vdev_property_add@plt>
mov    (%r15),%eax
and    %ebp,%eax
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xe9d(%rip),%rdi
call   1030 <vdev_property_add@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xe92(%rip),%rdi
call   1030 <vdev_property_add@plt>
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
and    %ebp,%eax
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xe85(%rip),%rdi
call   1030 <vdev_property_add@plt>
mov    0x2e07(%rip),%rax
and    (%rax),%ebp
cmove  %r14,%rbx
lea    0xe7f(%rip),%rdi
mov    %rbx,%rsi
call   1030 <vdev_property_add@plt>
xor    %eax,%eax
call   1040 <vdev_property_print@plt>
xor    %eax,%eax
call   1050 <vdev_property_free_all@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"VDEV_OPTICAL_CD_R\00"
@CDC_CD_R = global i32 0
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [19 x i8] c"VDEV_OPTICAL_CD_RW\00"
@.str.4 = [17 x i8] c"VDEV_OPTICAL_DVD\00"
@CDC_DVD = global i32 0
@.str.5 = [19 x i8] c"VDEV_OPTICAL_DVD_R\00"
@CDC_DVD_R = global i32 0
@.str.6 = [21 x i8] c"VDEV_OPTICAL_DVD_RAM\00"
@CDC_DVD_RAM = global i32 0
define i32 @stat_optical_print_caps(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @CDC_CD_R
%5 = and i32 %3, %4
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%9 = call i32 @vdev_property_add(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* %2
%11 = load i32, i32* @CDC_CD_R
%12 = and i32 %10, %11
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%16 = call i32 @vdev_property_add(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = load i32, i32* %2
%18 = load i32, i32* @CDC_DVD
%19 = and i32 %17, %18
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%23 = call i32 @vdev_property_add(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %22)
%24 = load i32, i32* %2
%25 = load i32, i32* @CDC_DVD_R
%26 = and i32 %24, %25
%27 = icmp eq i32 %26, 0
%28 = zext i1 %27 to i64
%29 = select i1 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%30 = call i32 @vdev_property_add(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %29)
%31 = load i32, i32* %2
%32 = load i32, i32* @CDC_DVD_RAM
%33 = and i32 %31, %32
%34 = icmp eq i32 %33, 0
%35 = zext i1 %34 to i64
%36 = select i1 %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%37 = call i32 @vdev_property_add(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %36)
%38 = call i32 (...) @vdev_property_print()
%39 = call i32 (...) @vdev_property_free_all()
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"VDEV_OPTICAL_CD_R\00"
@CDC_CD_R = global i32 0
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [19 x i8] c"VDEV_OPTICAL_CD_RW\00"
@.str.4 = [17 x i8] c"VDEV_OPTICAL_DVD\00"
@CDC_DVD = global i32 0
@.str.5 = [19 x i8] c"VDEV_OPTICAL_DVD_R\00"
@CDC_DVD_R = global i32 0
@.str.6 = [21 x i8] c"VDEV_OPTICAL_DVD_RAM\00"
@CDC_DVD_RAM = global i32 0
define i32 @stat_optical_print_caps(i32 %0) {
%2 = load i32, i32* @CDC_CD_R
%3 = and i32 %2, %0
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%6 = tail call i32 @vdev_property_add(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* @CDC_CD_R
%8 = and i32 %7, %0
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%11 = tail call i32 @vdev_property_add(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %10)
%12 = load i32, i32* @CDC_DVD
%13 = and i32 %12, %0
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%16 = tail call i32 @vdev_property_add(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @CDC_DVD_R
%18 = and i32 %17, %0
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%21 = tail call i32 @vdev_property_add(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %20)
%22 = load i32, i32* @CDC_DVD_RAM
%23 = and i32 %22, %0
%24 = icmp eq i32 %23, 0
%25 = select i1 %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%26 = tail call i32 @vdev_property_add(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i8* %25)
%27 = tail call i32 (...) @vdev_property_print()
%28 = tail call i32 (...) @vdev_property_free_all()
ret i32 0
}