#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 stat {
  int /*<<< orphan*/ st_rdev;
  int /*<<< orphan*/ st_mode;
};
typedef int mode_t;

/* Variables and functions */
int S_IFCHR;
int S_IFMT;
int /*<<< orphan*/ S_ISCHR(int /*<<< orphan*/);
scalar_t__ errno;
int /*<<< orphan*/ error(int, scalar_t__, char *, ...);
int /*<<< orphan*/ major(int /*<<< orphan*/);
int /*<<< orphan*/ makedev(int /*<<< orphan*/, int);
int mknod(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, int);
int stat(char *, struct stat *);
void *strtol(char *, char **, int);
int main(int argc, char **argv) {
  int rc;
  mode_t mode = 0660;
  struct stat emlog_stat;
  int size_of_buffer = 8;
  char *file;
  char *number;
  char *end_of_number;
  if (argc < 2 || argc > 4) {
    error(1, 0, "usage: mkemlog <logdevname> [size_in_kilobytes] [mode]");
  }
  file = argv[1];
  if (argc > 2) {
    errno = 0;
    number = argv[2];
    size_of_buffer = strtol(number, &end_of_number, 10);
    if (errno) {
      error(1, errno,
            "Invalid size provided\n"
            "usage: mkemlog <logdevname> [size_in_kilobytes] [mode]");
    }
    if (end_of_number == number) {
      error(1, 0,
            "Invalid size provided\n"
            "usage: mkemlog <logdevname> [size_in_kilobytes] [mode]");
    }
    if (size_of_buffer < 1 || size_of_buffer > 128) {
      error(1, 0,
            "Invalid size provided must be a value between 1 and 128\n"
            "usage: mkemlog <logdevname> [size_in_kilobytes] [mode]");
    }
  }
  if (argc > 3) {
    errno = 0;
    number = argv[3];
    mode = strtol(number, &end_of_number, 8);
    if (errno) {
      error(1, errno,
            "Invalid mode provided\n"
            "usage: mkemlog <logdevname> [size_in_kilobytes] [mode]");
    }
    if (end_of_number == number || S_IFMT & mode) {
      error(1, 0,
            "Invalid mode provided\n"
            "usage: mkemlog <logdevname> [size_in_kilobytes] [mode]");
    }
  }
  rc = stat("/dev/emlog", &emlog_stat);
  if (rc == -1) {
    error(1, errno,
          "stat: "
          "/dev/emlog");
  }
  if (!S_ISCHR(emlog_stat.st_mode)) {
    error(1, 0,
          "/dev/emlog"
          " is not a valid emlog device\n");
  }
  rc = mknod(file, mode | S_IFCHR,
             makedev(major(emlog_stat.st_rdev), size_of_buffer));
  if (rc == -1) {
    error(1, errno, "mknod: %s", file);
  }
  printf("Log device %s created with buffer size of %d KiB\n", file,
         size_of_buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1b0,-0x18(%rbp)
movl   $0x8,-0x24(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     11b8 <main+0x38>
cmpl   $0x4,-0x8(%rbp)
jle    11cf <main+0x4f>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
lea    0xebd(%rip),%rdx
mov    $0x0,%al
call   1090 <error@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    129a <main+0x11a>
mov    0x2de4(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,-0x24(%rbp)
mov    0x2db5(%rip),%rax
cmpq   $0x0,(%rax)
je     1242 <main+0xc2>
mov    0x2da4(%rip),%rax
mov    (%rax),%rsi
mov    $0x1,%edi
lea    0xdc5(%rip),%rdx
mov    $0x0,%al
call   1090 <error@plt>
mov    -0x40(%rbp),%rax
cmp    -0x38(%rbp),%rax
jne    1267 <main+0xe7>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
lea    0xda0(%rip),%rdx
mov    $0x0,%al
call   1090 <error@plt>
cmpl   $0x1,-0x24(%rbp)
jl     127e <main+0xfe>
cmpl   $0x80,-0x24(%rbp)
jle    1295 <main+0x115>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
lea    0xdbf(%rip),%rdx
mov    $0x0,%al
call   1090 <error@plt>
jmp    129a <main+0x11a>
cmpl   $0x3,-0x8(%rbp)
jle    1340 <main+0x1c0>
mov    0x2d25(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x8,%edx
call   1070 <strtol@plt>
mov    %eax,-0x18(%rbp)
mov    0x2cf6(%rip),%rax
cmpq   $0x0,(%rax)
je     1301 <main+0x181>
mov    0x2ce5(%rip),%rax
mov    (%rax),%rsi
mov    $0x1,%edi
lea    0xdc2(%rip),%rdx
mov    $0x0,%al
call   1090 <error@plt>
mov    -0x40(%rbp),%rax
cmp    -0x38(%rbp),%rax
je     1324 <main+0x1a4>
mov    0x2cca(%rip),%rax
mov    (%rax),%eax
and    -0x18(%rbp),%eax
cmp    $0x0,%eax
je     133b <main+0x1bb>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
lea    0xd88(%rip),%rdx
mov    $0x0,%al
call   1090 <error@plt>
jmp    1340 <main+0x1c0>
lea    0xdc8(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1050 <stat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    137a <main+0x1fa>
mov    0x2c6c(%rip),%rax
mov    (%rax),%rsi
mov    $0x1,%edi
lea    0xd96(%rip),%rdx
mov    $0x0,%al
call   1090 <error@plt>
mov    -0x1c(%rbp),%edi
call   1080 <S_ISCHR@plt>
cmp    $0x0,%eax
jne    13a2 <main+0x222>
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%esi
lea    0xd7f(%rip),%rdx
mov    $0x0,%al
call   1090 <error@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2c24(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%edi
call   1040 <major@plt>
mov    %eax,%edi
mov    -0x24(%rbp),%esi
call   10a0 <makedev@plt>
mov    -0x50(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    %eax,%edx
call   1060 <mknod@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1407 <main+0x287>
mov    0x2be3(%rip),%rax
mov    (%rax),%rsi
mov    -0x30(%rbp),%rcx
mov    $0x1,%edi
lea    0xd42(%rip),%rdx
mov    $0x0,%al
call   1090 <error@plt>
mov    -0x30(%rbp),%rsi
mov    -0x24(%rbp),%edx
lea    0xd37(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
mov    %edi,%ebx
lea    -0x5(%rbx),%eax
cmp    $0xfffffffc,%eax
ja     11b0 <main+0x30>
lea    0xee3(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <error@plt>
mov    0x8(%r13),%rbp
mov    $0x1b0,%r12d
mov    $0x8,%r15d
cmp    $0x3,%ebx
jl     12bd <main+0x13d>
mov    %rbp,0x10(%rsp)
mov    0x2dfb(%rip),%r14
movq   $0x0,(%r14)
mov    0x10(%r13),%rbp
mov    %rsp,%rsi
mov    %rbp,%rdi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%r15
mov    (%r14),%rsi
test   %rsi,%rsi
je     120e <main+0x8e>
lea    0xdfe(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <error@plt>
cmp    %rbp,(%rsp)
jne    1229 <main+0xa9>
lea    0xde5(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <error@plt>
lea    -0x81(%r15),%eax
cmp    $0xffffff7f,%eax
mov    0x10(%rsp),%rbp
ja     1251 <main+0xd1>
lea    0xe0a(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <error@plt>
cmp    $0x4,%ebx
jb     12bd <main+0x13d>
mov    0x2d73(%rip),%r14
movq   $0x0,(%r14)
mov    0x18(%r13),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x8,%edx
call   1070 <strtol@plt>
mov    %rax,%r12
mov    (%r14),%rsi
test   %rsi,%rsi
je     1296 <main+0x116>
lea    0xe32(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <error@plt>
cmp    %rbx,(%rsp)
je     12a8 <main+0x128>
mov    0x2d3d(%rip),%rax
test   %r12d,(%rax)
je     12bd <main+0x13d>
lea    0xe0d(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <error@plt>
lea    0xe4b(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <stat@plt>
cmp    $0xffffffff,%eax
jne    12f0 <main+0x170>
mov    0x2cf6(%rip),%rax
mov    (%rax),%rsi
lea    0xe25(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   1090 <error@plt>
mov    0xc(%rsp),%edi
call   1080 <S_ISCHR@plt>
test   %eax,%eax
jne    1312 <main+0x192>
lea    0xe16(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <error@plt>
mov    0x2cbf(%rip),%rax
or     (%rax),%r12d
mov    0x8(%rsp),%edi
call   1040 <major@plt>
mov    %eax,%edi
mov    %r15d,%esi
call   10a0 <makedev@plt>
mov    %rbp,%rdi
mov    %r12d,%esi
mov    %eax,%edx
call   1060 <mknod@plt>
cmp    $0xffffffff,%eax
jne    1361 <main+0x1e1>
mov    0x2c88(%rip),%rax
mov    (%rax),%rsi
lea    0xdf0(%rip),%rdx
mov    $0x1,%edi
mov    %rbp,%rcx
xor    %eax,%eax
call   1090 <error@plt>
lea    0xde4(%rip),%rdi
mov    %rbp,%rsi
mov    %r15d,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32 }
@.str = [55 x i8] c"usage: mkemlog <logdevname> [size_in_kilobytes] [mode]\00"
@errno = global i64 0
@.str.1 = [77 x i8] c"Invalid size provided\0Ausage: mkemlog <logdevname> [size_in_kilobytes] [mode]\00"
@.str.2 = [111 x i8] c"Invalid size provided must be a value between 1 and 128\0Ausage: mkemlog <logdevname> [size_in_kilobytes] [mode]\00"
@.str.3 = [77 x i8] c"Invalid mode provided\0Ausage: mkemlog <logdevname> [size_in_kilobytes] [mode]\00"
@S_IFMT = global i32 0
@.str.4 = [11 x i8] c"/dev/emlog\00"
@.str.5 = [17 x i8] c"stat: /dev/emlog\00"
@.str.6 = [40 x i8] c"/dev/emlog is not a valid emlog device\0A\00"
@S_IFCHR = global i32 0
@.str.7 = [10 x i8] c"mknod: %s\00"
@.str.8 = [50 x i8] c"Log device %s created with buffer size of %d KiB\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.stat
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 432, i32* %7
store i32 8, i32* %9
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 2
br i1 %14, label %18, label %15
15: ; preds = %2
%16 = load i32, i32* %4
%17 = icmp sgt i32 %16, 4
br i1 %17, label %18, label %20
18: ; preds = %15, %2
%19 = call i32 (i32, i64, i8*, ...) @error(i32 1, i64 0, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
store i8* %23, i8** %10
%24 = load i32, i32* %4
%25 = icmp sgt i32 %24, 2
br i1 %25, label %26, label %53
26: ; preds = %20
store i64 0, i64* @errno
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 2
%29 = load i8*, i8** %28
store i8* %29, i8** %11
%30 = load i8*, i8** %11
%31 = call i8* @strtol(i8* %30, i8** %12, i32 10)
%32 = ptrtoint i8* %31 to i32
store i32 %32, i32* %9
%33 = load i64, i64* @errno
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %26
%36 = load i64, i64* @errno
%37 = call i32 (i32, i64, i8*, ...) @error(i32 1, i64 %36, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %35, %26
%39 = load i8*, i8** %12
%40 = load i8*, i8** %11
%41 = icmp eq i8* %39, %40
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 (i32, i64, i8*, ...) @error(i32 1, i64 0, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0))
br label %44
44: ; preds = %42, %38
%45 = load i32, i32* %9
%46 = icmp slt i32 %45, 1
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = load i32, i32* %9
%49 = icmp sgt i32 %48, 128
br i1 %49, label %50, label %52
50: ; preds = %47, %44
%51 = call i32 (i32, i64, i8*, ...) @error(i32 1, i64 0, i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str.2, i64 0, i64 0))
br label %52
52: ; preds = %50, %47
br label %53
53: ; preds = %52, %20
%54 = load i32, i32* %4
%55 = icmp sgt i32 %54, 3
br i1 %55, label %56, label %80
56: ; preds = %53
store i64 0, i64* @errno
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 3
%59 = load i8*, i8** %58
store i8* %59, i8** %11
%60 = load i8*, i8** %11
%61 = call i8* @strtol(i8* %60, i8** %12, i32 8)
%62 = ptrtoint i8* %61 to i32
store i32 %62, i32* %7
%63 = load i64, i64* @errno
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %56
%66 = load i64, i64* @errno
%67 = call i32 (i32, i64, i8*, ...) @error(i32 1, i64 %66, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.3, i64 0, i64 0))
br label %68
68: ; preds = %65, %56
%69 = load i8*, i8** %12
%70 = load i8*, i8** %11
%71 = icmp eq i8* %69, %70
br i1 %71, label %77, label %72
72: ; preds = %68
%73 = load i32, i32* @S_IFMT
%74 = load i32, i32* %7
%75 = and i32 %73, %74
%76 = icmp ne i32 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %72, %68
%78 = call i32 (i32, i64, i8*, ...) @error(i32 1, i64 0, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.3, i64 0, i64 0))
br label %79
79: ; preds = %77, %72
br label %80
80: ; preds = %79, %53
%81 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %struct.stat* %8)
store i32 %81, i32* %6
%82 = load i32, i32* %6
%83 = icmp eq i32 %82, -1
br i1 %83, label %84, label %87
84: ; preds = %80
%85 = load i64, i64* @errno
%86 = call i32 (i32, i64, i8*, ...) @error(i32 1, i64 %85, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %87
87: ; preds = %84, %80
%88 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 1
%89 = load i32, i32* %88
%90 = call i32 @S_ISCHR(i32 %89)
%91 = icmp ne i32 %90, 0
br i1 %91, label %94, label %92
92: ; preds = %87
%93 = call i32 (i32, i64, i8*, ...) @error(i32 1, i64 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
br label %94
94: ; preds = %92, %87
%95 = load i8*, i8** %10
%96 = load i32, i32* %7
%97 = load i32, i32* @S_IFCHR
%98 = or i32 %96, %97
%99 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%100 = load i32, i32* %99
%101 = call i32 @major(i32 %100)
%102 = load i32, i32* %9
%103 = call i32 @makedev(i32 %101, i32 %102)
%104 = call i32 @mknod(i8* %95, i32 %98, i32 %103)
store i32 %104, i32* %6
%105 = load i32, i32* %6
%106 = icmp eq i32 %105, -1
br i1 %106, label %107, label %111
107: ; preds = %94
%108 = load i64, i64* @errno
%109 = load i8*, i8** %10
%110 = call i32 (i32, i64, i8*, ...) @error(i32 1, i64 %108, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %109)
br label %111
111: ; preds = %107, %94
%112 = load i8*, i8** %10
%113 = load i32, i32* %9
%114 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0), i8* %112, i32 %113)
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32, i32 }
@.str = [55 x i8] c"usage: mkemlog <logdevname> [size_in_kilobytes] [mode]\00"
@errno = global i64 0
@.str.1 = [77 x i8] c"Invalid size provided\0Ausage: mkemlog <logdevname> [size_in_kilobytes] [mode]\00"
@.str.2 = [111 x i8] c"Invalid size provided must be a value between 1 and 128\0Ausage: mkemlog <logdevname> [size_in_kilobytes] [mode]\00"
@.str.3 = [77 x i8] c"Invalid mode provided\0Ausage: mkemlog <logdevname> [size_in_kilobytes] [mode]\00"
@S_IFMT = global i32 0
@.str.4 = [11 x i8] c"/dev/emlog\00"
@.str.5 = [17 x i8] c"stat: /dev/emlog\00"
@.str.6 = [40 x i8] c"/dev/emlog is not a valid emlog device\0A\00"
@S_IFCHR = global i32 0
@.str.7 = [10 x i8] c"mknod: %s\00"
@.str.8 = [50 x i8] c"Log device %s created with buffer size of %d KiB\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.stat
%4 = alloca i8*
%5 = bitcast %struct.stat* %3 to i8*
%6 = bitcast i8** %4 to i8*
%7 = add i32 %0, -5
%8 = icmp ult i32 %7, -3
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (i32, i64, i8*, ...) @error(i32 1, i64 0, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %2, %9
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = icmp sgt i32 %0, 2
br i1 %14, label %15, label %56
15: ; preds = %11
store i64 0, i64* @errno
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = call i8* @strtol(i8* %17, i8** %4, i32 10)
%19 = ptrtoint i8* %18 to i64
%20 = trunc i64 %19 to i32
%21 = load i64, i64* @errno
%22 = icmp eq i64 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %15
%24 = tail call i32 (i32, i64, i8*, ...) @error(i32 1, i64 %21, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0))
br label %25
25: ; preds = %23, %15
%26 = load i8*, i8** %4
%27 = icmp eq i8* %26, %17
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 (i32, i64, i8*, ...) @error(i32 1, i64 0, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28, %25
%31 = add i32 %20, -129
%32 = icmp ult i32 %31, -128
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = tail call i32 (i32, i64, i8*, ...) @error(i32 1, i64 0, i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %33, %30
%36 = icmp ugt i32 %0, 3
br i1 %36, label %37, label %56
37: ; preds = %35
store i64 0, i64* @errno
%38 = getelementptr inbounds i8*, i8** %1, i64 3
%39 = load i8*, i8** %38
%40 = call i8* @strtol(i8* %39, i8** %4, i32 8)
%41 = ptrtoint i8* %40 to i64
%42 = trunc i64 %41 to i32
%43 = load i64, i64* @errno
%44 = icmp eq i64 %43, 0
br i1 %44, label %47, label %45
45: ; preds = %37
%46 = tail call i32 (i32, i64, i8*, ...) @error(i32 1, i64 %43, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.3, i64 0, i64 0))
br label %47
47: ; preds = %45, %37
%48 = load i8*, i8** %4
%49 = icmp eq i8* %48, %39
br i1 %49, label %54, label %50
50: ; preds = %47
%51 = load i32, i32* @S_IFMT
%52 = and i32 %51, %42
%53 = icmp eq i32 %52, 0
br i1 %53, label %56, label %54
54: ; preds = %50, %47
%55 = tail call i32 (i32, i64, i8*, ...) @error(i32 1, i64 0, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.3, i64 0, i64 0))
br label %56
56: ; preds = %11, %50, %54, %35
%57 = phi i32 [ %20, %54 ], [ %20, %50 ], [ %20, %35 ], [ 8, %11 ]
%58 = phi i32 [ %42, %54 ], [ %42, %50 ], [ 432, %35 ], [ 432, %11 ]
%59 = call i32 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %struct.stat* %3)
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %64
61: ; preds = %56
%62 = load i64, i64* @errno
%63 = tail call i32 (i32, i64, i8*, ...) @error(i32 1, i64 %62, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
br label %64
64: ; preds = %61, %56
%65 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%66 = load i32, i32* %65
%67 = tail call i32 @S_ISCHR(i32 %66)
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %71
69: ; preds = %64
%70 = tail call i32 (i32, i64, i8*, ...) @error(i32 1, i64 0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
br label %71
71: ; preds = %69, %64
%72 = load i32, i32* @S_IFCHR
%73 = or i32 %72, %58
%74 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%75 = load i32, i32* %74
%76 = tail call i32 @major(i32 %75)
%77 = tail call i32 @makedev(i32 %76, i32 %57)
%78 = tail call i32 @mknod(i8* %13, i32 %73, i32 %77)
%79 = icmp eq i32 %78, -1
br i1 %79, label %80, label %83
80: ; preds = %71
%81 = load i64, i64* @errno
%82 = tail call i32 (i32, i64, i8*, ...) @error(i32 1, i64 %81, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %13)
br label %83
83: ; preds = %80, %71
%84 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0), i8* %13, i32 %57)
ret i32 0
}