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

/* Variables and functions */
scalar_t__ S_ISBLK(int /*<<< orphan*/);
scalar_t__ __makedev(int, int);
char *alloca(int);
scalar_t__ isdigit(char);
scalar_t__ makedev(int, int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
int /*<<< orphan*/ stat(char const *, struct stat *);
char *strchr(char const *, char);
int /*<<< orphan*/ strcmp(char const *, char *);
int strlen(char const *);
scalar_t__ strncmp(char const *, char *, int);
int strtoul(char const *, char **, int);
scalar_t__ try_name(char *, int);
dev_t name_to_dev_t_real(const char *name) {
  char *p;
  dev_t res = 0;
  char *s;
  int part;
  struct stat st;
  int len;
  const char *devname;
  char *cptr, *e1, *e2;
  int major_num, minor_num;
  if (strchr(name, ','))
    return __makedev(0, 253);
  if (name[0] == '/') {
    devname = name;
  } else {
    char *dname = alloca(strlen(name) + 6);
    sprintf(dname, "/dev/%s", name);
    devname = dname;
  }
  if (!stat(devname, &st) && S_ISBLK(st.st_mode))
    return st.st_rdev;
  if (strncmp(name, "/dev/", 5)) {
    cptr = strchr(devname + 5, ':');
    if (cptr && cptr[1] != '\0') {
      *cptr = '\0';
      major_num = strtoul(devname + 5, &e1, 10);
      minor_num = strtoul(cptr + 1, &e2, 10);
      if (!*e1 && !*e2)
        return makedev(major_num, minor_num);
      *cptr = ':';
    } else {
      res = (dev_t)strtoul(name, &p, 16);
      if (!*p)
        return res;
    }
  } else {
    name += 5;
  }
  if (!strcmp(name, "nfs"))
    return __makedev(0, 255);
  if (!strcmp(name, "ram"))
    return __makedev(1, 0);
  if (!strncmp(name, "mtd", 3))
    return __makedev(0, 254);
  len = strlen(name);
  s = alloca(len + 1);
  memcpy(s, name, len + 1);
  for (p = s; *p; p++)
    if (*p == '/')
      *p = '!';
  res = try_name(s, 0);
  if (res)
    return res;
  while (p > s && isdigit(p[-1]))
    p--;
  if (p == s || !*p || *p == '0')
    goto fail;
  part = strtoul(p, NULL, 10);
  *p = '\0';
  res = try_name(s, part);
  if (res)
    return res;
  if (p < s + 2 || !isdigit(p[-2]) || p[-1] != 'p')
    goto fail;
  p[-1] = '\0';
  res = try_name(s, part);
  return res;
fail:
  return (dev_t)0;
}


x86 assembly (clang, -O0):
<name_to_dev_t_real>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2c,%esi
call   1060 <strchr@plt>
cmp    $0x0,%rax
je     1224 <name_to_dev_t_real+0x44>
xor    %edi,%edi
mov    $0xfd,%esi
call   1100 <__makedev@plt>
mov    %rax,-0x8(%rbp)
jmp    160f <name_to_dev_t_real+0x42f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1241 <name_to_dev_t_real+0x61>
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
jmp    1274 <name_to_dev_t_real+0x94>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
add    $0x6,%edi
call   1080 <alloca@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xd99(%rip),%rsi
call   10f0 <sprintf@plt>
mov    -0x78(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1090 <stat@plt>
cmp    $0x0,%eax
jne    12a9 <name_to_dev_t_real+0xc9>
mov    -0x38(%rbp),%edi
call   10b0 <S_ISBLK@plt>
cmp    $0x0,%rax
je     12a9 <name_to_dev_t_real+0xc9>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    160f <name_to_dev_t_real+0x42f>
mov    -0x10(%rbp),%rdi
lea    0xd54(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     13a9 <name_to_dev_t_real+0x1c9>
mov    -0x50(%rbp),%rdi
add    $0x5,%rdi
mov    $0x3a,%esi
call   1060 <strchr@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     136d <name_to_dev_t_real+0x18d>
mov    -0x58(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     136d <name_to_dev_t_real+0x18d>
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x50(%rbp),%rdi
add    $0x5,%rdi
lea    -0x60(%rbp),%rsi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x58(%rbp),%rdi
add    $0x1,%rdi
lea    -0x68(%rbp),%rsi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %eax,-0x70(%rbp)
mov    -0x60(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1361 <name_to_dev_t_real+0x181>
mov    -0x68(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1361 <name_to_dev_t_real+0x181>
mov    -0x6c(%rbp),%edi
mov    -0x70(%rbp),%esi
call   10c0 <makedev@plt>
mov    %rax,-0x8(%rbp)
jmp    160f <name_to_dev_t_real+0x42f>
mov    -0x58(%rbp),%rax
movb   $0x3a,(%rax)
jmp    13a4 <name_to_dev_t_real+0x1c4>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x10,%edx
call   10d0 <strtoul@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
jne    139f <name_to_dev_t_real+0x1bf>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    160f <name_to_dev_t_real+0x42f>
jmp    13a4 <name_to_dev_t_real+0x1c4>
jmp    13b5 <name_to_dev_t_real+0x1d5>
mov    -0x10(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xc4e(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    13e3 <name_to_dev_t_real+0x203>
xor    %edi,%edi
mov    $0xff,%esi
call   1100 <__makedev@plt>
mov    %rax,-0x8(%rbp)
jmp    160f <name_to_dev_t_real+0x42f>
mov    -0x10(%rbp),%rdi
lea    0xc24(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1411 <name_to_dev_t_real+0x231>
mov    $0x1,%edi
xor    %esi,%esi
call   1100 <__makedev@plt>
mov    %rax,-0x8(%rbp)
jmp    160f <name_to_dev_t_real+0x42f>
mov    -0x10(%rbp),%rdi
lea    0xbfa(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1445 <name_to_dev_t_real+0x265>
xor    %edi,%edi
mov    $0xfe,%esi
call   1100 <__makedev@plt>
mov    %rax,-0x8(%rbp)
jmp    160f <name_to_dev_t_real+0x42f>
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%edi
add    $0x1,%edi
call   1080 <alloca@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x44(%rbp),%edx
add    $0x1,%edx
call   10a0 <memcpy@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     14b5 <name_to_dev_t_real+0x2d5>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    149f <name_to_dev_t_real+0x2bf>
mov    -0x18(%rbp),%rax
movb   $0x21,(%rax)
jmp    14a4 <name_to_dev_t_real+0x2c4>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    147b <name_to_dev_t_real+0x29b>
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   10e0 <try_name@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     14dc <name_to_dev_t_real+0x2fc>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    160f <name_to_dev_t_real+0x42f>
jmp    14e1 <name_to_dev_t_real+0x301>
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x28(%rbp),%rcx
mov    %al,-0x79(%rbp)
jbe    150b <name_to_dev_t_real+0x32b>
mov    -0x18(%rbp),%rax
movsbl -0x1(%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
test   $0x1,%al
jne    151b <name_to_dev_t_real+0x33b>
jmp    152c <name_to_dev_t_real+0x34c>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    14e1 <name_to_dev_t_real+0x301>
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     1557 <name_to_dev_t_real+0x377>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1557 <name_to_dev_t_real+0x377>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    155c <name_to_dev_t_real+0x37c>
jmp    1607 <name_to_dev_t_real+0x427>
mov    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   10e0 <try_name@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     15a0 <name_to_dev_t_real+0x3c0>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    160f <name_to_dev_t_real+0x42f>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
add    $0x2,%rcx
cmp    %rcx,%rax
jb     15dd <name_to_dev_t_real+0x3fd>
mov    -0x18(%rbp),%rax
movsbl -0x2(%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     15dd <name_to_dev_t_real+0x3fd>
mov    -0x18(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x70,%eax
je     15e2 <name_to_dev_t_real+0x402>
jmp    1607 <name_to_dev_t_real+0x427>
mov    -0x18(%rbp),%rax
movb   $0x0,-0x1(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   10e0 <try_name@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    160f <name_to_dev_t_real+0x42f>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<name_to_dev_t_real>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rdi,%r14
mov    $0x2c,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     1212 <name_to_dev_t_real+0x32>
xor    %edi,%edi
mov    $0xfd,%esi
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1100 <__makedev@plt>
cmpb   $0x2f,(%r14)
mov    %r14,%rbx
je     1240 <name_to_dev_t_real+0x60>
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x6(%rax),%edi
call   1080 <alloca@plt>
mov    %rax,%rbx
lea    0xdcb(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   10f0 <sprintf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1090 <stat@plt>
test   %eax,%eax
je     12e0 <name_to_dev_t_real+0x100>
lea    0xdac(%rip),%rsi
mov    %r14,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     131c <name_to_dev_t_real+0x13c>
add    $0x5,%rbx
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     12fc <name_to_dev_t_real+0x11c>
mov    %rax,%r15
cmpb   $0x0,0x1(%rax)
je     12fc <name_to_dev_t_real+0x11c>
mov    %r15,%rbp
add    $0x1,%rbp
movb   $0x0,(%r15)
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rsi
mov    %rbp,%rdi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    0x10(%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    12da <name_to_dev_t_real+0xfa>
mov    0x8(%rsp),%rcx
cmpb   $0x0,(%rcx)
je     1432 <name_to_dev_t_real+0x252>
movb   $0x3a,(%r15)
jmp    1320 <name_to_dev_t_real+0x140>
mov    0x20(%rsp),%edi
call   10b0 <S_ISBLK@plt>
test   %rax,%rax
je     1255 <name_to_dev_t_real+0x75>
mov    0x18(%rsp),%rax
jmp    1490 <name_to_dev_t_real+0x2b0>
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x10,%edx
call   10d0 <strtoul@plt>
mov    (%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    1320 <name_to_dev_t_real+0x140>
cltq
jmp    1490 <name_to_dev_t_real+0x2b0>
add    $0x5,%r14
lea    0xce7(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     140e <name_to_dev_t_real+0x22e>
lea    0xcd4(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     141a <name_to_dev_t_real+0x23a>
lea    0xcc1(%rip),%rsi
mov    %r14,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1426 <name_to_dev_t_real+0x246>
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
call   1080 <alloca@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   10a0 <memcpy@plt>
xor    %ebp,%ebp
jmp    13a8 <name_to_dev_t_real+0x1c8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movb   $0x21,(%rbx,%rbp,1)
add    $0x1,%rbp
movzbl (%rbx,%rbp,1),%eax
cmp    $0x2f,%al
je     13a0 <name_to_dev_t_real+0x1c0>
test   %al,%al
jne    13a4 <name_to_dev_t_real+0x1c4>
mov    %rbx,%rdi
xor    %esi,%esi
call   10e0 <try_name@plt>
test   %rax,%rax
jne    1490 <name_to_dev_t_real+0x2b0>
test   %rbp,%rbp
je     1445 <name_to_dev_t_real+0x265>
lea    0x1(%rbp),%r14
neg    %rbp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl -0x2(%rbx,%r14,1),%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     1450 <name_to_dev_t_real+0x270>
add    $0x1,%rbp
add    $0xffffffffffffffff,%r14
cmp    $0x2,%r14
jge    13e0 <name_to_dev_t_real+0x200>
test   %rbp,%rbp
je     144c <name_to_dev_t_real+0x26c>
mov    %rbx,%r14
sub    %rbp,%r14
neg    %rbp
jmp    145d <name_to_dev_t_real+0x27d>
xor    %edi,%edi
mov    $0xff,%esi
jmp    1203 <name_to_dev_t_real+0x23>
mov    $0x1,%edi
xor    %esi,%esi
jmp    1203 <name_to_dev_t_real+0x23>
xor    %edi,%edi
mov    $0xfe,%esi
jmp    1203 <name_to_dev_t_real+0x23>
mov    %ebx,%edi
mov    %eax,%esi
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    10c0 <makedev@plt>
add    %rbp,%rbx
mov    %rbx,(%rsp)
xor    %eax,%eax
jmp    1490 <name_to_dev_t_real+0x2b0>
mov    %rbx,%r14
sub    %rbp,%r14
neg    %rbp
mov    %r14,(%rsp)
mov    (%r14),%cl
xor    %eax,%eax
test   %cl,%cl
je     1490 <name_to_dev_t_real+0x2b0>
cmp    $0x30,%cl
je     1490 <name_to_dev_t_real+0x2b0>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   10d0 <strtoul@plt>
mov    %eax,%r15d
movb   $0x0,(%r14)
mov    %rbx,%rdi
mov    %eax,%esi
call   10e0 <try_name@plt>
test   %rax,%rax
je     149b <name_to_dev_t_real+0x2bb>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x2,%rbp
jl     144c <name_to_dev_t_real+0x26c>
movsbl -0x2(%r14),%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     144c <name_to_dev_t_real+0x26c>
cmpb   $0x70,-0x1(%r14)
jne    144c <name_to_dev_t_real+0x26c>
movb   $0x0,-0x1(%r14)
mov    %rbx,%rdi
mov    %r15d,%esi
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    10e0 <try_name@plt>

LLVM IR (-O0):
%struct.stat = type { i64, i32 }
@.str = [8 x i8] c"/dev/%s\00"
@.str.1 = [6 x i8] c"/dev/\00"
@.str.2 = [4 x i8] c"nfs\00"
@.str.3 = [4 x i8] c"ram\00"
@.str.4 = [4 x i8] c"mtd\00"
define i64 @name_to_dev_t_real(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.stat
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8*
store i8* %0, i8** %3
store i64 0, i64* %5
%17 = load i8*, i8** %3
%18 = call i8* @strchr(i8* %17, i8 signext 44)
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %22
20: ; preds = %1
%21 = call i64 @__makedev(i32 0, i32 253)
store i64 %21, i64* %2
br label %221
22: ; preds = %1
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 47
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = load i8*, i8** %3
store i8* %29, i8** %10
br label %39
30: ; preds = %22
%31 = load i8*, i8** %3
%32 = call i32 @strlen(i8* %31)
%33 = add nsw i32 %32, 6
%34 = call i8* @alloca(i32 %33)
store i8* %34, i8** %16
%35 = load i8*, i8** %16
%36 = load i8*, i8** %3
%37 = call i32 @sprintf(i8* %35, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %36)
%38 = load i8*, i8** %16
store i8* %38, i8** %10
br label %39
39: ; preds = %30, %28
%40 = load i8*, i8** %10
%41 = call i32 @stat(i8* %40, %struct.stat* %8)
%42 = icmp ne i32 %41, 0
br i1 %42, label %51, label %43
43: ; preds = %39
%44 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 1
%45 = load i32, i32* %44
%46 = call i64 @S_ISBLK(i32 %45)
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %43
%49 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%50 = load i64, i64* %49
store i64 %50, i64* %2
br label %221
51: ; preds = %43, %39
%52 = load i8*, i8** %3
%53 = call i64 @strncmp(i8* %52, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %99
55: ; preds = %51
%56 = load i8*, i8** %10
%57 = getelementptr inbounds i8, i8* %56, i64 5
%58 = call i8* @strchr(i8* %57, i8 signext 58)
store i8* %58, i8** %11
%59 = load i8*, i8** %11
%60 = icmp ne i8* %59, null
br i1 %60, label %61, label %88
61: ; preds = %55
%62 = load i8*, i8** %11
%63 = getelementptr inbounds i8, i8* %62, i64 1
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %88
67: ; preds = %61
%68 = load i8*, i8** %11
store i8 0, i8* %68
%69 = load i8*, i8** %10
%70 = getelementptr inbounds i8, i8* %69, i64 5
%71 = call i32 @strtoul(i8* %70, i8** %12, i32 10)
store i32 %71, i32* %14
%72 = load i8*, i8** %11
%73 = getelementptr inbounds i8, i8* %72, i64 1
%74 = call i32 @strtoul(i8* %73, i8** %13, i32 10)
store i32 %74, i32* %15
%75 = load i8*, i8** %12
%76 = load i8, i8* %75
%77 = icmp ne i8 %76, 0
br i1 %77, label %86, label %78
78: ; preds = %67
%79 = load i8*, i8** %13
%80 = load i8, i8* %79
%81 = icmp ne i8 %80, 0
br i1 %81, label %86, label %82
82: ; preds = %78
%83 = load i32, i32* %14
%84 = load i32, i32* %15
%85 = call i64 @makedev(i32 %83, i32 %84)
store i64 %85, i64* %2
br label %221
86: ; preds = %78, %67
%87 = load i8*, i8** %11
store i8 58, i8* %87
br label %98
88: ; preds = %61, %55
%89 = load i8*, i8** %3
%90 = call i32 @strtoul(i8* %89, i8** %4, i32 16)
%91 = sext i32 %90 to i64
store i64 %91, i64* %5
%92 = load i8*, i8** %4
%93 = load i8, i8* %92
%94 = icmp ne i8 %93, 0
br i1 %94, label %97, label %95
95: ; preds = %88
%96 = load i64, i64* %5
store i64 %96, i64* %2
br label %221
97: ; preds = %88
br label %98
98: ; preds = %97, %86
br label %102
99: ; preds = %51
%100 = load i8*, i8** %3
%101 = getelementptr inbounds i8, i8* %100, i64 5
store i8* %101, i8** %3
br label %102
102: ; preds = %99, %98
%103 = load i8*, i8** %3
%104 = call i32 @strcmp(i8* %103, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%105 = icmp ne i32 %104, 0
br i1 %105, label %108, label %106
106: ; preds = %102
%107 = call i64 @__makedev(i32 0, i32 255)
store i64 %107, i64* %2
br label %221
108: ; preds = %102
%109 = load i8*, i8** %3
%110 = call i32 @strcmp(i8* %109, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%111 = icmp ne i32 %110, 0
br i1 %111, label %114, label %112
112: ; preds = %108
%113 = call i64 @__makedev(i32 1, i32 0)
store i64 %113, i64* %2
br label %221
114: ; preds = %108
%115 = load i8*, i8** %3
%116 = call i64 @strncmp(i8* %115, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%117 = icmp ne i64 %116, 0
br i1 %117, label %120, label %118
118: ; preds = %114
%119 = call i64 @__makedev(i32 0, i32 254)
store i64 %119, i64* %2
br label %221
120: ; preds = %114
%121 = load i8*, i8** %3
%122 = call i32 @strlen(i8* %121)
store i32 %122, i32* %9
%123 = load i32, i32* %9
%124 = add nsw i32 %123, 1
%125 = call i8* @alloca(i32 %124)
store i8* %125, i8** %6
%126 = load i8*, i8** %6
%127 = load i8*, i8** %3
%128 = load i32, i32* %9
%129 = add nsw i32 %128, 1
%130 = call i32 @memcpy(i8* %126, i8* %127, i32 %129)
%131 = load i8*, i8** %6
store i8* %131, i8** %4
br label %132
132: ; preds = %144, %120
%133 = load i8*, i8** %4
%134 = load i8, i8* %133
%135 = icmp ne i8 %134, 0
br i1 %135, label %136, label %147
136: ; preds = %132
%137 = load i8*, i8** %4
%138 = load i8, i8* %137
%139 = sext i8 %138 to i32
%140 = icmp eq i32 %139, 47
br i1 %140, label %141, label %143
141: ; preds = %136
%142 = load i8*, i8** %4
store i8 33, i8* %142
br label %143
143: ; preds = %141, %136
br label %144
144: ; preds = %143
%145 = load i8*, i8** %4
%146 = getelementptr inbounds i8, i8* %145, i32 1
store i8* %146, i8** %4
br label %132
147: ; preds = %132
%148 = load i8*, i8** %6
%149 = call i64 @try_name(i8* %148, i32 0)
store i64 %149, i64* %5
%150 = load i64, i64* %5
%151 = icmp ne i64 %150, 0
br i1 %151, label %152, label %154
152: ; preds = %147
%153 = load i64, i64* %5
store i64 %153, i64* %2
br label %221
154: ; preds = %147
br label %155
155: ; preds = %167, %154
%156 = load i8*, i8** %4
%157 = load i8*, i8** %6
%158 = icmp ugt i8* %156, %157
br i1 %158, label %159, label %165
159: ; preds = %155
%160 = load i8*, i8** %4
%161 = getelementptr inbounds i8, i8* %160, i64 -1
%162 = load i8, i8* %161
%163 = call i64 @isdigit(i8 signext %162)
%164 = icmp ne i64 %163, 0
br label %165
165: ; preds = %159, %155
%166 = phi i1 [ false, %155 ], [ %164, %159 ]
br i1 %166, label %167, label %170
167: ; preds = %165
%168 = load i8*, i8** %4
%169 = getelementptr inbounds i8, i8* %168, i32 -1
store i8* %169, i8** %4
br label %155
170: ; preds = %165
%171 = load i8*, i8** %4
%172 = load i8*, i8** %6
%173 = icmp eq i8* %171, %172
br i1 %173, label %183, label %174
174: ; preds = %170
%175 = load i8*, i8** %4
%176 = load i8, i8* %175
%177 = icmp ne i8 %176, 0
br i1 %177, label %178, label %183
178: ; preds = %174
%179 = load i8*, i8** %4
%180 = load i8, i8* %179
%181 = sext i8 %180 to i32
%182 = icmp eq i32 %181, 48
br i1 %182, label %183, label %184
183: ; preds = %178, %174, %170
br label %220
184: ; preds = %178
%185 = load i8*, i8** %4
%186 = call i32 @strtoul(i8* %185, i8** null, i32 10)
store i32 %186, i32* %7
%187 = load i8*, i8** %4
store i8 0, i8* %187
%188 = load i8*, i8** %6
%189 = load i32, i32* %7
%190 = call i64 @try_name(i8* %188, i32 %189)
store i64 %190, i64* %5
%191 = load i64, i64* %5
%192 = icmp ne i64 %191, 0
br i1 %192, label %193, label %195
193: ; preds = %184
%194 = load i64, i64* %5
store i64 %194, i64* %2
br label %221
195: ; preds = %184
%196 = load i8*, i8** %4
%197 = load i8*, i8** %6
%198 = getelementptr inbounds i8, i8* %197, i64 2
%199 = icmp ult i8* %196, %198
br i1 %199, label %212, label %200
200: ; preds = %195
%201 = load i8*, i8** %4
%202 = getelementptr inbounds i8, i8* %201, i64 -2
%203 = load i8, i8* %202
%204 = call i64 @isdigit(i8 signext %203)
%205 = icmp ne i64 %204, 0
br i1 %205, label %206, label %212
206: ; preds = %200
%207 = load i8*, i8** %4
%208 = getelementptr inbounds i8, i8* %207, i64 -1
%209 = load i8, i8* %208
%210 = sext i8 %209 to i32
%211 = icmp ne i32 %210, 112
br i1 %211, label %212, label %213
212: ; preds = %206, %200, %195
br label %220
213: ; preds = %206
%214 = load i8*, i8** %4
%215 = getelementptr inbounds i8, i8* %214, i64 -1
store i8 0, i8* %215
%216 = load i8*, i8** %6
%217 = load i32, i32* %7
%218 = call i64 @try_name(i8* %216, i32 %217)
store i64 %218, i64* %5
%219 = load i64, i64* %5
store i64 %219, i64* %2
br label %221
220: ; preds = %212, %183
store i64 0, i64* %2
br label %221
221: ; preds = %220, %213, %193, %152, %118, %112, %106, %95, %82, %48, %20
%222 = load i64, i64* %2
ret i64 %222
}

LLVM IR (-O2):
%struct.stat = type { i64, i32 }
@.str = [8 x i8] c"/dev/%s\00"
@.str.1 = [6 x i8] c"/dev/\00"
@.str.2 = [4 x i8] c"nfs\00"
@.str.3 = [4 x i8] c"ram\00"
@.str.4 = [4 x i8] c"mtd\00"
define i64 @name_to_dev_t_real(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
%4 = alloca i8*
%5 = alloca i8*
%6 = bitcast i8** %2 to i8*
%7 = bitcast %struct.stat* %3 to i8*
%8 = bitcast i8** %4 to i8*
%9 = bitcast i8** %5 to i8*
%10 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 44)
%11 = icmp eq i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %1
%13 = tail call i64 @__makedev(i32 0, i32 253)
br label %137
14: ; preds = %1
%15 = load i8, i8* %0
%16 = icmp eq i8 %15, 47
br i1 %16, label %22, label %17
17: ; preds = %14
%18 = tail call i32 @strlen(i8* %0)
%19 = add nsw i32 %18, 6
%20 = tail call i8* @alloca(i32 %19)
%21 = tail call i32 @sprintf(i8* dereferenceable(1) %20, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %22
22: ; preds = %14, %17
%23 = phi i8* [ %20, %17 ], [ %0, %14 ]
%24 = call i32 @stat(i8* %23, %struct.stat* %3)
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 1
%28 = load i32, i32* %27
%29 = tail call i64 @S_ISBLK(i32 %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %26
%32 = getelementptr inbounds %struct.stat, %struct.stat* %3, i64 0, i32 0
%33 = load i64, i64* %32
br label %137
34: ; preds = %26, %22
%35 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%36 = icmp eq i64 %35, 0
br i1 %36, label %65, label %37
37: ; preds = %34
%38 = getelementptr inbounds i8, i8* %23, i64 5
%39 = tail call i8* @strchr(i8* %38, i8 signext 58)
%40 = icmp eq i8* %39, null
br i1 %40, label %58, label %41
41: ; preds = %37
%42 = getelementptr inbounds i8, i8* %39, i64 1
%43 = load i8, i8* %42
%44 = icmp eq i8 %43, 0
br i1 %44, label %58, label %45
45: ; preds = %41
store i8 0, i8* %39
%46 = call i32 @strtoul(i8* %38, i8** %4, i32 10)
%47 = call i32 @strtoul(i8* %42, i8** %5, i32 10)
%48 = load i8*, i8** %4
%49 = load i8, i8* %48
%50 = icmp eq i8 %49, 0
br i1 %50, label %51, label %57
51: ; preds = %45
%52 = load i8*, i8** %5
%53 = load i8, i8* %52
%54 = icmp eq i8 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = tail call i64 @makedev(i32 %46, i32 %47)
br label %137
57: ; preds = %51, %45
store i8 58, i8* %39
br label %67
58: ; preds = %41, %37
%59 = call i32 @strtoul(i8* %0, i8** %2, i32 16)
%60 = load i8*, i8** %2
%61 = load i8, i8* %60
%62 = icmp eq i8 %61, 0
br i1 %62, label %63, label %67
63: ; preds = %58
%64 = sext i32 %59 to i64
br label %137
65: ; preds = %34
%66 = getelementptr inbounds i8, i8* %0, i64 5
br label %67
67: ; preds = %57, %58, %65
%68 = phi i8* [ %0, %57 ], [ %0, %58 ], [ %66, %65 ]
%69 = tail call i32 @strcmp(i8* %68, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%70 = icmp eq i32 %69, 0
br i1 %70, label %71, label %73
71: ; preds = %67
%72 = tail call i64 @__makedev(i32 0, i32 255)
br label %137
73: ; preds = %67
%74 = tail call i32 @strcmp(i8* %68, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %73
%77 = tail call i64 @__makedev(i32 1, i32 0)
br label %137
78: ; preds = %73
%79 = tail call i64 @strncmp(i8* %68, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %78
%82 = tail call i64 @__makedev(i32 0, i32 254)
br label %137
83: ; preds = %78
%84 = tail call i32 @strlen(i8* %68)
%85 = add nsw i32 %84, 1
%86 = tail call i8* @alloca(i32 %85)
%87 = tail call i32 @memcpy(i8* %86, i8* %68, i32 %85)
br label %88
88: ; preds = %93, %83
%89 = phi i64 [ 0, %83 ], [ %94, %93 ]
%90 = getelementptr inbounds i8, i8* %86, i64 %89
%91 = load i8, i8* %90
switch i8 %91, label %93 [
i8 0, label %95
i8 47, label %92
]
92: ; preds = %88
store i8 33, i8* %90
br label %93
93: ; preds = %88, %92
%94 = add nuw nsw i64 %89, 1
br label %88
95: ; preds = %88
%96 = tail call i64 @try_name(i8* %86, i32 0)
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %137
98: ; preds = %95
%99 = icmp eq i64 %89, 0
br i1 %99, label %100, label %104
100: ; preds = %98
%101 = getelementptr inbounds i8, i8* %86, i64 %89
store i8* %101, i8** %2
br label %137
102: ; preds = %104
%103 = icmp sgt i64 %105, 1
br i1 %103, label %104, label %113
104: ; preds = %98, %102
%105 = phi i64 [ %106, %102 ], [ %89, %98 ]
%106 = add nsw i64 %105, -1
%107 = getelementptr inbounds i8, i8* %86, i64 %106
%108 = load i8, i8* %107
%109 = tail call i64 @isdigit(i8 signext %108)
%110 = icmp eq i64 %109, 0
br i1 %110, label %111, label %102
111: ; preds = %104
%112 = getelementptr inbounds i8, i8* %86, i64 %105
store i8* %112, i8** %2
br label %116
113: ; preds = %102
%114 = getelementptr inbounds i8, i8* %86, i64 %106
%115 = icmp eq i64 %106, 0
br i1 %115, label %137, label %116
116: ; preds = %111, %113
%117 = phi i8* [ %112, %111 ], [ %114, %113 ]
%118 = phi i64 [ %105, %111 ], [ %106, %113 ]
%119 = load i8, i8* %117
switch i8 %119, label %120 [
i8 0, label %137
i8 48, label %137
]
120: ; preds = %116
%121 = tail call i32 @strtoul(i8* nocapture %117, i8** null, i32 10)
store i8 0, i8* %117
%122 = tail call i64 @try_name(i8* %86, i32 %121)
%123 = icmp eq i64 %122, 0
br i1 %123, label %124, label %137
124: ; preds = %120
%125 = icmp slt i64 %118, 2
br i1 %125, label %137, label %126
126: ; preds = %124
%127 = getelementptr inbounds i8, i8* %117, i64 -2
%128 = load i8, i8* %127
%129 = tail call i64 @isdigit(i8 signext %128)
%130 = icmp eq i64 %129, 0
br i1 %130, label %137, label %131
131: ; preds = %126
%132 = getelementptr inbounds i8, i8* %117, i64 -1
%133 = load i8, i8* %132
%134 = icmp eq i8 %133, 112
br i1 %134, label %135, label %137
135: ; preds = %131
store i8 0, i8* %132
%136 = tail call i64 @try_name(i8* %86, i32 %121)
br label %137
137: ; preds = %100, %113, %131, %126, %124, %116, %116, %120, %95, %135, %81, %76, %71, %63, %55, %31, %12
%138 = phi i64 [ %13, %12 ], [ %136, %135 ], [ %82, %81 ], [ %77, %76 ], [ %72, %71 ], [ %56, %55 ], [ %64, %63 ], [ %33, %31 ], [ %96, %95 ], [ %122, %120 ], [ 0, %116 ], [ 0, %116 ], [ 0, %124 ], [ 0, %126 ], [ 0, %131 ], [ 0, %113 ], [ 0, %100 ]
ret i64 %138
}