#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_mkdir(char *, unsigned int, int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int sscanf(char const *, char *, char *, unsigned int *, int *, int *);
int /*<<< orphan*/ stderr;
int cpio_mkdir_line(const char *line) {
  char name[PATH_MAX + 1];
  unsigned int mode;
  int uid;
  int gid;
  int rc = -1;
  if (4 != sscanf(line,
                  "%"
                  "PATH_MAX"
                  "s %o %d %d",
                  name, &mode, &uid, &gid)) {
    fprintf(stderr, "Unrecognized dir format '%s'", line);
    goto fail;
  }
  rc = cpio_mkdir(name, mode, uid, gid);
fail:
  return rc;
}


x86 assembly (clang, -O0):
<cpio_mkdir_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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,-0x30(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x18(%rbp)
movl   $0xffffffff,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe83(%rip),%rsi
lea    -0x1c(%rbp),%rcx
lea    -0x20(%rbp),%r8
lea    -0x24(%rbp),%r9
call   1040 <sscanf@plt>
mov    %eax,%ecx
mov    $0x4,%eax
cmp    %ecx,%eax
je     11bb <cpio_mkdir_line+0x8b>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe63(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11d0 <cpio_mkdir_line+0xa0>
mov    -0x30(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
call   1050 <cpio_mkdir@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpio_mkdir_line>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0x10,%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
lea    0xe9e(%rip),%rsi
lea    -0x1c(%rbp),%rcx
lea    -0x18(%rbp),%r8
lea    -0x14(%rbp),%r9
mov    %rbx,%rdx
call   1040 <sscanf@plt>
cmp    $0x4,%eax
jne    118e <cpio_mkdir_line+0x5e>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    %rbx,%rdi
call   1050 <cpio_mkdir@plt>
jmp    11ab <cpio_mkdir_line+0x7b>
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%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 = [20 x i8] c"%PATH_MAXs %o %d %d\00"
@stderr = global i32 0
@.str.1 = [29 x i8] c"Unrecognized dir format '%s'\00"
define i32 @cpio_mkdir_line(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %2
%9 = load i32, i32* @PATH_MAX
%10 = add nsw i32 %9, 1
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %3
%13 = alloca i8, i64 %11
store i64 %11, i64* %4
store i32 -1, i32* %8
%14 = load i8*, i8** %2
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %13, i32* %5, i32* %6, i32* %7)
%16 = icmp ne i32 4, %15
br i1 %16, label %17, label %21
17: ; preds = %1
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %2
%20 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %26
21: ; preds = %1
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = call i32 @cpio_mkdir(i8* %13, i32 %22, i32 %23, i32 %24)
store i32 %25, i32* %8
br label %26
26: ; preds = %21, %17
%27 = load i32, i32* %8
%28 = load i8*, i8** %3
ret i32 %27
}

LLVM IR (-O2):
@PATH_MAX = global i32 0
@.str = [20 x i8] c"%PATH_MAXs %o %d %d\00"
@stderr = global i32 0
@.str.1 = [29 x i8] c"Unrecognized dir format '%s'\00"
define i32 @cpio_mkdir_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 = bitcast i32* %2 to i8*
%10 = bitcast i32* %3 to i8*
%11 = bitcast i32* %4 to i8*
%12 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %8, i32* %2, i32* %3, i32* %4)
%13 = icmp eq i32 %12, 4
br i1 %13, label %17, label %14
14: ; preds = %1
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %22
17: ; preds = %1
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = call i32 @cpio_mkdir(i8* %8, i32 %18, i32 %19, i32 %20)
br label %22
22: ; preds = %17, %14
%23 = phi i32 [ -1, %14 ], [ %21, %17 ]
ret i32 %23
}