#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 */
typedef int /*<<< orphan*/ cmd;

/* Variables and functions */
scalar_t__ WEXITSTATUS(int);
int /*<<< orphan*/ snprintf(char *, int, char const *, char const *);
int system(char *);
int is_ignored(const char *busid) {
  const char *fmt = "cio_ignore --is-ignored %s > /dev/null 2>&1";
  char cmd[256];
  int rc;
  snprintf(cmd, sizeof(cmd), fmt, busid);
  rc = system(cmd);
  if ((rc != -1) && (WEXITSTATUS(rc) == 0))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_ignored>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x100,%esi
call   1040 <snprintf@plt>
lea    -0x120(%rbp),%rdi
call   1030 <system@plt>
mov    %eax,-0x124(%rbp)
cmpl   $0xffffffff,-0x124(%rbp)
je     11a3 <is_ignored+0x73>
mov    -0x124(%rbp),%edi
call   1050 <WEXITSTATUS@plt>
cmp    $0x0,%rax
jne    11a3 <is_ignored+0x73>
movl   $0x1,-0x4(%rbp)
jmp    11aa <is_ignored+0x7a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ignored>:
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%rcx
lea    0xebe(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
cmp    $0xffffffff,%eax
je     116b <is_ignored+0x3b>
mov    %eax,%edi
call   1050 <WEXITSTATUS@plt>
test   %rax,%rax
je     116f <is_ignored+0x3f>
xor    %eax,%eax
jmp    1174 <is_ignored+0x44>
mov    $0x1,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"cio_ignore --is-ignored %s > /dev/null 2>&1\00"
define i32 @is_ignored(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca i32
store i8* %0, i8** %3
store i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8** %4
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @snprintf(i8* %7, i32 256, i8* %8, i8* %9)
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%12 = call i32 @system(i8* %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %20
15: ; preds = %1
%16 = load i32, i32* %6
%17 = call i64 @WEXITSTATUS(i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 1, i32* %2
br label %21
20: ; preds = %15, %1
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@.str = [44 x i8] c"cio_ignore --is-ignored %s > /dev/null 2>&1\00"
define i32 @is_ignored(i8* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 256, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @system(i8* %3)
%6 = icmp eq i32 %5, -1
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = call i64 @WEXITSTATUS(i32 %5)
%9 = icmp eq i64 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %7, %1
br label %11
11: ; preds = %7, %10
%12 = phi i32 [ 0, %10 ], [ 1, %7 ]
ret i32 %12
}