#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 IFNAMSIZ;
int /*<<< orphan*/ R_OK;
scalar_t__ access(char *, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int is_bridge_slave(char *br_name, char *if_name) {
  char path[32 + 2 * IFNAMSIZ];
  sprintf(path, "/sys/class/net/%s/brif/%s", br_name, if_name);
  return (access(path, R_OK) == 0);
}


x86 assembly (clang, -O0):
<is_bridge_slave>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%ecx
mov    %ecx,%eax
lea    0x20(%rax,%rax,1),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe8f(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x28(%rbp),%rdi
mov    0x2e57(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_bridge_slave>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
add    %eax,%eax
add    $0x20,%eax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xeae(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1030 <access@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
lea    -0x8(%rbp),%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@IFNAMSIZ = global i32 0
@.str = [26 x i8] c"/sys/class/net/%s/brif/%s\00"
@R_OK = global i32 0
define i32 @is_bridge_slave(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i32, i32* @IFNAMSIZ
%8 = mul nsw i32 2, %7
%9 = add nsw i32 32, %8
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %5
%12 = alloca i8, i64 %10
store i64 %10, i64* %6
%13 = load i8*, i8** %3
%14 = load i8*, i8** %4
%15 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = load i32, i32* @R_OK
%17 = call i64 @access(i8* %12, i32 %16)
%18 = icmp eq i64 %17, 0
%19 = zext i1 %18 to i32
%20 = load i8*, i8** %5
ret i32 %19
}

LLVM IR (-O2):
@IFNAMSIZ = global i32 0
@.str = [26 x i8] c"/sys/class/net/%s/brif/%s\00"
@R_OK = global i32 0
define i32 @is_bridge_slave(i8* %0, i8* %1) {
%3 = load i32, i32* @IFNAMSIZ
%4 = shl nsw i32 %3, 1
%5 = add nsw i32 %4, 32
%6 = zext i32 %5 to i64
%7 = alloca i8, i64 %6
%8 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%9 = load i32, i32* @R_OK
%10 = call i64 @access(i8* %7, i32 %9)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}