#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, minor;
  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)) {
    if ((cptr = strchr(devname + 5, ':')) && cptr[1] != '\0') {
      *cptr = '\0';
      major = strtoul(devname + 5, &e1, 10);
      minor = strtoul(cptr + 1, &e2, 10);
      if (!*e1 && !*e2)
        return makedev(major, minor);
      *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),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1214 <name_to_dev_t_real+0x34>
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
jmp    1247 <name_to_dev_t_real+0x67>
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    0xdc6(%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    127c <name_to_dev_t_real+0x9c>
mov    -0x38(%rbp),%edi
call   10b0 <S_ISBLK@plt>
cmp    $0x0,%rax
je     127c <name_to_dev_t_real+0x9c>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    15e1 <name_to_dev_t_real+0x401>
mov    -0x10(%rbp),%rdi
lea    0xd81(%rip),%rsi
mov    $0x5,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     137b <name_to_dev_t_real+0x19b>
mov    -0x50(%rbp),%rdi
add    $0x5,%rdi
mov    $0x3a,%esi
call   1060 <strchr@plt>
mov    %rax,-0x58(%rbp)
cmp    $0x0,%rax
je     133f <name_to_dev_t_real+0x15f>
mov    -0x58(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     133f <name_to_dev_t_real+0x15f>
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    1333 <name_to_dev_t_real+0x153>
mov    -0x68(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1333 <name_to_dev_t_real+0x153>
mov    -0x6c(%rbp),%edi
mov    -0x70(%rbp),%esi
call   10c0 <makedev@plt>
mov    %rax,-0x8(%rbp)
jmp    15e1 <name_to_dev_t_real+0x401>
mov    -0x58(%rbp),%rax
movb   $0x3a,(%rax)
jmp    1376 <name_to_dev_t_real+0x196>
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    1371 <name_to_dev_t_real+0x191>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    15e1 <name_to_dev_t_real+0x401>
jmp    1376 <name_to_dev_t_real+0x196>
jmp    1387 <name_to_dev_t_real+0x1a7>
mov    -0x10(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xc7c(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    13b5 <name_to_dev_t_real+0x1d5>
xor    %edi,%edi
mov    $0xff,%esi
call   1100 <__makedev@plt>
mov    %rax,-0x8(%rbp)
jmp    15e1 <name_to_dev_t_real+0x401>
mov    -0x10(%rbp),%rdi
lea    0xc52(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    13e3 <name_to_dev_t_real+0x203>
mov    $0x1,%edi
xor    %esi,%esi
call   1100 <__makedev@plt>
mov    %rax,-0x8(%rbp)
jmp    15e1 <name_to_dev_t_real+0x401>
mov    -0x10(%rbp),%rdi
lea    0xc28(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1417 <name_to_dev_t_real+0x237>
xor    %edi,%edi
mov    $0xfe,%esi
call   1100 <__makedev@plt>
mov    %rax,-0x8(%rbp)
jmp    15e1 <name_to_dev_t_real+0x401>
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     1487 <name_to_dev_t_real+0x2a7>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1471 <name_to_dev_t_real+0x291>
mov    -0x18(%rbp),%rax
movb   $0x21,(%rax)
jmp    1476 <name_to_dev_t_real+0x296>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    144d <name_to_dev_t_real+0x26d>
mov    -0x28(%rbp),%rdi
xor    %esi,%esi
call   10e0 <try_name@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     14ae <name_to_dev_t_real+0x2ce>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    15e1 <name_to_dev_t_real+0x401>
jmp    14b3 <name_to_dev_t_real+0x2d3>
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmp    -0x28(%rbp),%rcx
mov    %al,-0x79(%rbp)
jbe    14dd <name_to_dev_t_real+0x2fd>
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    14ed <name_to_dev_t_real+0x30d>
jmp    14fe <name_to_dev_t_real+0x31e>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    14b3 <name_to_dev_t_real+0x2d3>
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     1529 <name_to_dev_t_real+0x349>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1529 <name_to_dev_t_real+0x349>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    152e <name_to_dev_t_real+0x34e>
jmp    15d9 <name_to_dev_t_real+0x3f9>
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     1572 <name_to_dev_t_real+0x392>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    15e1 <name_to_dev_t_real+0x401>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
add    $0x2,%rcx
cmp    %rcx,%rax
jb     15af <name_to_dev_t_real+0x3cf>
mov    -0x18(%rbp),%rax
movsbl -0x2(%rax),%edi
call   1040 <isdigit@plt>
cmp    $0x0,%rax
je     15af <name_to_dev_t_real+0x3cf>
mov    -0x18(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x70,%eax
je     15b4 <name_to_dev_t_real+0x3d4>
jmp    15d9 <name_to_dev_t_real+0x3f9>
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    15e1 <name_to_dev_t_real+0x401>
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
cmpb   $0x2f,(%rdi)
mov    %rdi,%rbx
je     121a <name_to_dev_t_real+0x3a>
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x6(%rax),%edi
call   1080 <alloca@plt>
mov    %rax,%rbx
lea    0xdf1(%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     12ba <name_to_dev_t_real+0xda>
lea    0xdd2(%rip),%rsi
mov    %r14,%rdi
mov    $0x5,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     12f6 <name_to_dev_t_real+0x116>
add    $0x5,%rbx
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1060 <strchr@plt>
test   %rax,%rax
je     12d6 <name_to_dev_t_real+0xf6>
mov    %rax,%r15
cmpb   $0x0,0x1(%rax)
je     12d6 <name_to_dev_t_real+0xf6>
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    12b4 <name_to_dev_t_real+0xd4>
mov    0x8(%rsp),%rcx
cmpb   $0x0,(%rcx)
je     1406 <name_to_dev_t_real+0x226>
movb   $0x3a,(%r15)
jmp    12fa <name_to_dev_t_real+0x11a>
mov    0x20(%rsp),%edi
call   10b0 <S_ISBLK@plt>
test   %rax,%rax
je     122f <name_to_dev_t_real+0x4f>
mov    0x18(%rsp),%rax
jmp    1464 <name_to_dev_t_real+0x284>
mov    %rsp,%rsi
mov    %r14,%rdi
mov    $0x10,%edx
call   10d0 <strtoul@plt>
mov    (%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    12fa <name_to_dev_t_real+0x11a>
cltq
jmp    1464 <name_to_dev_t_real+0x284>
add    $0x5,%r14
lea    0xd0d(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     13de <name_to_dev_t_real+0x1fe>
lea    0xcfa(%rip),%rsi
mov    %r14,%rdi
call   1070 <strcmp@plt>
test   %eax,%eax
je     13e7 <name_to_dev_t_real+0x207>
lea    0xce7(%rip),%rsi
mov    %r14,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     13f0 <name_to_dev_t_real+0x210>
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    1378 <name_to_dev_t_real+0x198>
nopl   0x0(%rax,%rax,1)
movb   $0x21,(%rbx,%rbp,1)
add    $0x1,%rbp
movzbl (%rbx,%rbp,1),%eax
cmp    $0x2f,%al
je     1370 <name_to_dev_t_real+0x190>
test   %al,%al
jne    1374 <name_to_dev_t_real+0x194>
mov    %rbx,%rdi
xor    %esi,%esi
call   10e0 <try_name@plt>
test   %rax,%rax
jne    1464 <name_to_dev_t_real+0x284>
test   %rbp,%rbp
je     1419 <name_to_dev_t_real+0x239>
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     1424 <name_to_dev_t_real+0x244>
add    $0x1,%rbp
add    $0xffffffffffffffff,%r14
cmp    $0x2,%r14
jge    13b0 <name_to_dev_t_real+0x1d0>
test   %rbp,%rbp
je     1420 <name_to_dev_t_real+0x240>
mov    %rbx,%r14
sub    %rbp,%r14
neg    %rbp
jmp    1431 <name_to_dev_t_real+0x251>
xor    %edi,%edi
mov    $0xff,%esi
jmp    13f7 <name_to_dev_t_real+0x217>
mov    $0x1,%edi
xor    %esi,%esi
jmp    13f7 <name_to_dev_t_real+0x217>
xor    %edi,%edi
mov    $0xfe,%esi
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1100 <__makedev@plt>
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    1464 <name_to_dev_t_real+0x284>
mov    %rbx,%r14
sub    %rbp,%r14
neg    %rbp
mov    %r14,(%rsp)
mov    (%r14),%cl
xor    %eax,%eax
test   %cl,%cl
je     1464 <name_to_dev_t_real+0x284>
cmp    $0x30,%cl
je     1464 <name_to_dev_t_real+0x284>
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     146f <name_to_dev_t_real+0x28f>
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x2,%rbp
jl     1420 <name_to_dev_t_real+0x240>
movsbl -0x2(%r14),%edi
call   1040 <isdigit@plt>
test   %rax,%rax
je     1420 <name_to_dev_t_real+0x240>
cmpb   $0x70,-0x1(%r14)
jne    1420 <name_to_dev_t_real+0x240>
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 = getelementptr inbounds i8, i8* %17, i64 0
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 47
br i1 %21, label %22, label %24
22: ; preds = %1
%23 = load i8*, i8** %3
store i8* %23, i8** %10
br label %33
24: ; preds = %1
%25 = load i8*, i8** %3
%26 = call i32 @strlen(i8* %25)
%27 = add nsw i32 %26, 6
%28 = call i8* @alloca(i32 %27)
store i8* %28, i8** %16
%29 = load i8*, i8** %16
%30 = load i8*, i8** %3
%31 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = load i8*, i8** %16
store i8* %32, i8** %10
br label %33
33: ; preds = %24, %22
%34 = load i8*, i8** %10
%35 = call i32 @stat(i8* %34, %struct.stat* %8)
%36 = icmp ne i32 %35, 0
br i1 %36, label %45, label %37
37: ; preds = %33
%38 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 1
%39 = load i32, i32* %38
%40 = call i64 @S_ISBLK(i32 %39)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 0
%44 = load i64, i64* %43
store i64 %44, i64* %2
br label %214
45: ; preds = %37, %33
%46 = load i8*, i8** %3
%47 = call i64 @strncmp(i8* %46, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 5)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %92
49: ; preds = %45
%50 = load i8*, i8** %10
%51 = getelementptr inbounds i8, i8* %50, i64 5
%52 = call i8* @strchr(i8* %51, i8 signext 58)
store i8* %52, i8** %11
%53 = icmp ne i8* %52, null
br i1 %53, label %54, label %81
54: ; preds = %49
%55 = load i8*, i8** %11
%56 = getelementptr inbounds i8, i8* %55, i64 1
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %81
60: ; preds = %54
%61 = load i8*, i8** %11
store i8 0, i8* %61
%62 = load i8*, i8** %10
%63 = getelementptr inbounds i8, i8* %62, i64 5
%64 = call i32 @strtoul(i8* %63, i8** %12, i32 10)
store i32 %64, i32* %14
%65 = load i8*, i8** %11
%66 = getelementptr inbounds i8, i8* %65, i64 1
%67 = call i32 @strtoul(i8* %66, i8** %13, i32 10)
store i32 %67, i32* %15
%68 = load i8*, i8** %12
%69 = load i8, i8* %68
%70 = icmp ne i8 %69, 0
br i1 %70, label %79, label %71
71: ; preds = %60
%72 = load i8*, i8** %13
%73 = load i8, i8* %72
%74 = icmp ne i8 %73, 0
br i1 %74, label %79, label %75
75: ; preds = %71
%76 = load i32, i32* %14
%77 = load i32, i32* %15
%78 = call i64 @makedev(i32 %76, i32 %77)
store i64 %78, i64* %2
br label %214
79: ; preds = %71, %60
%80 = load i8*, i8** %11
store i8 58, i8* %80
br label %91
81: ; preds = %54, %49
%82 = load i8*, i8** %3
%83 = call i32 @strtoul(i8* %82, i8** %4, i32 16)
%84 = sext i32 %83 to i64
store i64 %84, i64* %5
%85 = load i8*, i8** %4
%86 = load i8, i8* %85
%87 = icmp ne i8 %86, 0
br i1 %87, label %90, label %88
88: ; preds = %81
%89 = load i64, i64* %5
store i64 %89, i64* %2
br label %214
90: ; preds = %81
br label %91
91: ; preds = %90, %79
br label %95
92: ; preds = %45
%93 = load i8*, i8** %3
%94 = getelementptr inbounds i8, i8* %93, i64 5
store i8* %94, i8** %3
br label %95
95: ; preds = %92, %91
%96 = load i8*, i8** %3
%97 = call i32 @strcmp(i8* %96, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%98 = icmp ne i32 %97, 0
br i1 %98, label %101, label %99
99: ; preds = %95
%100 = call i64 @__makedev(i32 0, i32 255)
store i64 %100, i64* %2
br label %214
101: ; preds = %95
%102 = load i8*, i8** %3
%103 = call i32 @strcmp(i8* %102, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%104 = icmp ne i32 %103, 0
br i1 %104, label %107, label %105
105: ; preds = %101
%106 = call i64 @__makedev(i32 1, i32 0)
store i64 %106, i64* %2
br label %214
107: ; preds = %101
%108 = load i8*, i8** %3
%109 = call i64 @strncmp(i8* %108, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 3)
%110 = icmp ne i64 %109, 0
br i1 %110, label %113, label %111
111: ; preds = %107
%112 = call i64 @__makedev(i32 0, i32 254)
store i64 %112, i64* %2
br label %214
113: ; preds = %107
%114 = load i8*, i8** %3
%115 = call i32 @strlen(i8* %114)
store i32 %115, i32* %9
%116 = load i32, i32* %9
%117 = add nsw i32 %116, 1
%118 = call i8* @alloca(i32 %117)
store i8* %118, i8** %6
%119 = load i8*, i8** %6
%120 = load i8*, i8** %3
%121 = load i32, i32* %9
%122 = add nsw i32 %121, 1
%123 = call i32 @memcpy(i8* %119, i8* %120, i32 %122)
%124 = load i8*, i8** %6
store i8* %124, i8** %4
br label %125
125: ; preds = %137, %113
%126 = load i8*, i8** %4
%127 = load i8, i8* %126
%128 = icmp ne i8 %127, 0
br i1 %128, label %129, label %140
129: ; preds = %125
%130 = load i8*, i8** %4
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
%133 = icmp eq i32 %132, 47
br i1 %133, label %134, label %136
134: ; preds = %129
%135 = load i8*, i8** %4
store i8 33, i8* %135
br label %136
136: ; preds = %134, %129
br label %137
137: ; preds = %136
%138 = load i8*, i8** %4
%139 = getelementptr inbounds i8, i8* %138, i32 1
store i8* %139, i8** %4
br label %125
140: ; preds = %125
%141 = load i8*, i8** %6
%142 = call i64 @try_name(i8* %141, i32 0)
store i64 %142, i64* %5
%143 = load i64, i64* %5
%144 = icmp ne i64 %143, 0
br i1 %144, label %145, label %147
145: ; preds = %140
%146 = load i64, i64* %5
store i64 %146, i64* %2
br label %214
147: ; preds = %140
br label %148
148: ; preds = %160, %147
%149 = load i8*, i8** %4
%150 = load i8*, i8** %6
%151 = icmp ugt i8* %149, %150
br i1 %151, label %152, label %158
152: ; preds = %148
%153 = load i8*, i8** %4
%154 = getelementptr inbounds i8, i8* %153, i64 -1
%155 = load i8, i8* %154
%156 = call i64 @isdigit(i8 signext %155)
%157 = icmp ne i64 %156, 0
br label %158
158: ; preds = %152, %148
%159 = phi i1 [ false, %148 ], [ %157, %152 ]
br i1 %159, label %160, label %163
160: ; preds = %158
%161 = load i8*, i8** %4
%162 = getelementptr inbounds i8, i8* %161, i32 -1
store i8* %162, i8** %4
br label %148
163: ; preds = %158
%164 = load i8*, i8** %4
%165 = load i8*, i8** %6
%166 = icmp eq i8* %164, %165
br i1 %166, label %176, label %167
167: ; preds = %163
%168 = load i8*, i8** %4
%169 = load i8, i8* %168
%170 = icmp ne i8 %169, 0
br i1 %170, label %171, label %176
171: ; preds = %167
%172 = load i8*, i8** %4
%173 = load i8, i8* %172
%174 = sext i8 %173 to i32
%175 = icmp eq i32 %174, 48
br i1 %175, label %176, label %177
176: ; preds = %171, %167, %163
br label %213
177: ; preds = %171
%178 = load i8*, i8** %4
%179 = call i32 @strtoul(i8* %178, i8** null, i32 10)
store i32 %179, i32* %7
%180 = load i8*, i8** %4
store i8 0, i8* %180
%181 = load i8*, i8** %6
%182 = load i32, i32* %7
%183 = call i64 @try_name(i8* %181, i32 %182)
store i64 %183, i64* %5
%184 = load i64, i64* %5
%185 = icmp ne i64 %184, 0
br i1 %185, label %186, label %188
186: ; preds = %177
%187 = load i64, i64* %5
store i64 %187, i64* %2
br label %214
188: ; preds = %177
%189 = load i8*, i8** %4
%190 = load i8*, i8** %6
%191 = getelementptr inbounds i8, i8* %190, i64 2
%192 = icmp ult i8* %189, %191
br i1 %192, label %205, label %193
193: ; preds = %188
%194 = load i8*, i8** %4
%195 = getelementptr inbounds i8, i8* %194, i64 -2
%196 = load i8, i8* %195
%197 = call i64 @isdigit(i8 signext %196)
%198 = icmp ne i64 %197, 0
br i1 %198, label %199, label %205
199: ; preds = %193
%200 = load i8*, i8** %4
%201 = getelementptr inbounds i8, i8* %200, i64 -1
%202 = load i8, i8* %201
%203 = sext i8 %202 to i32
%204 = icmp ne i32 %203, 112
br i1 %204, label %205, label %206
205: ; preds = %199, %193, %188
br label %213
206: ; preds = %199
%207 = load i8*, i8** %4
%208 = getelementptr inbounds i8, i8* %207, i64 -1
store i8 0, i8* %208
%209 = load i8*, i8** %6
%210 = load i32, i32* %7
%211 = call i64 @try_name(i8* %209, i32 %210)
store i64 %211, i64* %5
%212 = load i64, i64* %5
store i64 %212, i64* %2
br label %214
213: ; preds = %205, %176
store i64 0, i64* %2
br label %214
214: ; preds = %213, %206, %186, %145, %111, %105, %99, %88, %75, %42
%215 = load i64, i64* %2
ret i64 %215
}

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