#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 */
char *strerror(int);
int /*<<< orphan*/ zz_log_err(char *, char const *, char const *, int,
                              char const *, ...);
void vfs_emsg(const char *dri, int err, const char *fct, const char *alt,
              const char *obj) {
  const char *msg = alt ? alt : "failed";
  if (err)
    msg = strerror(err);
  if (!obj)
    zz_log_err(""
               "VFS(%s): %s: (%d) %s\n",
               dri, fct, err, msg);
  else
    zz_log_err(""
               "VFS(%s): %s: (%d) %s -- %s\n",
               dri, fct, err, msg, obj);
}


x86 assembly (clang, -O0):
<vfs_emsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1153 <vfs_emsg+0x33>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    1163 <vfs_emsg+0x43>
lea    0xea6(%rip),%rax
mov    %rax,-0x38(%rbp)
jmp    1163 <vfs_emsg+0x43>
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1181 <vfs_emsg+0x61>
mov    -0xc(%rbp),%edi
call   1040 <strerror@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    11ae <vfs_emsg+0x8e>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x30(%rbp),%r8
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <zz_log_err@plt>
jmp    11cf <vfs_emsg+0xaf>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x30(%rbp),%r8
mov    -0x28(%rbp),%r9
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <zz_log_err@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vfs_emsg>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %r8,%r15
mov    %rdx,%r14
mov    %esi,%ebx
mov    %rdi,%r12
test   %rcx,%rcx
lea    0xec3(%rip),%r8
cmovne %rcx,%r8
test   %esi,%esi
je     114f <vfs_emsg+0x2f>
mov    %ebx,%edi
call   1040 <strerror@plt>
mov    %rax,%r8
test   %r15,%r15
je     1178 <vfs_emsg+0x58>
lea    0xec2(%rip),%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %ebx,%ecx
mov    %r15,%r9
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <zz_log_err@plt>
lea    0xe88(%rip),%rdi
mov    %r12,%rsi
mov    %r14,%rdx
mov    %ebx,%ecx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <zz_log_err@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"failed\00"
@.str.1 = [22 x i8] c"VFS(%s): %s: (%d) %s\0A\00"
@.str.2 = [28 x i8] c"VFS(%s): %s: (%d) %s -- %s\0A\00"
define void @vfs_emsg(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%12 = load i8*, i8** %9
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %5
%15 = load i8*, i8** %9
br label %17
16: ; preds = %5
br label %17
17: ; preds = %16, %14
%18 = phi i8* [ %15, %14 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %16 ]
store i8* %18, i8** %11
%19 = load i32, i32* %7
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = load i32, i32* %7
%23 = call i8* @strerror(i32 %22)
store i8* %23, i8** %11
br label %24
24: ; preds = %21, %17
%25 = load i8*, i8** %10
%26 = icmp ne i8* %25, null
br i1 %26, label %33, label %27
27: ; preds = %24
%28 = load i8*, i8** %6
%29 = load i8*, i8** %8
%30 = load i32, i32* %7
%31 = load i8*, i8** %11
%32 = call i32 (i8*, i8*, i8*, i32, i8*, ...) @zz_log_err(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %28, i8* %29, i32 %30, i8* %31)
br label %40
33: ; preds = %24
%34 = load i8*, i8** %6
%35 = load i8*, i8** %8
%36 = load i32, i32* %7
%37 = load i8*, i8** %11
%38 = load i8*, i8** %10
%39 = call i32 (i8*, i8*, i8*, i32, i8*, ...) @zz_log_err(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %34, i8* %35, i32 %36, i8* %37, i8* %38)
br label %40
40: ; preds = %33, %27
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"failed\00"
@.str.1 = [22 x i8] c"VFS(%s): %s: (%d) %s\0A\00"
@.str.2 = [28 x i8] c"VFS(%s): %s: (%d) %s -- %s\0A\00"
define void @vfs_emsg(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = icmp eq i8* %3, null
%7 = select i1 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %3
%8 = icmp eq i32 %1, 0
br i1 %8, label %11, label %9
9: ; preds = %5
%10 = tail call i8* @strerror(i32 %1)
br label %11
11: ; preds = %9, %5
%12 = phi i8* [ %10, %9 ], [ %7, %5 ]
%13 = icmp eq i8* %4, null
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 (i8*, i8*, i8*, i32, i8*, ...) @zz_log_err(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %2, i32 %1, i8* %12)
br label %18
16: ; preds = %11
%17 = tail call i32 (i8*, i8*, i8*, i32, i8*, ...) @zz_log_err(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %2, i32 %1, i8* %12, i8* %4)
br label %18
18: ; preds = %16, %14
ret void
}