#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 */
struct stat {
  int st_ino;
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
int stat(char *, struct stat *);
int test_issubvolume(char *path) {
  struct stat st;
  int res;
  res = stat(path, &st);
  if (res < 0)
    return -1;
  return (st.st_ino == 256) && S_ISDIR(st.st_mode);
}


x86 assembly (clang, -O0):
<test_issubvolume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1152 <test_issubvolume+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1181 <test_issubvolume+0x61>
xor    %eax,%eax
cmpl   $0x100,-0x18(%rbp)
mov    %al,-0x1d(%rbp)
jne    1176 <test_issubvolume+0x56>
mov    -0x14(%rbp),%edi
call   1030 <S_ISDIR@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_issubvolume>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %eax,%eax
js     114e <test_issubvolume+0x2e>
xor    %eax,%eax
cmpl   $0x100,(%rsp)
jne    114c <test_issubvolume+0x2c>
mov    0x4(%rsp),%edi
call   1030 <S_ISDIR@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
define i32 @test_issubvolume(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @stat(i8* %6, %struct.stat* %4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %23
11: ; preds = %1
%12 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 256
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 1
%17 = load i32, i32* %16
%18 = call i64 @S_ISDIR(i32 %17)
%19 = icmp ne i64 %18, 0
br label %20
20: ; preds = %15, %11
%21 = phi i1 [ false, %11 ], [ %19, %15 ]
%22 = zext i1 %21 to i32
store i32 %22, i32* %2
br label %23
23: ; preds = %20, %10
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
define i32 @test_issubvolume(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 256
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 1
%12 = load i32, i32* %11
%13 = tail call i64 @S_ISDIR(i32 %12)
%14 = icmp ne i64 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %6, %10, %1
%17 = phi i32 [ -1, %1 ], [ 0, %6 ], [ %15, %10 ]
ret i32 %17
}