#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 iovec {
  int dummy;
};
typedef int /*<<< orphan*/ errmsg;

/* Variables and functions */
int EX_USAGE;
int MAXPATHLEN;
int /*<<< orphan*/ build_iovec(struct iovec **, int *, char *, char *, int);
scalar_t__ checkpath(char *, char *);
int /*<<< orphan*/ err(int, char *, char *, ...);
int /*<<< orphan*/ errx(int, char *, char *, char *, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int getopt(int, char **, char *);
scalar_t__ nmount(struct iovec *, int, int /*<<< orphan*/);
char *optarg;
scalar_t__ optind;
char *strchr(char *, char);
char *strdup(char *);
scalar_t__ subdir(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  struct iovec *iov;
  char *p, *val;
  char source[MAXPATHLEN];
  char target[MAXPATHLEN];
  char errmsg[255];
  int ch, iovlen;
  char nullfs[] = "nullfs";
  iov = NULL;
  iovlen = 0;
  errmsg[0] = '\0';
  while ((ch = getopt(argc, argv, "o:")) != -1)
    switch (ch) {
    case 'o':
      val = strdup("");
      p = strchr(optarg, '=');
      if (p != NULL) {
        free(val);
        *p = '\0';
        val = p + 1;
      }
      build_iovec(&iov, &iovlen, optarg, val, (size_t)-1);
      break;
    case '?':
    default:
      usage();
    }
  argc -= optind;
  argv += optind;
  if (argc != 2)
    usage();
  if (checkpath(argv[0], target) != 0)
    err(EX_USAGE, "%s", target);
  if (checkpath(argv[1], source) != 0)
    err(EX_USAGE, "%s", source);
  if (subdir(target, source) || subdir(source, target))
    errx(EX_USAGE, "%s (%s) and %s are not distinct paths", argv[0], target,
         argv[1]);
  build_iovec(&iov, &iovlen, "fstype", nullfs, (size_t)-1);
  build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1);
  build_iovec(&iov, &iovlen, "target", target, (size_t)-1);
  build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
  if (nmount(iov, iovlen, 0) < 0) {
    if (errmsg[0] != 0)
      err(1, "%s: %s", source, errmsg);
    else
      err(1, "%s", source);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2df8(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x30(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x160(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x38(%rbp)
mov    (%rax),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x158(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
mov    0xdd1(%rip),%eax
mov    %eax,-0x14f(%rbp)
mov    0xdc8(%rip),%ax
mov    %ax,-0x14b(%rbp)
mov    0xdbd(%rip),%al
mov    %al,-0x149(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x148(%rbp)
movb   $0x0,-0x140(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd91(%rip),%rdx
call   10a0 <getopt@plt>
mov    %eax,-0x144(%rbp)
cmp    $0xffffffff,%eax
je     1341 <main+0x181>
mov    -0x144(%rbp),%eax
mov    %eax,-0x164(%rbp)
sub    $0x3f,%eax
je     1330 <main+0x170>
jmp    12a4 <main+0xe4>
mov    -0x164(%rbp),%eax
sub    $0x6f,%eax
jne    1335 <main+0x175>
jmp    12b8 <main+0xf8>
lea    0xd4a(%rip),%rdi
call   10d0 <strdup@plt>
mov    %rax,-0x28(%rbp)
mov    0x2d29(%rip),%rax
mov    (%rax),%rdi
mov    $0x3d,%esi
call   1060 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1307 <main+0x147>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    0x2cea(%rip),%rax
mov    (%rax),%rdx
mov    -0x28(%rbp),%rcx
lea    -0x18(%rbp),%rdi
lea    -0x148(%rbp),%rsi
mov    $0xffffffff,%r8d
call   10c0 <build_iovec@plt>
jmp    133c <main+0x17c>
jmp    1335 <main+0x175>
mov    $0x0,%al
call   1090 <usage@plt>
jmp    1268 <main+0xa8>
mov    0x2c88(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2c74(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     137c <main+0x1bc>
mov    $0x0,%al
call   1090 <usage@plt>
mov    -0x158(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <checkpath@plt>
cmp    $0x0,%rax
je     13b7 <main+0x1f7>
mov    -0x158(%rbp),%rdx
mov    0x2c39(%rip),%rax
mov    (%rax),%edi
lea    0xca0(%rip),%rsi
mov    $0x0,%al
call   1080 <err@plt>
mov    -0x160(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <checkpath@plt>
cmp    $0x0,%rax
je     13f3 <main+0x233>
mov    -0x160(%rbp),%rdx
mov    0x2bfd(%rip),%rax
mov    (%rax),%edi
lea    0xc64(%rip),%rsi
mov    $0x0,%al
call   1080 <err@plt>
mov    -0x160(%rbp),%rsi
mov    -0x158(%rbp),%rdi
call   10e0 <subdir@plt>
cmp    $0x0,%rax
jne    142d <main+0x26d>
mov    -0x158(%rbp),%rsi
mov    -0x160(%rbp),%rdi
call   10e0 <subdir@plt>
cmp    $0x0,%rax
je     1458 <main+0x298>
mov    -0x158(%rbp),%rcx
mov    0x2ba5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8
lea    0xbb7(%rip),%rsi
call   1050 <errx@plt>
lea    -0x14f(%rbp),%rcx
lea    -0x18(%rbp),%rdi
lea    -0x148(%rbp),%rsi
lea    0xbbf(%rip),%rdx
mov    $0xffffffff,%r8d
call   10c0 <build_iovec@plt>
mov    -0x160(%rbp),%rcx
lea    -0x18(%rbp),%rdi
lea    -0x148(%rbp),%rsi
lea    0xba2(%rip),%rdx
mov    $0xffffffff,%r8d
call   10c0 <build_iovec@plt>
mov    -0x158(%rbp),%rcx
lea    -0x18(%rbp),%rdi
lea    -0x148(%rbp),%rsi
lea    0xb85(%rip),%rdx
mov    $0xffffffff,%r8d
call   10c0 <build_iovec@plt>
lea    -0x140(%rbp),%rcx
lea    -0x18(%rbp),%rdi
lea    -0x148(%rbp),%rsi
lea    0xb68(%rip),%rdx
mov    $0xff,%r8d
call   10c0 <build_iovec@plt>
mov    -0x18(%rbp),%rdi
mov    -0x148(%rbp),%esi
xor    %edx,%edx
call   1040 <nmount@plt>
cmp    $0x0,%rax
jge    1558 <main+0x398>
movsbl -0x140(%rbp),%eax
cmp    $0x0,%eax
je     1539 <main+0x379>
mov    -0x160(%rbp),%rdx
lea    -0x140(%rbp),%rcx
mov    $0x1,%edi
lea    0xb1f(%rip),%rsi
mov    $0x0,%al
call   1080 <err@plt>
jmp    1553 <main+0x393>
mov    -0x160(%rbp),%rdx
mov    $0x1,%edi
lea    0xb04(%rip),%rsi
mov    $0x0,%al
call   1080 <err@plt>
jmp    1558 <main+0x398>
xor    %edi,%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %rsi,%r12
mov    %edi,%r15d
mov    0x2df7(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
movl   $0x73666c,-0x41(%rbp)
movl   $0x6c6c756e,-0x44(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
movb   $0x0,-0x160(%rbp)
lea    0xdd7(%rip),%rbx
mov    0x2dc1(%rip),%r13
mov    %edi,-0x3c(%rbp)
jmp    126e <main+0xae>
nopl   0x0(%rax)
lea    -0x38(%rbp),%rdi
lea    -0x2c(%rbp),%rsi
mov    %r14,%rdx
mov    %r12,%rcx
mov    $0xffffffff,%r8d
call   10c0 <build_iovec@plt>
mov    %rbx,%r12
lea    0xda4(%rip),%rbx
mov    -0x3c(%rbp),%r15d
mov    0x2d8a(%rip),%r13
mov    %r15d,%edi
mov    %r12,%rsi
mov    %rbx,%rdx
call   10a0 <getopt@plt>
cmp    $0x6f,%eax
je     1290 <main+0xd0>
cmp    $0xffffffff,%eax
je     12d7 <main+0x117>
xor    %eax,%eax
call   1090 <usage@plt>
jmp    126e <main+0xae>
nop
mov    %r12,%rbx
lea    0xd6f(%rip),%rdi
call   10d0 <strdup@plt>
mov    %rax,%r12
mov    0x0(%r13),%r14
mov    %r14,%rdi
mov    $0x3d,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1240 <main+0x80>
mov    %rax,%r15
mov    %r12,%rdi
call   1030 <free@plt>
movb   $0x0,(%r15)
add    $0x1,%r15
mov    0x0(%r13),%r14
mov    %r15,%r12
jmp    1240 <main+0x80>
mov    0x2cf2(%rip),%rax
mov    (%rax),%r14
sub    %r14d,%r15d
cmp    $0x2,%r15d
je     12f1 <main+0x131>
xor    %eax,%eax
call   1090 <usage@plt>
mov    (%r12,%r14,8),%rdi
mov    -0x50(%rbp),%r13
mov    %r13,%rsi
call   1070 <checkpath@plt>
test   %rax,%rax
mov    -0x58(%rbp),%r15
je     1324 <main+0x164>
mov    0x2ccf(%rip),%rax
mov    (%rax),%edi
lea    0xd36(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1080 <err@plt>
mov    0x8(%r12,%r14,8),%rdi
mov    %r15,%rsi
call   1070 <checkpath@plt>
test   %rax,%rax
je     1350 <main+0x190>
mov    0x2ca3(%rip),%rax
mov    (%rax),%edi
lea    0xd0a(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <err@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   10e0 <subdir@plt>
test   %rax,%rax
jne    1370 <main+0x1b0>
mov    %r15,%rdi
mov    %r13,%rsi
call   10e0 <subdir@plt>
test   %rax,%rax
je     1391 <main+0x1d1>
mov    0x2c69(%rip),%rax
mov    (%rax),%edi
mov    (%r12,%r14,8),%rdx
mov    0x8(%r12,%r14,8),%r8
lea    0xc81(%rip),%rsi
mov    %r13,%rcx
call   1050 <errx@plt>
lea    0xc98(%rip),%rdx
lea    -0x38(%rbp),%r12
lea    -0x2c(%rbp),%r14
lea    -0x44(%rbp),%rcx
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0xffffffff,%r8d
call   10c0 <build_iovec@plt>
lea    0xc7b(%rip),%rdx
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rcx
mov    $0xffffffff,%r8d
call   10c0 <build_iovec@plt>
lea    0xc67(%rip),%rdx
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r13,%rcx
mov    $0xffffffff,%r8d
call   10c0 <build_iovec@plt>
lea    0xc53(%rip),%rdx
lea    -0x160(%rbp),%rcx
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0xff,%r8d
call   10c0 <build_iovec@plt>
mov    -0x38(%rbp),%rdi
mov    -0x2c(%rbp),%esi
xor    %edx,%edx
call   1040 <nmount@plt>
test   %rax,%rax
jns    143c <main+0x27c>
cmpb   $0x0,-0x160(%rbp)
jne    1443 <main+0x283>
lea    0xc23(%rip),%rsi
mov    $0x1,%edi
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <err@plt>
xor    %edi,%edi
call   10b0 <exit@plt>
lea    0xc02(%rip),%rsi
lea    -0x160(%rbp),%rcx
mov    $0x1,%edi
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <err@plt>
xor    %edi,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.iovec = type { i32 }
@MAXPATHLEN = global i32 0
@__const.main.nullfs = [7 x i8] c"nullfs\00"
@.str = [3 x i8] c"o:\00"
@.str.1 = [1 x i8] zeroinitializer
@optarg = global i8* null
@optind = global i64 0
@EX_USAGE = global i32 0
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [38 x i8] c"%s (%s) and %s are not distinct paths\00"
@.str.4 = [7 x i8] c"fstype\00"
@.str.5 = [7 x i8] c"fspath\00"
@.str.6 = [7 x i8] c"target\00"
@.str.7 = [7 x i8] c"errmsg\00"
@.str.8 = [7 x i8] c"%s: %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.iovec*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca [255 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca [7 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* @MAXPATHLEN
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %9
%19 = alloca i8, i64 %17
store i64 %17, i64* %10
%20 = load i32, i32* @MAXPATHLEN
%21 = zext i32 %20 to i64
%22 = alloca i8, i64 %21
store i64 %21, i64* %11
%23 = bitcast [7 x i8]* %15 to i8*
store %struct.iovec* null, %struct.iovec** %6
store i32 0, i32* %14
%24 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
store i8 0, i8* %24
br label %25
25: ; preds = %51, %2
%26 = load i32, i32* %4
%27 = load i8**, i8*** %5
%28 = call i32 @getopt(i32 %26, i8** %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %28, i32* %13
%29 = icmp ne i32 %28, -1
br i1 %29, label %30, label %52
30: ; preds = %25
%31 = load i32, i32* %13
switch i32 %31, label %49 [
i32 111, label %32
i32 63, label %48
]
32: ; preds = %30
%33 = call i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
store i8* %33, i8** %8
%34 = load i8*, i8** @optarg
%35 = call i8* @strchr(i8* %34, i8 signext 61)
store i8* %35, i8** %7
%36 = load i8*, i8** %7
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %44
38: ; preds = %32
%39 = load i8*, i8** %8
%40 = call i32 @free(i8* %39)
%41 = load i8*, i8** %7
store i8 0, i8* %41
%42 = load i8*, i8** %7
%43 = getelementptr inbounds i8, i8* %42, i64 1
store i8* %43, i8** %8
br label %44
44: ; preds = %38, %32
%45 = load i8*, i8** @optarg
%46 = load i8*, i8** %8
%47 = call i32 @build_iovec(%struct.iovec** %6, i32* %14, i8* %45, i8* %46, i32 -1)
br label %51
48: ; preds = %30
br label %49
49: ; preds = %30, %48
%50 = call i32 (...) @usage()
br label %51
51: ; preds = %49, %44
br label %25
52: ; preds = %25
%53 = load i64, i64* @optind
%54 = load i32, i32* %4
%55 = sext i32 %54 to i64
%56 = sub nsw i64 %55, %53
%57 = trunc i64 %56 to i32
store i32 %57, i32* %4
%58 = load i64, i64* @optind
%59 = load i8**, i8*** %5
%60 = getelementptr inbounds i8*, i8** %59, i64 %58
store i8** %60, i8*** %5
%61 = load i32, i32* %4
%62 = icmp ne i32 %61, 2
br i1 %62, label %63, label %65
63: ; preds = %52
%64 = call i32 (...) @usage()
br label %65
65: ; preds = %63, %52
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 0
%68 = load i8*, i8** %67
%69 = call i64 @checkpath(i8* %68, i8* %22)
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %65
%72 = load i32, i32* @EX_USAGE
%73 = call i32 (i32, i8*, i8*, ...) @err(i32 %72, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %22)
br label %74
74: ; preds = %71, %65
%75 = load i8**, i8*** %5
%76 = getelementptr inbounds i8*, i8** %75, i64 1
%77 = load i8*, i8** %76
%78 = call i64 @checkpath(i8* %77, i8* %19)
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %83
80: ; preds = %74
%81 = load i32, i32* @EX_USAGE
%82 = call i32 (i32, i8*, i8*, ...) @err(i32 %81, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %83
83: ; preds = %80, %74
%84 = call i64 @subdir(i8* %22, i8* %19)
%85 = icmp ne i64 %84, 0
br i1 %85, label %89, label %86
86: ; preds = %83
%87 = call i64 @subdir(i8* %19, i8* %22)
%88 = icmp ne i64 %87, 0
br i1 %88, label %89, label %98
89: ; preds = %86, %83
%90 = load i32, i32* @EX_USAGE
%91 = load i8**, i8*** %5
%92 = getelementptr inbounds i8*, i8** %91, i64 0
%93 = load i8*, i8** %92
%94 = load i8**, i8*** %5
%95 = getelementptr inbounds i8*, i8** %94, i64 1
%96 = load i8*, i8** %95
%97 = call i32 @errx(i32 %90, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %93, i8* %22, i8* %96)
br label %98
98: ; preds = %89, %86
%99 = getelementptr inbounds [7 x i8], [7 x i8]* %15, i64 0, i64 0
%100 = call i32 @build_iovec(%struct.iovec** %6, i32* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %99, i32 -1)
%101 = call i32 @build_iovec(%struct.iovec** %6, i32* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %19, i32 -1)
%102 = call i32 @build_iovec(%struct.iovec** %6, i32* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %22, i32 -1)
%103 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
%104 = call i32 @build_iovec(%struct.iovec** %6, i32* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %103, i32 255)
%105 = load %struct.iovec*, %struct.iovec** %6
%106 = load i32, i32* %14
%107 = call i64 @nmount(%struct.iovec* %105, i32 %106, i32 0)
%108 = icmp slt i64 %107, 0
br i1 %108, label %109, label %120
109: ; preds = %98
%110 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %117
114: ; preds = %109
%115 = getelementptr inbounds [255 x i8], [255 x i8]* %12, i64 0, i64 0
%116 = call i32 (i32, i8*, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %19, i8* %115)
br label %119
117: ; preds = %109
%118 = call i32 (i32, i8*, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %119
119: ; preds = %117, %114
br label %120
120: ; preds = %119, %98
%121 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.iovec = type { i32 }
@MAXPATHLEN = global i32 0
@__const.main.nullfs = [7 x i8] c"nullfs\00"
@.str = [3 x i8] c"o:\00"
@.str.1 = [1 x i8] zeroinitializer
@optarg = global i8* null
@optind = global i64 0
@EX_USAGE = global i32 0
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [38 x i8] c"%s (%s) and %s are not distinct paths\00"
@.str.4 = [7 x i8] c"fstype\00"
@.str.5 = [7 x i8] c"fspath\00"
@.str.6 = [7 x i8] c"target\00"
@.str.7 = [7 x i8] c"errmsg\00"
@.str.8 = [7 x i8] c"%s: %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.iovec*
%4 = alloca [255 x i8]
%5 = alloca i32
%6 = alloca [7 x i8]
%7 = bitcast %struct.iovec** %3 to i8*
%8 = load i32, i32* @MAXPATHLEN
%9 = zext i32 %8 to i64
%10 = alloca i8, i64 %9
%11 = alloca i8, i64 %9
%12 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%13 = bitcast i32* %5 to i8*
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
store %struct.iovec* null, %struct.iovec** %3
store i32 0, i32* %5
store i8 0, i8* %12
br label %15
15: ; preds = %32, %2
%16 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %16, label %30 [
i32 -1, label %33
i32 111, label %17
]
17: ; preds = %15
%18 = call dereferenceable_or_null(1) i8* @strdup(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%19 = load i8*, i8** @optarg
%20 = call i8* @strchr(i8* dereferenceable(1) %19, i8 signext 61)
%21 = icmp eq i8* %20, null
br i1 %21, label %26, label %22
22: ; preds = %17
%23 = call i32 @free(i8* %18)
store i8 0, i8* %20
%24 = getelementptr inbounds i8, i8* %20, i64 1
%25 = load i8*, i8** @optarg
br label %26
26: ; preds = %22, %17
%27 = phi i8* [ %25, %22 ], [ %19, %17 ]
%28 = phi i8* [ %24, %22 ], [ %18, %17 ]
%29 = call i32 @build_iovec(%struct.iovec** %3, i32* %5, i8* %27, i8* %28, i32 -1)
br label %32
30: ; preds = %15
%31 = call i32 (...) @usage()
br label %32
32: ; preds = %30, %26
br label %15
33: ; preds = %15
%34 = load i64, i64* @optind
%35 = trunc i64 %34 to i32
%36 = sub i32 %0, %35
%37 = getelementptr inbounds i8*, i8** %1, i64 %34
%38 = icmp eq i32 %36, 2
br i1 %38, label %41, label %39
39: ; preds = %33
%40 = call i32 (...) @usage()
br label %41
41: ; preds = %39, %33
%42 = load i8*, i8** %37
%43 = call i64 @checkpath(i8* %42, i8* %11)
%44 = icmp eq i64 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %41
%46 = load i32, i32* @EX_USAGE
%47 = call i32 (i32, i8*, i8*, ...) @err(i32 %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %11)
br label %48
48: ; preds = %45, %41
%49 = getelementptr inbounds i8*, i8** %37, i64 1
%50 = load i8*, i8** %49
%51 = call i64 @checkpath(i8* %50, i8* %10)
%52 = icmp eq i64 %51, 0
br i1 %52, label %56, label %53
53: ; preds = %48
%54 = load i32, i32* @EX_USAGE
%55 = call i32 (i32, i8*, i8*, ...) @err(i32 %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %56
56: ; preds = %53, %48
%57 = call i64 @subdir(i8* %11, i8* %10)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = call i64 @subdir(i8* %10, i8* %11)
%61 = icmp eq i64 %60, 0
br i1 %61, label %67, label %62
62: ; preds = %59, %56
%63 = load i32, i32* @EX_USAGE
%64 = load i8*, i8** %37
%65 = load i8*, i8** %49
%66 = call i32 @errx(i32 %63, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %64, i8* %11, i8* %65)
br label %67
67: ; preds = %62, %59
%68 = call i32 @build_iovec(%struct.iovec** %3, i32* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %14, i32 -1)
%69 = call i32 @build_iovec(%struct.iovec** %3, i32* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %10, i32 -1)
%70 = call i32 @build_iovec(%struct.iovec** %3, i32* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %11, i32 -1)
%71 = call i32 @build_iovec(%struct.iovec** %3, i32* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0), i8* %12, i32 255)
%72 = load %struct.iovec*, %struct.iovec** %3
%73 = load i32, i32* %5
%74 = call i64 @nmount(%struct.iovec* %72, i32 %73, i32 0)
%75 = icmp slt i64 %74, 0
br i1 %75, label %76, label %83
76: ; preds = %67
%77 = load i8, i8* %12
%78 = icmp eq i8 %77, 0
br i1 %78, label %81, label %79
79: ; preds = %76
%80 = call i32 (i32, i8*, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %10, i8* %12)
br label %83
81: ; preds = %76
%82 = call i32 (i32, i8*, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %83
83: ; preds = %79, %81, %67
%84 = call i32 @exit(i32 0)
unreachable
}