#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 */
scalar_t__ find_file(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int slot_in_use(void) {
  if (find_file("/sys/bus/platform/drivers/jz4740-mmc", "*.0")) {
    fprintf(
        stderr,
        "The 8:10 card slot is currently used by the MMC controller.\n"
        "You can try to detach it with:\n"
        "# echo jz4740-mmc.0 >/sys/bus/platform/drivers/jz4740-mmc/unbind\n");
    return 1;
  }
  if (find_file("/sys/bus/spi/drivers/at86rf230", "*.0")) {
    fprintf(
        stderr,
        "The 8:10 card slot is currently used by the AT86RF230 kernel driver.\n"
        "You can try to detach it with:\n"
        "# cd /sys/bus/spi/drivers/at86rf230\n"
        "# echo spi*.0 >unbind\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<slot_in_use>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xeef(%rip),%rsi
call   1040 <find_file@plt>
cmp    $0x0,%rax
je     1166 <slot_in_use+0x46>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ab <slot_in_use+0x8b>
lea    0xf59(%rip),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <find_file@plt>
cmp    $0x0,%rax
je     11a4 <slot_in_use+0x84>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xf52(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ab <slot_in_use+0x8b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slot_in_use>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xef6(%rip),%rsi
call   1040 <find_file@plt>
test   %rax,%rax
je     1142 <slot_in_use+0x22>
lea    0xee9(%rip),%rsi
jmp    1161 <slot_in_use+0x41>
lea    0xf7d(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1040 <find_file@plt>
test   %rax,%rax
je     1176 <slot_in_use+0x56>
lea    0xf84(%rip),%rsi
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [37 x i8] c"/sys/bus/platform/drivers/jz4740-mmc\00"
@.str.1 = [4 x i8] c"*.0\00"
@stderr = global i32 0
@.str.2 = [157 x i8] c"The 8:10 card slot is currently used by the MMC controller.\0AYou can try to detach it with:\0A# echo jz4740-mmc.0 >/sys/bus/platform/drivers/jz4740-mmc/unbind\0A\00"
@.str.3 = [31 x i8] c"/sys/bus/spi/drivers/at86rf230\00"
@.str.4 = [159 x i8] c"The 8:10 card slot is currently used by the AT86RF230 kernel driver.\0AYou can try to detach it with:\0A# cd /sys/bus/spi/drivers/at86rf230\0A# echo spi*.0 >unbind\0A\00"
define i32 @slot_in_use() {
%1 = alloca i32
%2 = call i64 @find_file(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %14
7: ; preds = %0
%8 = call i64 @find_file(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %1
br label %14
13: ; preds = %7
store i32 0, i32* %1
br label %14
14: ; preds = %13, %10, %4
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str = [37 x i8] c"/sys/bus/platform/drivers/jz4740-mmc\00"
@.str.1 = [4 x i8] c"*.0\00"
@stderr = global i32 0
@.str.2 = [157 x i8] c"The 8:10 card slot is currently used by the MMC controller.\0AYou can try to detach it with:\0A# echo jz4740-mmc.0 >/sys/bus/platform/drivers/jz4740-mmc/unbind\0A\00"
@.str.3 = [31 x i8] c"/sys/bus/spi/drivers/at86rf230\00"
@.str.4 = [159 x i8] c"The 8:10 card slot is currently used by the AT86RF230 kernel driver.\0AYou can try to detach it with:\0A# cd /sys/bus/spi/drivers/at86rf230\0A# echo spi*.0 >unbind\0A\00"
define i32 @slot_in_use() {
%1 = tail call i64 @find_file(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i64 @find_file(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3, %0
%7 = phi i8* [ getelementptr inbounds ([157 x i8], [157 x i8]* @.str.2, i64 0, i64 0), %0 ], [ getelementptr inbounds ([159 x i8], [159 x i8]* @.str.4, i64 0, i64 0), %3 ]
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* %7)
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ 0, %3 ], [ 1, %6 ]
ret i32 %11
}