#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 priv_usch_cmd_arr(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                      int /*<<< orphan*/ *, int, char const **);
int priv_ucmd_impl(int num, const char **pp_args) {
  int i;
  int status;
  for (i = 0; i < (num - 1); i++) {
    pp_args[i] = pp_args[i + 1];
  }
  pp_args[num - 1] = NULL;
  status = priv_usch_cmd_arr(NULL, NULL, NULL, num - 1, pp_args);
  return status;
}


x86 assembly (clang, -O0):
<priv_ucmd_impl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1162 <priv_ucmd_impl+0x52>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <priv_ucmd_impl+0x16>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%r8
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rdi
mov    %rdx,%rsi
call   1030 <priv_usch_cmd_arr@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priv_ucmd_impl>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
lea    -0x1(%rdi),%ebp
cmp    $0x2,%edi
jl     1140 <priv_ucmd_impl+0x20>
lea    0x8(%rbx),%rsi
mov    %ebp,%edx
shl    $0x3,%rdx
mov    %rbx,%rdi
call   1030 <memmove@plt>
movslq %ebp,%rax
movq   $0x0,(%rbx,%rax,8)
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    %ebp,%ecx
mov    %rbx,%r8
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <priv_usch_cmd_arr@plt>

LLVM IR (-O0):
define i32 @priv_ucmd_impl(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
br label %7
7: ; preds = %23, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = icmp slt i32 %8, %10
br i1 %11, label %12, label %26
12: ; preds = %7
%13 = load i8**, i8*** %4
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %13, i64 %16
%18 = load i8*, i8** %17
%19 = load i8**, i8*** %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
store i8* %18, i8** %22
br label %23
23: ; preds = %12
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %7
26: ; preds = %7
%27 = load i8**, i8*** %4
%28 = load i32, i32* %3
%29 = sub nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %27, i64 %30
store i8* null, i8** %31
%32 = load i32, i32* %3
%33 = sub nsw i32 %32, 1
%34 = load i8**, i8*** %4
%35 = call i32 @priv_usch_cmd_arr(i32* null, i32* null, i32* null, i32 %33, i8** %34)
store i32 %35, i32* %6
%36 = load i32, i32* %6
ret i32 %36
}

LLVM IR (-O2):
define i32 @priv_ucmd_impl(i32 %0, i8** %1) {
%3 = add i32 %0, -1
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = bitcast i8** %1 to i8*
%7 = getelementptr i8*, i8** %1, i64 1
%8 = bitcast i8** %7 to i8*
%9 = zext i32 %3 to i64
%10 = shl nuw nsw i64 %9, 3
br label %11
11: ; preds = %5, %2
%12 = sext i32 %3 to i64
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
store i8* null, i8** %13
%14 = tail call i32 @priv_usch_cmd_arr(i32* null, i32* null, i32* null, i32 %3, i8** %1)
ret i32 %14
}