#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 /*<<< orphan*/ st_dev;
};

/* Variables and functions */
int /*<<< orphan*/ df_dev(int /*<<< orphan*/, char const *, char const *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
scalar_t__ stat(char const *, struct stat *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void df_path(const char *path, const char *dpath, const char *mntpath) {
  struct stat sbuf;
  if (stat(path, &sbuf) < 0) {
    fprintf(stderr, "df: \"%s\": %s\n", path, strerror(errno));
  } else {
    df_dev(sbuf.st_dev, dpath, mntpath);
  }
}


x86 assembly (clang, -O0):
<df_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0x0,%rax
jge    11a8 <df_path+0x68>
mov    0x2e6e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rdx
mov    %rax,%rcx
lea    0xe62(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11b8 <df_path+0x78>
mov    -0x20(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <df_dev@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<df_path>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rsp,%rsi
call   1040 <stat@plt>
test   %rax,%rax
js     116d <df_path+0x2d>
mov    (%rsp),%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <df_dev@plt>
jmp    1198 <df_path+0x58>
mov    0x2e6c(%rip),%rax
mov    (%rax),%ebp
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe75(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1030 <fprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [14 x i8] c"df: \22%s\22: %s\0A\00"
@errno = global i32 0
define void @df_path(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.stat
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = call i64 @stat(i8* %8, %struct.stat* %7)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %3
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %4
%14 = load i32, i32* @errno
%15 = call i8* @strerror(i32 %14)
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %15)
br label %23
17: ; preds = %3
%18 = getelementptr inbounds %struct.stat, %struct.stat* %7, i32 0, i32 0
%19 = load i32, i32* %18
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = call i32 @df_dev(i32 %19, i8* %20, i8* %21)
br label %23
23: ; preds = %17, %11
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@stderr = global i32 0
@.str = [14 x i8] c"df: \22%s\22: %s\0A\00"
@errno = global i32 0
define void @df_path(i8* %0, i8* %1, i8* %2) {
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %4 to i8*
%6 = call i64 @stat(i8* %0, %struct.stat* %4)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i32, i32* @stderr
%10 = load i32, i32* @errno
%11 = call i8* @strerror(i32 %10)
%12 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %11)
br label %17
13: ; preds = %3
%14 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%15 = load i32, i32* %14
%16 = call i32 @df_dev(i32 %15, i8* %1, i8* %2)
br label %17
17: ; preds = %13, %8
ret void
}