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

/* Variables and functions */
int parse_credential(char const **, size_t *, struct ccache_credential *);
int ccache_parse_credential(const char *data, size_t len,
                            struct ccache_credential *out, size_t *n) {
  size_t savelen = len;
  int rc = parse_credential(&data, &len, out);
  if (rc < 0)
    return rc;
  *n = savelen - len;
  return 0;
}


x86 assembly (clang, -O0):
<ccache_parse_credential>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdx
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <parse_credential@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1159 <ccache_parse_credential+0x49>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116f <ccache_parse_credential+0x5f>
mov    -0x30(%rbp),%rcx
sub    -0x18(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ccache_parse_credential>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rsi,%rbx
mov    %rdi,0x10(%rsp)
mov    %rsi,0x8(%rsp)
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <parse_credential@plt>
test   %eax,%eax
js     1144 <ccache_parse_credential+0x34>
sub    0x8(%rsp),%rbx
mov    %rbx,(%r14)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.ccache_credential = type { i32 }
define i32 @ccache_parse_credential(i8* %0, i64 %1, %struct.ccache_credential* %2, i64* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca %struct.ccache_credential*
%9 = alloca i64*
%10 = alloca i64
%11 = alloca i32
store i8* %0, i8** %6
store i64 %1, i64* %7
store %struct.ccache_credential* %2, %struct.ccache_credential** %8
store i64* %3, i64** %9
%12 = load i64, i64* %7
store i64 %12, i64* %10
%13 = load %struct.ccache_credential*, %struct.ccache_credential** %8
%14 = call i32 @parse_credential(i8** %6, i64* %7, %struct.ccache_credential* %13)
store i32 %14, i32* %11
%15 = load i32, i32* %11
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %4
%18 = load i32, i32* %11
store i32 %18, i32* %5
br label %24
19: ; preds = %4
%20 = load i64, i64* %10
%21 = load i64, i64* %7
%22 = sub i64 %20, %21
%23 = load i64*, i64** %9
store i64 %22, i64* %23
store i32 0, i32* %5
br label %24
24: ; preds = %19, %17
%25 = load i32, i32* %5
ret i32 %25
}

LLVM IR (-O2):
%struct.ccache_credential = type { i32 }
define i32 @ccache_parse_credential(i8* %0, i64 %1, %struct.ccache_credential* %2, i64* nocapture writeonly %3) {
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
%7 = call i32 @parse_credential(i8** %5, i64* %6, %struct.ccache_credential* %2)
%8 = icmp slt i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = load i64, i64* %6
%11 = sub i64 %1, %10
store i64 %11, i64* %3
br label %12
12: ; preds = %4, %9
%13 = phi i32 [ 0, %9 ], [ %7, %4 ]
ret i32 %13
}