#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*/ free(char *);
int /*<<< orphan*/ slog_csoup_format(char *, ...);
int /*<<< orphan*/ slog_csoup_puts(int /*<<< orphan*/, int, int /*<<< orphan*/);
char *smm_fontpath(char *, char **);
int /*<<< orphan*/ strcmp(char *, char *);
int fontpath_main(void *rtime, int argc, char **argv) {
  char *fdir;
  (void)rtime;
  (void)argc;
  (void)argv;
  while (--argc && (**++argv == '-')) {
    if (!strcmp(*argv, "-h") || !strcmp(*argv, "--help")) {
      slog_csoup_puts(0, (8 | 0), slog_csoup_format("fontpath [font_name]\n"));
      return 0;
    } else {
      slog_csoup_puts(0, (8 | 0),
                      slog_csoup_format("Unknown option. [%s]\n", *argv));
      return -1;
    }
  }
  if (argc > 0) {
    fdir = smm_fontpath(*argv, argv + 1);
    slog_csoup_puts(0, (8 | 0), slog_csoup_format("%s\n", fdir));
    free(fdir);
  }
  return 0;
}


x86 assembly (clang, -O0):
<fontpath_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x14(%rbp),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x29(%rbp)
je     1199 <fontpath_main+0x49>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x20(%rbp)
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
sete   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    11a9 <fontpath_main+0x59>
jmp    1238 <fontpath_main+0xe8>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xe49(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
je     11e1 <fontpath_main+0x91>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xe30(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1209 <fontpath_main+0xb9>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1060 <slog_csoup_format@plt>
mov    %eax,%edx
xor    %edi,%edi
mov    $0x8,%esi
call   1040 <slog_csoup_puts@plt>
movl   $0x0,-0x4(%rbp)
jmp    128a <fontpath_main+0x13a>
mov    -0x20(%rbp),%rax
mov    (%rax),%rsi
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1060 <slog_csoup_format@plt>
mov    %eax,%edx
xor    %edi,%edi
mov    $0x8,%esi
call   1040 <slog_csoup_puts@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    128a <fontpath_main+0x13a>
cmpl   $0x0,-0x14(%rbp)
jle    1283 <fontpath_main+0x133>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x20(%rbp),%rsi
add    $0x8,%rsi
call   1070 <smm_fontpath@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xdd1(%rip),%rdi
mov    $0x0,%al
call   1060 <slog_csoup_format@plt>
mov    %eax,%edx
xor    %edi,%edi
mov    $0x8,%esi
call   1040 <slog_csoup_puts@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fontpath_main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
cmp    $0x1,%esi
je     1215 <fontpath_main+0xc5>
mov    0x8(%rdx),%r14
cmpb   $0x2d,(%r14)
jne    11b5 <fontpath_main+0x65>
lea    0xe90(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11f7 <fontpath_main+0xa7>
lea    0xe80(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
je     11f7 <fontpath_main+0xa7>
lea    0xe8a(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <slog_csoup_format@plt>
xor    %edi,%edi
mov    $0x8,%esi
mov    %eax,%edx
call   1040 <slog_csoup_puts@plt>
mov    $0xffffffff,%ebx
jmp    1215 <fontpath_main+0xc5>
cmp    $0x2,%esi
jl     1215 <fontpath_main+0xc5>
add    $0x10,%rdx
mov    %r14,%rdi
mov    %rdx,%rsi
call   1070 <smm_fontpath@plt>
mov    %rax,%r14
lea    0xe63(%rip),%rdi
xor    %ebx,%ebx
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <slog_csoup_format@plt>
xor    %edi,%edi
mov    $0x8,%esi
mov    %eax,%edx
call   1040 <slog_csoup_puts@plt>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    1215 <fontpath_main+0xc5>
lea    0xe0c(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <slog_csoup_format@plt>
xor    %edi,%edi
mov    $0x8,%esi
mov    %eax,%edx
call   1040 <slog_csoup_puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [22 x i8] c"fontpath [font_name]\0A\00"
@.str.3 = [22 x i8] c"Unknown option. [%s]\0A\00"
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @fontpath_main(i8* %0, i32 %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = load i8**, i8*** %7
br label %12
12: ; preds = %3
%13 = load i32, i32* %6
%14 = add nsw i32 %13, -1
store i32 %14, i32* %6
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i8**, i8*** %7
%18 = getelementptr inbounds i8*, i8** %17, i32 1
store i8** %18, i8*** %7
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 45
br label %23
23: ; preds = %16, %12
%24 = phi i1 [ false, %12 ], [ %22, %16 ]
br i1 %24, label %25, label %43
25: ; preds = %23
%26 = load i8**, i8*** %7
%27 = load i8*, i8** %26
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = load i8**, i8*** %7
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %38, label %35
35: ; preds = %30, %25
%36 = call i32 (i8*, ...) @slog_csoup_format(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%37 = call i32 @slog_csoup_puts(i32 0, i32 8, i32 %36)
store i32 0, i32* %4
br label %58
38: ; preds = %30
%39 = load i8**, i8*** %7
%40 = load i8*, i8** %39
%41 = call i32 (i8*, ...) @slog_csoup_format(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %40)
%42 = call i32 @slog_csoup_puts(i32 0, i32 8, i32 %41)
store i32 -1, i32* %4
br label %58
43: ; preds = %23
%44 = load i32, i32* %6
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %57
46: ; preds = %43
%47 = load i8**, i8*** %7
%48 = load i8*, i8** %47
%49 = load i8**, i8*** %7
%50 = getelementptr inbounds i8*, i8** %49, i64 1
%51 = call i8* @smm_fontpath(i8* %48, i8** %50)
store i8* %51, i8** %8
%52 = load i8*, i8** %8
%53 = call i32 (i8*, ...) @slog_csoup_format(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %52)
%54 = call i32 @slog_csoup_puts(i32 0, i32 8, i32 %53)
%55 = load i8*, i8** %8
%56 = call i32 @free(i8* %55)
br label %57
57: ; preds = %46, %43
store i32 0, i32* %4
br label %58
58: ; preds = %57, %38, %35
%59 = load i32, i32* %4
ret i32 %59
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
@.str.2 = [22 x i8] c"fontpath [font_name]\0A\00"
@.str.3 = [22 x i8] c"Unknown option. [%s]\0A\00"
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @fontpath_main(i8* nocapture readnone %0, i32 %1, i8** %2) {
%4 = icmp eq i32 %1, 1
br i1 %4, label %30, label %5
5: ; preds = %3
%6 = getelementptr inbounds i8*, i8** %2, i64 1
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 45
br i1 %9, label %10, label %22
10: ; preds = %5
%11 = tail call i32 @strcmp(i8* %7, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %10
%14 = tail call i32 @strcmp(i8* %7, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %13, %10
%17 = tail call i32 (i8*, ...) @slog_csoup_format(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%18 = tail call i32 @slog_csoup_puts(i32 0, i32 8, i32 %17)
br label %30
19: ; preds = %13
%20 = tail call i32 (i8*, ...) @slog_csoup_format(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%21 = tail call i32 @slog_csoup_puts(i32 0, i32 8, i32 %20)
br label %30
22: ; preds = %5
%23 = icmp sgt i32 %1, 1
br i1 %23, label %24, label %30
24: ; preds = %22
%25 = getelementptr inbounds i8*, i8** %2, i64 2
%26 = tail call i8* @smm_fontpath(i8* %7, i8** %25)
%27 = tail call i32 (i8*, ...) @slog_csoup_format(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %26)
%28 = tail call i32 @slog_csoup_puts(i32 0, i32 8, i32 %27)
%29 = tail call i32 @free(i8* %26)
br label %30
30: ; preds = %3, %22, %24, %19, %16
%31 = phi i32 [ -1, %19 ], [ 0, %16 ], [ 0, %24 ], [ 0, %22 ], [ 0, %3 ]
ret i32 %31
}