#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 */
scalar_t__ chdir(char *);
int /*<<< orphan*/ err(int, char *, ...);
int /*<<< orphan*/ fill_blocks();
int /*<<< orphan*/ fill_inodes();
int main(int argc, char *argv[]) {
  if (argc != 2)
    err(-1, "usage: ufs_uprintf /non_optional_path");
  if (chdir(argv[1]) < 0)
    err(-1, "chdir(%s)", argv[1]);
  fill_blocks();
  fill_inodes();
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1173 <main+0x33>
mov    $0xffffffff,%edi
lea    0xe94(%rip),%rsi
mov    $0x0,%al
call   1040 <err@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <chdir@plt>
cmp    $0x0,%rax
jge    11a5 <main+0x65>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    $0xffffffff,%edi
lea    0xe88(%rip),%rsi
mov    $0x0,%al
call   1040 <err@plt>
mov    $0x0,%al
call   1060 <fill_blocks@plt>
mov    $0x0,%al
call   1050 <fill_inodes@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
je     115c <main+0x1c>
lea    0xeb0(%rip),%rsi
mov    $0xffffffff,%edi
xor    %eax,%eax
call   1040 <err@plt>
mov    0x8(%rbx),%rdi
call   1030 <chdir@plt>
test   %rax,%rax
jns    1181 <main+0x41>
mov    0x8(%rbx),%rdx
lea    0xeb1(%rip),%rsi
mov    $0xffffffff,%edi
xor    %eax,%eax
call   1040 <err@plt>
xor    %eax,%eax
call   1060 <fill_blocks@plt>
xor    %eax,%eax
call   1050 <fill_inodes@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"usage: ufs_uprintf /non_optional_path\00"
@.str.1 = [10 x i8] c"chdir(%s)\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i32, i8*, ...) @err(i32 -1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @chdir(i8* %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %10
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 (i32, i8*, ...) @err(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %16, %10
%22 = call i32 (...) @fill_blocks()
%23 = call i32 (...) @fill_inodes()
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"usage: ufs_uprintf /non_optional_path\00"
@.str.1 = [10 x i8] c"chdir(%s)\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i32, i8*, ...) @err(i32 -1, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @chdir(i8* %8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i8*, i8** %7
%13 = tail call i32 (i32, i8*, ...) @err(i32 -1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %11, %6
%15 = tail call i32 (...) @fill_blocks()
%16 = tail call i32 (...) @fill_inodes()
ret i32 0
}