#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 */
scalar_t__ roadmap_file_exists(char const *, char *);
int /*<<< orphan*/ roadmap_help_make_url(char const *);
int /*<<< orphan*/ roadmap_log(int, char *, int, char *);
char *roadmap_path_first(char *);
char *roadmap_path_next(char *, char const *);
char *roadmap_path_user();
int roadmap_help_prepare(void) {
  const char *path;
  path = roadmap_path_user();
  if (roadmap_file_exists(path, "manual.html")) {
    roadmap_help_make_url(path);
    return 1;
  }
  for (path = roadmap_path_first("config"); path != NULL;
       path = roadmap_path_next("config", path)) {
    if (roadmap_file_exists(path, "manual.html")) {
      roadmap_help_make_url(path);
      return 1;
    }
  }
  roadmap_log(4,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/heads/"
              "master/roadmap_help.c",
              115, "manual not found");
  return 0;
}


x86 assembly (clang, -O0):
<roadmap_help_prepare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <roadmap_path_user@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1040 <roadmap_file_exists@plt>
cmp    $0x0,%rax
je     11a2 <roadmap_help_prepare+0x42>
mov    -0x10(%rbp),%rdi
call   1080 <roadmap_help_make_url@plt>
movl   $0x1,-0x4(%rbp)
jmp    122e <roadmap_help_prepare+0xce>
lea    0xe63(%rip),%rdi
call   1070 <roadmap_path_first@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     120a <roadmap_help_prepare+0xaa>
mov    -0x10(%rbp),%rdi
lea    0xe38(%rip),%rsi
call   1040 <roadmap_file_exists@plt>
cmp    $0x0,%rax
je     11ec <roadmap_help_prepare+0x8c>
mov    -0x10(%rbp),%rdi
call   1080 <roadmap_help_make_url@plt>
movl   $0x1,-0x4(%rbp)
jmp    122e <roadmap_help_prepare+0xce>
jmp    11f1 <roadmap_help_prepare+0x91>
mov    -0x10(%rbp),%rsi
lea    0xe10(%rip),%rdi
call   1030 <roadmap_path_next@plt>
mov    %rax,-0x10(%rbp)
jmp    11b2 <roadmap_help_prepare+0x52>
mov    $0x4,%edi
lea    0xdfd(%rip),%rsi
mov    $0x73,%edx
lea    0xe83(%rip),%rcx
call   1050 <roadmap_log@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roadmap_help_prepare>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1060 <roadmap_path_user@plt>
mov    %rax,%rbx
lea    0xe8a(%rip),%rsi
mov    %rax,%rdi
call   1040 <roadmap_file_exists@plt>
test   %rax,%rax
je     1192 <roadmap_help_prepare+0x32>
mov    %rbx,%rdi
call   1080 <roadmap_help_make_url@plt>
mov    $0x1,%eax
jmp    1202 <roadmap_help_prepare+0xa2>
lea    0xe73(%rip),%rdi
call   1070 <roadmap_path_first@plt>
test   %rax,%rax
je     11e3 <roadmap_help_prepare+0x83>
mov    %rax,%rbx
lea    0xe53(%rip),%r14
lea    0xe58(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <roadmap_file_exists@plt>
test   %rax,%rax
jne    1183 <roadmap_help_prepare+0x23>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <roadmap_path_next@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    11c0 <roadmap_help_prepare+0x60>
lea    0xe29(%rip),%rsi
lea    0xeb4(%rip),%rcx
mov    $0x4,%edi
mov    $0x73,%edx
call   1050 <roadmap_log@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"manual.html\00"
@.str.1 = [7 x i8] c"config\00"
@.str.2 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/heads/master/roadmap_help.c\00"
@.str.3 = [17 x i8] c"manual not found\00"
define i32 @roadmap_help_prepare() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i8* (...) @roadmap_path_user()
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @roadmap_file_exists(i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i32 @roadmap_help_make_url(i8* %8)
store i32 1, i32* %1
br label %28
10: ; preds = %0
%11 = call i8* @roadmap_path_first(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
store i8* %11, i8** %2
br label %12
12: ; preds = %23, %10
%13 = load i8*, i8** %2
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = load i8*, i8** %2
%17 = call i64 @roadmap_file_exists(i8* %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i8*, i8** %2
%21 = call i32 @roadmap_help_make_url(i8* %20)
store i32 1, i32* %1
br label %28
22: ; preds = %15
br label %23
23: ; preds = %22
%24 = load i8*, i8** %2
%25 = call i8* @roadmap_path_next(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %24)
store i8* %25, i8** %2
br label %12
26: ; preds = %12
%27 = call i32 @roadmap_log(i32 4, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.2, i64 0, i64 0), i32 115, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %28
28: ; preds = %26, %19, %7
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str = [12 x i8] c"manual.html\00"
@.str.1 = [7 x i8] c"config\00"
@.str.2 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/heads/master/roadmap_help.c\00"
@.str.3 = [17 x i8] c"manual not found\00"
define i32 @roadmap_help_prepare() {
%1 = tail call i8* (...) @roadmap_path_user()
%2 = tail call i64 @roadmap_file_exists(i8* %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @roadmap_help_make_url(i8* %1)
br label %20
6: ; preds = %0
%7 = tail call i8* @roadmap_path_first(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %18, label %9
9: ; preds = %6, %15
%10 = phi i8* [ %16, %15 ], [ %7, %6 ]
%11 = tail call i64 @roadmap_file_exists(i8* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = tail call i32 @roadmap_help_make_url(i8* %10)
br label %20
15: ; preds = %9
%16 = tail call i8* @roadmap_path_next(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %9
18: ; preds = %15, %6
%19 = tail call i32 @roadmap_log(i32 4, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.2, i64 0, i64 0), i32 115, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %13, %4
%21 = phi i32 [ 1, %4 ], [ 1, %13 ], [ 0, %18 ]
ret i32 %21
}