#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 */

/* Variables and functions */
int /*<<< orphan*/ PATH_MAX;
int cpio_mkslink(char *, char *, unsigned int, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int sscanf(char const *, char *, char *, char *, unsigned int *, int *, int *);
int /*<<< orphan*/ stderr;
int cpio_mkslink_line(const char *line) {
  char name[PATH_MAX + 1];
  char target[PATH_MAX + 1];
  unsigned int mode;
  int uid;
  int gid;
  int rc = -1;
  if (5 != sscanf(line,
                  "%"
                  "PATH_MAX"
                  "s %"
                  "PATH_MAX"
                  "s %o %d %d",
                  name, target, &mode, &uid, &gid)) {
    fprintf(stderr, "Unrecognized dir format '%s'", line);
    goto fail;
  }
  rc = cpio_mkslink(name, target, mode, uid, gid);
fail:
  return rc;
}


x86 assembly (clang, -O0):
<cpio_mkslink_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %rsp,%rdx
mov    %rdx,-0x10(%rbp)
mov    %rcx,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x18(%rbp)
mov    (%rax),%eax
add    $0x1,%eax
mov    %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rcx
sub    %rsi,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0xffffffff,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe62(%rip),%rsi
lea    -0x24(%rbp),%r8
lea    -0x28(%rbp),%r9
lea    -0x2c(%rbp),%rax
sub    $0x10,%rsp
mov    %rax,(%rsp)
call   1040 <sscanf@plt>
add    $0x10,%rsp
mov    %eax,%ecx
mov    $0x5,%eax
cmp    %ecx,%eax
je     11e8 <cpio_mkslink_line+0xb8>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe41(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1202 <cpio_mkslink_line+0xd2>
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x2c(%rbp),%r8d
call   1050 <cpio_mkslink@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpio_mkslink_line>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
mov    0x2ea9(%rip),%rax
mov    (%rax),%eax
add    $0x1,%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %rsp,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
sub    $0x8,%rsp
lea    -0x1c(%rbp),%rax
lea    0xe8b(%rip),%rsi
lea    -0x24(%rbp),%r8
lea    -0x20(%rbp),%r9
mov    %r15,%rdx
mov    %rbx,%rcx
push   %rax
call   1040 <sscanf@plt>
add    $0x10,%rsp
cmp    $0x5,%eax
jne    11a9 <cpio_mkslink_line+0x79>
mov    -0x24(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <cpio_mkslink@plt>
jmp    11c6 <cpio_mkslink_line+0x96>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
lea    0xe66(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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