#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*/ hpgs_get_error();
int /*<<< orphan*/ hpgs_log(char *, int /*<<< orphan*/);
int hpgs_scan_font_dir_internal(char const *, int *, int *);
void hpgs_scan_font_dir(const char *path, int *npaths, int *nerrors) {
  int ret = hpgs_scan_font_dir_internal(path, npaths, nerrors);
  ++(*npaths);
  if (ret) {
    ++(*nerrors);
    hpgs_log("hpgs_scan_font_dirs: %s\n", hpgs_get_error());
  }
}


x86 assembly (clang, -O0):
<hpgs_scan_font_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <hpgs_scan_font_dir_internal@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
cmpl   $0x0,-0x1c(%rbp)
je     118d <hpgs_scan_font_dir+0x5d>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    $0x0,%al
call   1050 <hpgs_get_error@plt>
mov    %eax,%esi
lea    0xe78(%rip),%rdi
call   1040 <hpgs_log@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hpgs_scan_font_dir>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
call   1030 <hpgs_scan_font_dir_internal@plt>
addl   $0x1,(%rbx)
test   %eax,%eax
je     1166 <hpgs_scan_font_dir+0x36>
addl   $0x1,(%r14)
xor    %eax,%eax
call   1050 <hpgs_get_error@plt>
lea    0xea8(%rip),%rdi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <hpgs_log@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"hpgs_scan_font_dirs: %s\0A\00"
define void @hpgs_scan_font_dir(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = load i8*, i8** %4
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = call i32 @hpgs_scan_font_dir_internal(i8* %8, i32* %9, i32* %10)
store i32 %11, i32* %7
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %12
%15 = load i32, i32* %7
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %3
%18 = load i32*, i32** %6
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1
store i32 %20, i32* %18
%21 = call i32 (...) @hpgs_get_error()
%22 = call i32 @hpgs_log(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %17, %3
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"hpgs_scan_font_dirs: %s\0A\00"
define void @hpgs_scan_font_dir(i8* %0, i32* %1, i32* %2) {
%4 = tail call i32 @hpgs_scan_font_dir_internal(i8* %0, i32* %1, i32* %2)
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
%7 = icmp eq i32 %4, 0
br i1 %7, label %13, label %8
8: ; preds = %3
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
%11 = tail call i32 (...) @hpgs_get_error()
%12 = tail call i32 @hpgs_log(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %8, %3
ret void
}