#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 */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int /*<<< orphan*/ PATH_MAX;
int cpio_mknod(char *, unsigned int, int /*<<< orphan*/, int /*<<< orphan*/,
               char, unsigned int, unsigned int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int sscanf(char const *, char *, char *, unsigned int *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, char *, unsigned int *, unsigned int *);
int /*<<< orphan*/ stderr;
int cpio_mknod_line(const char *line) {
  char name[PATH_MAX + 1];
  unsigned int mode;
  uid_t uid;
  gid_t gid;
  char dev_type;
  unsigned int maj;
  unsigned int min;
  int rc = -1;
  if (7 != sscanf(line,
                  "%"
                  "PATH_MAX"
                  "s %o %d %d %c %u %u",
                  name, &mode, &uid, &gid, &dev_type, &maj, &min)) {
    fprintf(stderr, "Unrecognized nod format '%s'", line);
    goto fail;
  }
  rc = cpio_mknod(name, mode, uid, gid, dev_type, maj, min);
fail:
  return rc;
}


x86 assembly (clang, -O0):
<cpio_mknod_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0xffffffff,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe83(%rip),%rsi
lea    -0x1c(%rbp),%rcx
lea    -0x20(%rbp),%r8
lea    -0x24(%rbp),%r9
lea    -0x25(%rbp),%r11
lea    -0x2c(%rbp),%r10
lea    -0x30(%rbp),%rax
sub    $0x20,%rsp
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <sscanf@plt>
add    $0x20,%rsp
mov    %eax,%ecx
mov    $0x7,%eax
cmp    %ecx,%eax
je     11dd <cpio_mknod_line+0xad>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe4a(%rip),%rsi
call   1030 <fprintf@plt>
jmp    120c <cpio_mknod_line+0xdc>
mov    -0x40(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x25(%rbp),%r8b
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%eax
sub    $0x10,%rsp
movsbl %r8b,%r8d
mov    %eax,(%rsp)
call   1040 <cpio_mknod@plt>
add    $0x10,%rsp
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpio_mknod_line>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%r14
mov    0x2eab(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
sub    $0x8,%rsp
lea    -0x18(%rbp),%rax
lea    -0x1c(%rbp),%r10
lea    -0x11(%rbp),%r11
lea    0xe8e(%rip),%rsi
lea    -0x28(%rbp),%rcx
lea    -0x24(%rbp),%r8
lea    -0x20(%rbp),%r9
mov    %rbx,%rdx
push   %rax
push   %r10
push   %r11
call   1050 <sscanf@plt>
add    $0x20,%rsp
cmp    $0x7,%eax
jne    11bc <cpio_mknod_line+0x8c>
mov    -0x28(%rbp),%esi
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
movsbl -0x11(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x18(%rbp),%eax
sub    $0x8,%rsp
mov    %rbx,%rdi
push   %rax
call   1040 <cpio_mknod@plt>
add    $0x10,%rsp
jmp    11d9 <cpio_mknod_line+0xa9>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
lea    0xe51(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@PATH_MAX = global i32 0
@.str = [29 x i8] c"%PATH_MAXs %o %d %d %c %u %u\00"
@stderr = global i32 0
@.str.1 = [29 x i8] c"Unrecognized nod format '%s'\00"
define i32 @cpio_mknod_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %2
%12 = load i32, i32* @PATH_MAX
%13 = add nsw i32 %12, 1
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %3
%16 = alloca i8, i64 %14
store i64 %14, i64* %4
store i32 -1, i32* %11
%17 = load i8*, i8** %2
%18 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %16, i32* %5, i32* %6, i32* %7, i8* %8, i32* %9, i32* %10)
%19 = icmp ne i32 7, %18
br i1 %19, label %20, label %24
20: ; preds = %1
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %2
%23 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %32
24: ; preds = %1
%25 = load i32, i32* %5
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = load i8, i8* %8
%29 = load i32, i32* %9
%30 = load i32, i32* %10
%31 = call i32 @cpio_mknod(i8* %16, i32 %25, i32 %26, i32 %27, i8 signext %28, i32 %29, i32 %30)
store i32 %31, i32* %11
br label %32
32: ; preds = %24, %20
%33 = load i32, i32* %11
%34 = load i8*, i8** %3
ret i32 %33
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [29 x i8] c"%PATH_MAXs %o %d %d %c %u %u\00"
@stderr = global i32 0
@.str.1 = [29 x i8] c"Unrecognized nod format '%s'\00"
define i32 @cpio_mknod_line(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = load i32, i32* @PATH_MAX
%9 = add nsw i32 %8, 1
%10 = zext i32 %9 to i64
%11 = alloca i8, i64 %10
%12 = bitcast i32* %2 to i8*
%13 = bitcast i32* %3 to i8*
%14 = bitcast i32* %4 to i8*
%15 = bitcast i32* %6 to i8*
%16 = bitcast i32* %7 to i8*
%17 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %11, i32* %2, i32* %3, i32* %4, i8* %5, i32* %6, i32* %7)
%18 = icmp eq i32 %17, 7
br i1 %18, label %22, label %19
19: ; preds = %1
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %30
22: ; preds = %1
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = load i8, i8* %5
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = call i32 @cpio_mknod(i8* %11, i32 %23, i32 %24, i32 %25, i8 signext %26, i32 %27, i32 %28)
br label %30
30: ; preds = %22, %19
%31 = phi i32 [ -1, %19 ], [ %29, %22 ]
ret i32 %31
}