#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 uufsd {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ERROR(struct uufsd *, char *);
int sbread(struct uufsd *);
int ufs_disk_fillout_blank(struct uufsd *, char const *);
int ufs_disk_fillout(struct uufsd *disk, const char *name) {
  if (ufs_disk_fillout_blank(disk, name) == -1) {
    return (-1);
  }
  if (sbread(disk) == -1) {
    ERROR(disk, "could not read superblock to fill out disk");
    return (-1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<ufs_disk_fillout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <ufs_disk_fillout_blank@plt>
cmp    $0xffffffff,%eax
jne    1162 <ufs_disk_fillout+0x32>
movl   $0xffffffff,-0x4(%rbp)
jmp    1197 <ufs_disk_fillout+0x67>
mov    -0x10(%rbp),%rdi
call   1040 <sbread@plt>
cmp    $0xffffffff,%eax
jne    1190 <ufs_disk_fillout+0x60>
mov    -0x10(%rbp),%rdi
lea    0xe81(%rip),%rsi
call   1050 <ERROR@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1197 <ufs_disk_fillout+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ufs_disk_fillout>:
push   %rbx
mov    %rdi,%rbx
call   1030 <ufs_disk_fillout_blank@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0xffffffff,%ecx
je     1156 <ufs_disk_fillout+0x26>
mov    %rbx,%rdi
call   1040 <sbread@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
je     1158 <ufs_disk_fillout+0x28>
pop    %rbx
ret
lea    0xea1(%rip),%rsi
mov    %rbx,%rdi
call   1050 <ERROR@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.uufsd = type { i32 }
@.str = [43 x i8] c"could not read superblock to fill out disk\00"
define i32 @ufs_disk_fillout(%struct.uufsd* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.uufsd*
%5 = alloca i8*
store %struct.uufsd* %0, %struct.uufsd** %4
store i8* %1, i8** %5
%6 = load %struct.uufsd*, %struct.uufsd** %4
%7 = load i8*, i8** %5
%8 = call i32 @ufs_disk_fillout_blank(%struct.uufsd* %6, i8* %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %2
store i32 -1, i32* %3
br label %19
11: ; preds = %2
%12 = load %struct.uufsd*, %struct.uufsd** %4
%13 = call i32 @sbread(%struct.uufsd* %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load %struct.uufsd*, %struct.uufsd** %4
%17 = call i32 @ERROR(%struct.uufsd* %16, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %19
18: ; preds = %11
store i32 0, i32* %3
br label %19
19: ; preds = %18, %15, %10
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
%struct.uufsd = type { i32 }
@.str = [43 x i8] c"could not read superblock to fill out disk\00"
define i32 @ufs_disk_fillout(%struct.uufsd* %0, i8* %1) {
%3 = tail call i32 @ufs_disk_fillout_blank(%struct.uufsd* %0, i8* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i32 @sbread(%struct.uufsd* %0)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @ERROR(%struct.uufsd* %0, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %5, %2, %8
%11 = phi i32 [ -1, %8 ], [ -1, %2 ], [ 0, %5 ]
ret i32 %11
}