#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 option {
  char *name;
  char val;
  int /*<<< orphan*/ has_arg;
};
typedef int mode_t;
typedef void *dev_t;

/* Variables and functions */
int S_IFDIR;
int S_IFLNK;
int S_IFMT;
int S_IFREG;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char const *,
                           int, char *);
int getopt_long(int, char **, char *, struct option *, int /*<<< orphan*/ *);
void *major(void *);
void *makedev(void *, void *);
void *minor(void *);
int mkdir(char const *, int);
int mknod(char const *, int, void *);
int /*<<< orphan*/ no_argument;
int /*<<< orphan*/ optarg;
int optind;
int /*<<< orphan*/ required_argument;
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void *strtoul(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/);
int symlink(char *, char const *);
int /*<<< orphan*/ usage(char *, int);
int main(int argc, char **argv) {
  struct option opts[] = {
      {.name = "device", .has_arg = required_argument, .val = 'd'},
      {.name = "help", .has_arg = no_argument, .val = 'h'},
      {.name = "mode", .has_arg = required_argument, .val = 'm'},
      {.name = "major", .has_arg = required_argument, .val = 'M'},
      {.name = "minor", .has_arg = required_argument, .val = 'N'},
      {.name = NULL}};
  const char *path;
  mode_t mode = S_IFREG | 0644;
  dev_t dev = 0;
  int rc;
  int c;
  while ((c = getopt_long(argc, argv, "d:hm:M:N:", opts, NULL)) != -1) {
    switch (c) {
    case 'd':
      dev = strtoul(optarg, NULL, 0);
      break;
    case 'h':
      usage(argv[0], 0);
    case 'm':
      mode = strtoul(optarg, NULL, 0);
      break;
    case 'M':
      dev = makedev(strtoul(optarg, NULL, 0), minor(dev));
      break;
    case 'N':
      dev = makedev(major(dev), strtoul(optarg, NULL, 0));
      break;
    case '?':
      usage(argv[0], 1);
    }
  }
  if (argc - optind != 1)
    usage(argv[0], 1);
  path = argv[optind];
  if ((mode & S_IFMT) == S_IFDIR)
    rc = mkdir(path, mode & ~S_IFMT);
  else if ((mode & S_IFMT) == S_IFLNK)
    rc = symlink("oldpath", path);
  else
    rc = mknod(path, mode, dev);
  if (rc)
    fprintf(stderr, "%s: cannot create `%s' with mode %#o: %s\n", argv[0], path,
            mode, strerror(errno));
  return rc;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeec(%rip),%rax
mov    %rax,-0x70(%rbp)
movb   $0x64,-0x68(%rbp)
mov    0x2de9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
lea    0xed8(%rip),%rax
mov    %rax,-0x60(%rbp)
movb   $0x68,-0x58(%rbp)
mov    0x2da6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
lea    0xec2(%rip),%rax
mov    %rax,-0x50(%rbp)
movb   $0x6d,-0x48(%rbp)
mov    0x2db3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
lea    0xeac(%rip),%rax
mov    %rax,-0x40(%rbp)
movb   $0x4d,-0x38(%rbp)
mov    0x2d98(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
lea    0xe97(%rip),%rax
mov    %rax,-0x30(%rbp)
movb   $0x4e,-0x28(%rbp)
mov    0x2d7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
movq   $0x0,-0x20(%rbp)
movb   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2d76(%rip),%rax
mov    (%rax),%eax
or     $0x1a4,%eax
mov    %eax,-0x7c(%rbp)
movq   $0x0,-0x88(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x70(%rbp),%rcx
lea    0xe48(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <getopt_long@plt>
mov    %eax,-0x90(%rbp)
cmp    $0xffffffff,%eax
je     13c0 <main+0x210>
mov    -0x90(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x98(%rbp)
sub    $0x2e,%eax
ja     13bb <main+0x20b>
mov    -0x98(%rbp),%rax
lea    0xd2d(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10c0 <strtoul@plt>
mov    %rax,-0x88(%rbp)
jmp    13bb <main+0x20b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
xor    %esi,%esi
call   10a0 <usage@plt>
mov    0x2ce7(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10c0 <strtoul@plt>
mov    %eax,-0x7c(%rbp)
jmp    13bb <main+0x20b>
mov    0x2ccb(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10c0 <strtoul@plt>
mov    %rax,-0xa0(%rbp)
mov    -0x88(%rbp),%rdi
call   1040 <minor@plt>
mov    -0xa0(%rbp),%rdi
mov    %rax,%rsi
call   10b0 <makedev@plt>
mov    %rax,-0x88(%rbp)
jmp    13bb <main+0x20b>
mov    -0x88(%rbp),%rdi
call   1070 <major@plt>
mov    %rax,-0xa8(%rbp)
mov    0x2c76(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10c0 <strtoul@plt>
mov    -0xa8(%rbp),%rdi
mov    %rax,%rsi
call   10b0 <makedev@plt>
mov    %rax,-0x88(%rbp)
jmp    13bb <main+0x20b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x1,%esi
call   10a0 <usage@plt>
jmp    127f <main+0xcf>
mov    -0x8(%rbp),%eax
mov    0x2c06(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x1,%eax
je     13e6 <main+0x236>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x1,%esi
call   10a0 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x2bdf(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x78(%rbp)
mov    -0x7c(%rbp),%eax
mov    0x2bb2(%rip),%rcx
and    (%rcx),%eax
mov    0x2b81(%rip),%rcx
cmp    (%rcx),%eax
jne    143c <main+0x28c>
mov    -0x78(%rbp),%rdi
mov    -0x7c(%rbp),%esi
mov    0x2b93(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    %eax,%esi
call   1030 <mkdir@plt>
mov    %eax,-0x8c(%rbp)
jmp    1490 <main+0x2e0>
mov    -0x7c(%rbp),%eax
mov    0x2b72(%rip),%rcx
and    (%rcx),%eax
mov    0x2b89(%rip),%rcx
cmp    (%rcx),%eax
jne    1472 <main+0x2c2>
mov    -0x78(%rbp),%rsi
lea    0xc81(%rip),%rdi
call   1060 <symlink@plt>
mov    %eax,-0x8c(%rbp)
jmp    148b <main+0x2db>
mov    -0x78(%rbp),%rdi
mov    -0x7c(%rbp),%esi
mov    -0x88(%rbp),%rdx
call   1090 <mknod@plt>
mov    %eax,-0x8c(%rbp)
jmp    1490 <main+0x2e0>
cmpl   $0x0,-0x8c(%rbp)
je     1506 <main+0x356>
mov    0x2b0c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc4(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x7c(%rbp),%eax
mov    %eax,-0xac(%rbp)
mov    0x2ad3(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    -0xc4(%rbp),%edi
mov    -0xc0(%rbp),%rdx
mov    -0xb8(%rbp),%rcx
mov    -0xac(%rbp),%r8d
mov    %rax,%r9
lea    0xbea(%rip),%rsi
call   1080 <fprintf@plt>
mov    -0x8c(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xef2(%rip),%rax
mov    %rax,0x10(%rsp)
movb   $0x64,0x18(%rsp)
mov    0x2ded(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x1c(%rsp)
lea    0xedb(%rip),%rcx
mov    %rcx,0x20(%rsp)
movb   $0x68,0x28(%rsp)
mov    0x2da7(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x2c(%rsp)
lea    0xec2(%rip),%rcx
mov    %rcx,0x30(%rsp)
movb   $0x6d,0x38(%rsp)
mov    %eax,0x3c(%rsp)
lea    0xeb2(%rip),%rcx
mov    %rcx,0x40(%rsp)
movb   $0x4d,0x48(%rsp)
mov    %eax,0x4c(%rsp)
lea    0xea3(%rip),%rcx
mov    %rcx,0x50(%rsp)
movb   $0x4e,0x58(%rsp)
mov    %eax,0x5c(%rsp)
movq   $0x0,0x60(%rsp)
movb   $0x0,0x68(%rsp)
movl   $0x0,0x6c(%rsp)
mov    0x2d85(%rip),%rax
mov    $0x1a4,%ecx
or     (%rax),%ecx
mov    %rcx,0x8(%rsp)
xor    %r14d,%r14d
lea    0xe68(%rip),%r12
lea    0x10(%rsp),%r13
lea    0xd83(%rip),%r15
jmp    1289 <main+0xd9>
nop
cmp    $0xffffffff,%eax
je     1348 <main+0x198>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %r8d,%r8d
call   1050 <getopt_long@plt>
lea    -0x3f(%rax),%ecx
cmp    $0x2e,%ecx
ja     1280 <main+0xd0>
movslq (%r15,%rcx,4),%rax
add    %r15,%rax
jmp    *%rax
mov    (%rbx),%rdi
mov    $0x1,%esi
call   10a0 <usage@plt>
jmp    1289 <main+0xd9>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <strtoul@plt>
mov    %r14,%rdi
mov    %rax,%r14
call   1040 <minor@plt>
jmp    12f8 <main+0x148>
mov    %r14,%rdi
call   1070 <major@plt>
mov    %rax,%r14
mov    0x2d0b(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <strtoul@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   10b0 <makedev@plt>
mov    %rax,%r14
jmp    1289 <main+0xd9>
mov    0x2ce9(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <strtoul@plt>
mov    %rax,%r14
jmp    1289 <main+0xd9>
mov    (%rbx),%rdi
xor    %esi,%esi
call   10a0 <usage@plt>
mov    0x2cc5(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
xor    %edx,%edx
call   10c0 <strtoul@plt>
mov    %rax,0x8(%rsp)
jmp    1289 <main+0xd9>
mov    %r14,%r13
mov    0x2c7e(%rip),%r14
mov    (%r14),%eax
sub    %eax,%ebp
cmp    $0x1,%ebp
je     136c <main+0x1bc>
mov    (%rbx),%rdi
mov    $0x1,%esi
call   10a0 <usage@plt>
mov    (%r14),%eax
cltq
mov    (%rbx,%rax,8),%r12
mov    0x2c3f(%rip),%rax
mov    (%rax),%esi
mov    %esi,%eax
mov    0x8(%rsp),%r15
and    %r15d,%eax
mov    0x2c04(%rip),%rcx
cmp    (%rcx),%eax
jne    139f <main+0x1ef>
not    %esi
and    %r15d,%esi
mov    %r12,%rdi
call   1030 <mkdir@plt>
jmp    13c9 <main+0x219>
mov    0x2c32(%rip),%rcx
cmp    (%rcx),%eax
jne    13bb <main+0x20b>
lea    0xd32(%rip),%rdi
mov    %r12,%rsi
call   1060 <symlink@plt>
jmp    13c9 <main+0x219>
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r13,%rdx
call   1090 <mknod@plt>
mov    %eax,%ebp
test   %eax,%eax
je     1405 <main+0x255>
mov    0x2bda(%rip),%rax
mov    (%rax),%r14d
mov    (%rbx),%rbx
mov    0x2bc5(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xcfa(%rip),%rsi
mov    %r14d,%edi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15d,%r8d
mov    %rax,%r9
call   1080 <fprintf@plt>
mov    %ebp,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32 }
@.str = [7 x i8] c"device\00"
@required_argument = global i32 0
@.str.1 = [5 x i8] c"help\00"
@no_argument = global i32 0
@.str.2 = [5 x i8] c"mode\00"
@.str.3 = [6 x i8] c"major\00"
@.str.4 = [6 x i8] c"minor\00"
@S_IFREG = global i32 0
@.str.5 = [10 x i8] c"d:hm:M:N:\00"
@optarg = global i32 0
@optind = global i32 0
@S_IFMT = global i32 0
@S_IFDIR = global i32 0
@S_IFLNK = global i32 0
@.str.6 = [8 x i8] c"oldpath\00"
@stderr = global i32 0
@.str.7 = [42 x i8] c"%s: cannot create `%s' with mode %#o: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x %struct.option]
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %6, i64 0, i64 0
%13 = getelementptr inbounds %struct.option, %struct.option* %12, i32 0, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %13
%14 = getelementptr inbounds %struct.option, %struct.option* %12, i32 0, i32 1
store i8 100, i8* %14
%15 = getelementptr inbounds %struct.option, %struct.option* %12, i32 0, i32 2
%16 = load i32, i32* @required_argument
store i32 %16, i32* %15
%17 = getelementptr inbounds %struct.option, %struct.option* %12, i64 1
%18 = getelementptr inbounds %struct.option, %struct.option* %17, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %18
%19 = getelementptr inbounds %struct.option, %struct.option* %17, i32 0, i32 1
store i8 104, i8* %19
%20 = getelementptr inbounds %struct.option, %struct.option* %17, i32 0, i32 2
%21 = load i32, i32* @no_argument
store i32 %21, i32* %20
%22 = getelementptr inbounds %struct.option, %struct.option* %17, i64 1
%23 = getelementptr inbounds %struct.option, %struct.option* %22, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %23
%24 = getelementptr inbounds %struct.option, %struct.option* %22, i32 0, i32 1
store i8 109, i8* %24
%25 = getelementptr inbounds %struct.option, %struct.option* %22, i32 0, i32 2
%26 = load i32, i32* @required_argument
store i32 %26, i32* %25
%27 = getelementptr inbounds %struct.option, %struct.option* %22, i64 1
%28 = getelementptr inbounds %struct.option, %struct.option* %27, i32 0, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %28
%29 = getelementptr inbounds %struct.option, %struct.option* %27, i32 0, i32 1
store i8 77, i8* %29
%30 = getelementptr inbounds %struct.option, %struct.option* %27, i32 0, i32 2
%31 = load i32, i32* @required_argument
store i32 %31, i32* %30
%32 = getelementptr inbounds %struct.option, %struct.option* %27, i64 1
%33 = getelementptr inbounds %struct.option, %struct.option* %32, i32 0, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %33
%34 = getelementptr inbounds %struct.option, %struct.option* %32, i32 0, i32 1
store i8 78, i8* %34
%35 = getelementptr inbounds %struct.option, %struct.option* %32, i32 0, i32 2
%36 = load i32, i32* @required_argument
store i32 %36, i32* %35
%37 = getelementptr inbounds %struct.option, %struct.option* %32, i64 1
%38 = getelementptr inbounds %struct.option, %struct.option* %37, i32 0, i32 0
store i8* null, i8** %38
%39 = getelementptr inbounds %struct.option, %struct.option* %37, i32 0, i32 1
store i8 0, i8* %39
%40 = getelementptr inbounds %struct.option, %struct.option* %37, i32 0, i32 2
store i32 0, i32* %40
%41 = load i32, i32* @S_IFREG
%42 = or i32 %41, 420
store i32 %42, i32* %8
store i8* null, i8** %9
br label %43
43: ; preds = %80, %2
%44 = load i32, i32* %4
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %6, i64 0, i64 0
%47 = call i32 @getopt_long(i32 %44, i8** %45, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), %struct.option* %46, i32* null)
store i32 %47, i32* %11
%48 = icmp ne i32 %47, -1
br i1 %48, label %49, label %81
49: ; preds = %43
%50 = load i32, i32* %11
switch i32 %50, label %80 [
i32 100, label %51
i32 104, label %54
i32 109, label %59
i32 77, label %63
i32 78, label %69
i32 63, label %75
]
51: ; preds = %49
%52 = load i32, i32* @optarg
%53 = call i8* @strtoul(i32 %52, i32* null, i32 0)
store i8* %53, i8** %9
br label %80
54: ; preds = %49
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 0
%57 = load i8*, i8** %56
%58 = call i32 @usage(i8* %57, i32 0)
br label %59
59: ; preds = %49, %54
%60 = load i32, i32* @optarg
%61 = call i8* @strtoul(i32 %60, i32* null, i32 0)
%62 = ptrtoint i8* %61 to i32
store i32 %62, i32* %8
br label %80
63: ; preds = %49
%64 = load i32, i32* @optarg
%65 = call i8* @strtoul(i32 %64, i32* null, i32 0)
%66 = load i8*, i8** %9
%67 = call i8* @minor(i8* %66)
%68 = call i8* @makedev(i8* %65, i8* %67)
store i8* %68, i8** %9
br label %80
69: ; preds = %49
%70 = load i8*, i8** %9
%71 = call i8* @major(i8* %70)
%72 = load i32, i32* @optarg
%73 = call i8* @strtoul(i32 %72, i32* null, i32 0)
%74 = call i8* @makedev(i8* %71, i8* %73)
store i8* %74, i8** %9
br label %80
75: ; preds = %49
%76 = load i8**, i8*** %5
%77 = getelementptr inbounds i8*, i8** %76, i64 0
%78 = load i8*, i8** %77
%79 = call i32 @usage(i8* %78, i32 1)
br label %80
80: ; preds = %75, %49, %69, %63, %59, %51
br label %43
81: ; preds = %43
%82 = load i32, i32* %4
%83 = load i32, i32* @optind
%84 = sub nsw i32 %82, %83
%85 = icmp ne i32 %84, 1
br i1 %85, label %86, label %91
86: ; preds = %81
%87 = load i8**, i8*** %5
%88 = getelementptr inbounds i8*, i8** %87, i64 0
%89 = load i8*, i8** %88
%90 = call i32 @usage(i8* %89, i32 1)
br label %91
91: ; preds = %86, %81
%92 = load i8**, i8*** %5
%93 = load i32, i32* @optind
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8*, i8** %92, i64 %94
%96 = load i8*, i8** %95
store i8* %96, i8** %7
%97 = load i32, i32* %8
%98 = load i32, i32* @S_IFMT
%99 = and i32 %97, %98
%100 = load i32, i32* @S_IFDIR
%101 = icmp eq i32 %99, %100
br i1 %101, label %102, label %109
102: ; preds = %91
%103 = load i8*, i8** %7
%104 = load i32, i32* %8
%105 = load i32, i32* @S_IFMT
%106 = xor i32 %105, -1
%107 = and i32 %104, %106
%108 = call i32 @mkdir(i8* %103, i32 %107)
store i32 %108, i32* %10
br label %124
109: ; preds = %91
%110 = load i32, i32* %8
%111 = load i32, i32* @S_IFMT
%112 = and i32 %110, %111
%113 = load i32, i32* @S_IFLNK
%114 = icmp eq i32 %112, %113
br i1 %114, label %115, label %118
115: ; preds = %109
%116 = load i8*, i8** %7
%117 = call i32 @symlink(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* %116)
store i32 %117, i32* %10
br label %123
118: ; preds = %109
%119 = load i8*, i8** %7
%120 = load i32, i32* %8
%121 = load i8*, i8** %9
%122 = call i32 @mknod(i8* %119, i32 %120, i8* %121)
store i32 %122, i32* %10
br label %123
123: ; preds = %118, %115
br label %124
124: ; preds = %123, %102
%125 = load i32, i32* %10
%126 = icmp ne i32 %125, 0
br i1 %126, label %127, label %137
127: ; preds = %124
%128 = load i32, i32* @stderr
%129 = load i8**, i8*** %5
%130 = getelementptr inbounds i8*, i8** %129, i64 0
%131 = load i8*, i8** %130
%132 = load i8*, i8** %7
%133 = load i32, i32* %8
%134 = load i32, i32* @errno
%135 = call i8* @strerror(i32 %134)
%136 = call i32 @fprintf(i32 %128, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* %131, i8* %132, i32 %133, i8* %135)
br label %137
137: ; preds = %127, %124
%138 = load i32, i32* %10
ret i32 %138
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32 }
@.str = [7 x i8] c"device\00"
@required_argument = global i32 0
@.str.1 = [5 x i8] c"help\00"
@no_argument = global i32 0
@.str.2 = [5 x i8] c"mode\00"
@.str.3 = [6 x i8] c"major\00"
@.str.4 = [6 x i8] c"minor\00"
@S_IFREG = global i32 0
@.str.5 = [10 x i8] c"d:hm:M:N:\00"
@optarg = global i32 0
@optind = global i32 0
@S_IFMT = global i32 0
@S_IFDIR = global i32 0
@S_IFLNK = global i32 0
@.str.6 = [8 x i8] c"oldpath\00"
@stderr = global i32 0
@.str.7 = [42 x i8] c"%s: cannot create `%s' with mode %#o: %s\0A\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [6 x %struct.option]
%4 = bitcast [6 x %struct.option]* %3 to i8*
%5 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 0
%6 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 0, i32 1
store i8 100, i8* %7
%8 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 0, i32 2
%9 = load i32, i32* @required_argument
store i32 %9, i32* %8
%10 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %10
%11 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 1, i32 1
store i8 104, i8* %11
%12 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 1, i32 2
%13 = load i32, i32* @no_argument
store i32 %13, i32* %12
%14 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 2, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %14
%15 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 2, i32 1
store i8 109, i8* %15
%16 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 2, i32 2
store i32 %9, i32* %16
%17 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 3, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %17
%18 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 3, i32 1
store i8 77, i8* %18
%19 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 3, i32 2
store i32 %9, i32* %19
%20 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 4, i32 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8** %20
%21 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 4, i32 1
store i8 78, i8* %21
%22 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 4, i32 2
store i32 %9, i32* %22
%23 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 5, i32 0
store i8* null, i8** %23
%24 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 5, i32 1
store i8 0, i8* %24
%25 = getelementptr inbounds [6 x %struct.option], [6 x %struct.option]* %3, i64 0, i64 5, i32 2
store i32 0, i32* %25
%26 = load i32, i32* @S_IFREG
%27 = or i32 %26, 420
br label %28
28: ; preds = %57, %2
%29 = phi i8* [ null, %2 ], [ %58, %57 ]
%30 = phi i32 [ %27, %2 ], [ %32, %57 ]
br label %31
31: ; preds = %28, %42
%32 = phi i32 [ %30, %28 ], [ %46, %42 ]
br label %33
33: ; preds = %35, %31
%34 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), %struct.option* %5, i32* null)
switch i32 %34, label %35 [
i32 -1, label %62
i32 100, label %36
i32 104, label %39
i32 109, label %42
i32 77, label %47
i32 78, label %52
i32 63, label %59
]
35: ; preds = %33, %59
br label %33
36: ; preds = %33
%37 = load i32, i32* @optarg
%38 = call i8* @strtoul(i32 %37, i32* null, i32 0)
br label %57
39: ; preds = %33
%40 = load i8*, i8** %1
%41 = call i32 @usage(i8* %40, i32 0)
br label %42
42: ; preds = %33, %39
%43 = load i32, i32* @optarg
%44 = call i8* @strtoul(i32 %43, i32* null, i32 0)
%45 = ptrtoint i8* %44 to i64
%46 = trunc i64 %45 to i32
br label %31
47: ; preds = %33
%48 = load i32, i32* @optarg
%49 = call i8* @strtoul(i32 %48, i32* null, i32 0)
%50 = call i8* @minor(i8* %29)
%51 = call i8* @makedev(i8* %49, i8* %50)
br label %57
52: ; preds = %33
%53 = call i8* @major(i8* %29)
%54 = load i32, i32* @optarg
%55 = call i8* @strtoul(i32 %54, i32* null, i32 0)
%56 = call i8* @makedev(i8* %53, i8* %55)
br label %57
57: ; preds = %52, %47, %36
%58 = phi i8* [ %38, %36 ], [ %51, %47 ], [ %56, %52 ]
br label %28
59: ; preds = %33
%60 = load i8*, i8** %1
%61 = call i32 @usage(i8* %60, i32 1)
br label %35
62: ; preds = %33
%63 = load i32, i32* @optind
%64 = sub nsw i32 %0, %63
%65 = icmp eq i32 %64, 1
br i1 %65, label %70, label %66
66: ; preds = %62
%67 = load i8*, i8** %1
%68 = call i32 @usage(i8* %67, i32 1)
%69 = load i32, i32* @optind
br label %70
70: ; preds = %66, %62
%71 = phi i32 [ %69, %66 ], [ %63, %62 ]
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %1, i64 %72
%74 = load i8*, i8** %73
%75 = load i32, i32* @S_IFMT
%76 = and i32 %75, %32
%77 = load i32, i32* @S_IFDIR
%78 = icmp eq i32 %76, %77
br i1 %78, label %79, label %83
79: ; preds = %70
%80 = xor i32 %75, -1
%81 = and i32 %32, %80
%82 = call i32 @mkdir(i8* %74, i32 %81)
br label %90
83: ; preds = %70
%84 = load i32, i32* @S_IFLNK
%85 = icmp eq i32 %76, %84
br i1 %85, label %86, label %88
86: ; preds = %83
%87 = call i32 @symlink(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i8* %74)
br label %90
88: ; preds = %83
%89 = call i32 @mknod(i8* %74, i32 %32, i8* %29)
br label %90
90: ; preds = %86, %88, %79
%91 = phi i32 [ %82, %79 ], [ %87, %86 ], [ %89, %88 ]
%92 = icmp eq i32 %91, 0
br i1 %92, label %99, label %93
93: ; preds = %90
%94 = load i32, i32* @stderr
%95 = load i8*, i8** %1
%96 = load i32, i32* @errno
%97 = call i8* @strerror(i32 %96)
%98 = call i32 @fprintf(i32 %94, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i8* %95, i8* %74, i32 %32, i8* %97)
br label %99
99: ; preds = %93, %90
ret i32 %91
}