#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*/ assert(void *);
int /*<<< orphan*/ isempty(char const *);
int parse_percent(char const *, size_t *);
int config_parse_percent(const char *filename, unsigned line,
                         const char *section, const char *lvalue, int ltype,
                         const char *rvalue, void *data) {
  size_t *percent = data, p = 0;
  int r;
  assert(filename);
  assert(lvalue);
  assert(rvalue);
  assert(data);
  if (!isempty(rvalue)) {
    r = parse_percent(rvalue, &p);
    if (r < 0)
      return r;
  }
  *percent = p;
  return 0;
}


x86 assembly (clang, -O0):
<config_parse_percent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    %r9,-0x38(%rbp)
mov    0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x28(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x38(%rbp),%rdi
call   1030 <assert@plt>
mov    0x10(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x38(%rbp),%rdi
call   1050 <isempty@plt>
cmp    $0x0,%eax
jne    11c3 <config_parse_percent+0x93>
mov    -0x38(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1040 <parse_percent@plt>
mov    %eax,-0x4c(%rbp)
cmpl   $0x0,-0x4c(%rbp)
jge    11be <config_parse_percent+0x8e>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11d5 <config_parse_percent+0xa5>
jmp    11c3 <config_parse_percent+0x93>
mov    -0x48(%rbp),%rcx
mov    -0x40(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_parse_percent>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %r9,%rbx
mov    %rcx,%r15
mov    0x30(%rsp),%r14
movq   $0x0,0x8(%rsp)
call   1030 <assert@plt>
mov    %r15,%rdi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1030 <assert@plt>
mov    %r14,%rdi
call   1030 <assert@plt>
mov    %rbx,%rdi
call   1050 <isempty@plt>
xor    %r15d,%r15d
test   %eax,%eax
je     117d <config_parse_percent+0x4d>
xor    %eax,%eax
jmp    1193 <config_parse_percent+0x63>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <parse_percent@plt>
test   %eax,%eax
js     11a3 <config_parse_percent+0x73>
mov    0x8(%rsp),%rax
mov    %rax,(%r14)
mov    %r15d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %eax,%r15d
jmp    1196 <config_parse_percent+0x66>

LLVM IR (-O0):
define i32 @config_parse_percent(i8* %0, i32 %1, i8* %2, i8* %3, i32 %4, i8* %5, i8* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i64*
%17 = alloca i64
%18 = alloca i32
store i8* %0, i8** %9
store i32 %1, i32* %10
store i8* %2, i8** %11
store i8* %3, i8** %12
store i32 %4, i32* %13
store i8* %5, i8** %14
store i8* %6, i8** %15
%19 = load i8*, i8** %15
%20 = bitcast i8* %19 to i64*
store i64* %20, i64** %16
store i64 0, i64* %17
%21 = load i8*, i8** %9
%22 = call i32 @assert(i8* %21)
%23 = load i8*, i8** %12
%24 = call i32 @assert(i8* %23)
%25 = load i8*, i8** %14
%26 = call i32 @assert(i8* %25)
%27 = load i8*, i8** %15
%28 = call i32 @assert(i8* %27)
%29 = load i8*, i8** %14
%30 = call i32 @isempty(i8* %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %40, label %32
32: ; preds = %7
%33 = load i8*, i8** %14
%34 = call i32 @parse_percent(i8* %33, i64* %17)
store i32 %34, i32* %18
%35 = load i32, i32* %18
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = load i32, i32* %18
store i32 %38, i32* %8
br label %43
39: ; preds = %32
br label %40
40: ; preds = %39, %7
%41 = load i64, i64* %17
%42 = load i64*, i64** %16
store i64 %41, i64* %42
store i32 0, i32* %8
br label %43
43: ; preds = %40, %37
%44 = load i32, i32* %8
ret i32 %44
}

LLVM IR (-O2):
define i32 @config_parse_percent(i8* %0, i32 %1, i8* nocapture readnone %2, i8* %3, i32 %4, i8* %5, i8* %6) {
%8 = alloca i64
%9 = bitcast i8* %6 to i64*
%10 = bitcast i64* %8 to i8*
store i64 0, i64* %8
%11 = tail call i32 @assert(i8* %0)
%12 = tail call i32 @assert(i8* %3)
%13 = tail call i32 @assert(i8* %5)
%14 = tail call i32 @assert(i8* %6)
%15 = tail call i32 @isempty(i8* %5)
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %7
%18 = call i32 @parse_percent(i8* %5, i64* %8)
%19 = icmp slt i32 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = load i64, i64* %8
br label %22
22: ; preds = %20, %7
%23 = phi i64 [ %21, %20 ], [ 0, %7 ]
store i64 %23, i64* %9
br label %24
24: ; preds = %17, %22
%25 = phi i32 [ 0, %22 ], [ %18, %17 ]
ret i32 %25
}