#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 XorrisO {
  int dummy;
};

/* Variables and functions */
int Xorriso_cdrskin(struct XorrisO *, char *, int, char **, int /*<<< orphan*/);
int Xorriso_end_idx(struct XorrisO *, int, char **, int, int);
int Xorriso_as_cdrskin(struct XorrisO *xorriso, int argc, char **argv, int *idx,
                       int flag) {
  int end_idx, ret, old_idx;
  old_idx = *idx;
  end_idx = Xorriso_end_idx(xorriso, argc, argv, *idx, 1);
  (*idx) = end_idx;
  if (end_idx <= 0 || old_idx >= argc)
    return (1);
  ret =
      Xorriso_cdrskin(xorriso, "cdrskin", end_idx - old_idx, argv + old_idx, 0);
  return (ret);
}


x86 assembly (clang, -O0):
<Xorriso_as_cdrskin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
mov    $0x1,%r8d
call   1030 <Xorriso_end_idx@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x30(%rbp)
jle    1182 <Xorriso_as_cdrskin+0x62>
mov    -0x38(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     118e <Xorriso_as_cdrskin+0x6e>
movl   $0x1,-0x4(%rbp)
jmp    11bf <Xorriso_as_cdrskin+0x9f>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%edx
sub    -0x38(%rbp),%edx
mov    -0x20(%rbp),%rcx
movslq -0x38(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rcx
lea    0xe52(%rip),%rsi
xor    %r8d,%r8d
call   1040 <Xorriso_cdrskin@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Xorriso_as_cdrskin>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r12
mov    %rdx,%r15
mov    %esi,%ebx
mov    %rdi,%r14
mov    (%rcx),%ebp
mov    %ebp,%ecx
mov    $0x1,%r8d
call   1030 <Xorriso_end_idx@plt>
mov    %eax,(%r12)
cmp    %ebx,%ebp
jge    1173 <Xorriso_as_cdrskin+0x53>
test   %eax,%eax
jle    1173 <Xorriso_as_cdrskin+0x53>
movslq %ebp,%rcx
sub    %ebp,%eax
lea    (%r15,%rcx,8),%rcx
lea    0xea2(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
xor    %r8d,%r8d
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <Xorriso_cdrskin@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.XorrisO = type { i32 }
@.str = [8 x i8] c"cdrskin\00"
define i32 @Xorriso_as_cdrskin(%struct.XorrisO* %0, i32 %1, i8** %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca %struct.XorrisO*
%8 = alloca i32
%9 = alloca i8**
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store %struct.XorrisO* %0, %struct.XorrisO** %7
store i32 %1, i32* %8
store i8** %2, i8*** %9
store i32* %3, i32** %10
store i32 %4, i32* %11
%15 = load i32*, i32** %10
%16 = load i32, i32* %15
store i32 %16, i32* %14
%17 = load %struct.XorrisO*, %struct.XorrisO** %7
%18 = load i32, i32* %8
%19 = load i8**, i8*** %9
%20 = load i32*, i32** %10
%21 = load i32, i32* %20
%22 = call i32 @Xorriso_end_idx(%struct.XorrisO* %17, i32 %18, i8** %19, i32 %21, i32 1)
store i32 %22, i32* %12
%23 = load i32, i32* %12
%24 = load i32*, i32** %10
store i32 %23, i32* %24
%25 = load i32, i32* %12
%26 = icmp sle i32 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %5
%28 = load i32, i32* %14
%29 = load i32, i32* %8
%30 = icmp sge i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %27, %5
store i32 1, i32* %6
br label %43
32: ; preds = %27
%33 = load %struct.XorrisO*, %struct.XorrisO** %7
%34 = load i32, i32* %12
%35 = load i32, i32* %14
%36 = sub nsw i32 %34, %35
%37 = load i8**, i8*** %9
%38 = load i32, i32* %14
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = call i32 @Xorriso_cdrskin(%struct.XorrisO* %33, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %36, i8** %40, i32 0)
store i32 %41, i32* %13
%42 = load i32, i32* %13
store i32 %42, i32* %6
br label %43
43: ; preds = %32, %31
%44 = load i32, i32* %6
ret i32 %44
}

LLVM IR (-O2):
%struct.XorrisO = type { i32 }
@.str = [8 x i8] c"cdrskin\00"
define i32 @Xorriso_as_cdrskin(%struct.XorrisO* %0, i32 %1, i8** %2, i32* nocapture %3, i32 %4) {
%6 = load i32, i32* %3
%7 = tail call i32 @Xorriso_end_idx(%struct.XorrisO* %0, i32 %1, i8** %2, i32 %6, i32 1)
store i32 %7, i32* %3
%8 = icmp sgt i32 %7, 0
%9 = icmp slt i32 %6, %1
%10 = and i1 %9, %8
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = sub nsw i32 %7, %6
%13 = sext i32 %6 to i64
%14 = getelementptr inbounds i8*, i8** %2, i64 %13
%15 = tail call i32 @Xorriso_cdrskin(%struct.XorrisO* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %12, i8** %14, i32 0)
br label %16
16: ; preds = %5, %11
%17 = phi i32 [ %15, %11 ], [ 1, %5 ]
ret i32 %17
}