#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char **mg_get_valid_option_names();
char *mg_version();
int /*<<< orphan*/ stderr;
void show_usage_and_exit(void) {
  const char **names;
  int i;
  fprintf(stderr, "Tinyweb version %s (c) jing wang, built on %s\n",
          mg_version(), "Mar 16 2022");
  fprintf(stderr, "Usage:\n");
  fprintf(stderr, "  tinyweb -A <htpasswd_file> <realm> <user> <passwd>\n");
  fprintf(stderr, "  tinyweb [config_file]\n");
  fprintf(stderr, "  tinyweb [-option value ...]\n");
  fprintf(stderr, "\nOPTIONS:\n");
  names = mg_get_valid_option_names();
  for (i = 0; names[i] != NULL; i += 2) {
    fprintf(stderr, "  -%s %s\n", names[i],
            names[i + 1] == NULL ? "<empty>" : names[i + 1]);
  }
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<show_usage_and_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x2e91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <mg_version@plt>
mov    -0x10(%rbp),%edi
mov    %rax,%rdx
lea    0xe98(%rip),%rsi
lea    0xec0(%rip),%rcx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <mg_get_valid_option_names@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     128e <show_usage_and_exit+0x14e>
mov    0x2dcb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    1252 <show_usage_and_exit+0x112>
lea    0xe7d(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    1267 <show_usage_and_exit+0x127>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rcx
lea    0xe43(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    11fb <show_usage_and_exit+0xbb>
mov    0x2d43(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<show_usage_and_exit>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x2e91(%rip),%r15
mov    (%r15),%ebx
xor    %eax,%eax
call   1050 <mg_version@plt>
lea    0xea0(%rip),%rsi
lea    0xec8(%rip),%rcx
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r15),%edi
lea    0xebe(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r15),%edi
lea    0xeb5(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r15),%edi
lea    0xeda(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r15),%edi
lea    0xee2(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%r15),%edi
lea    0xef0(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <mg_get_valid_option_names@plt>
mov    (%rax),%rdx
test   %rdx,%rdx
je     1214 <show_usage_and_exit+0xd4>
mov    %rax,%rbx
add    $0x10,%rbx
lea    0xee1(%rip),%r12
lea    0xed0(%rip),%r14
nopl   0x0(%rax)
mov    (%r15),%edi
mov    -0x8(%rbx),%rcx
test   %rcx,%rcx
cmove  %r12,%rcx
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%rdx
add    $0x10,%rbx
test   %rdx,%rdx
jne    11f0 <show_usage_and_exit+0xb0>
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [47 x i8] c"Tinyweb version %s (c) jing wang, built on %s\0A\00"
@.str.1 = [12 x i8] c"Mar 16 2022\00"
@.str.2 = [8 x i8] c"Usage:\0A\00"
@.str.3 = [54 x i8] c" tinyweb -A <htpasswd_file> <realm> <user> <passwd>\0A\00"
@.str.4 = [25 x i8] c" tinyweb [config_file]\0A\00"
@.str.5 = [31 x i8] c" tinyweb [-option value ...]\0A\00"
@.str.6 = [11 x i8] c"\0AOPTIONS:\0A\00"
@.str.7 = [10 x i8] c" -%s %s\0A\00"
@.str.8 = [8 x i8] c"<empty>\00"
@EXIT_FAILURE = global i32 0
define void @show_usage_and_exit() {
%1 = alloca i8**
%2 = alloca i32
%3 = load i32, i32* @stderr
%4 = call i8* (...) @mg_version()
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%16 = call i8** (...) @mg_get_valid_option_names()
store i8** %16, i8*** %1
store i32 0, i32* %2
br label %17
17: ; preds = %49, %0
%18 = load i8**, i8*** %1
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %52
24: ; preds = %17
%25 = load i32, i32* @stderr
%26 = load i8**, i8*** %1
%27 = load i32, i32* %2
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %1
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8*, i8** %31, i64 %34
%36 = load i8*, i8** %35
%37 = icmp eq i8* %36, null
br i1 %37, label %38, label %39
38: ; preds = %24
br label %46
39: ; preds = %24
%40 = load i8**, i8*** %1
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %40, i64 %43
%45 = load i8*, i8** %44
br label %46
46: ; preds = %39, %38
%47 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), %38 ], [ %45, %39 ]
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %30, i8* %47)
br label %49
49: ; preds = %46
%50 = load i32, i32* %2
%51 = add nsw i32 %50, 2
store i32 %51, i32* %2
br label %17
52: ; preds = %17
%53 = load i32, i32* @EXIT_FAILURE
%54 = call i32 @exit(i32 %53)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [47 x i8] c"Tinyweb version %s (c) jing wang, built on %s\0A\00"
@.str.1 = [12 x i8] c"Mar 16 2022\00"
@.str.2 = [8 x i8] c"Usage:\0A\00"
@.str.3 = [54 x i8] c" tinyweb -A <htpasswd_file> <realm> <user> <passwd>\0A\00"
@.str.4 = [25 x i8] c" tinyweb [config_file]\0A\00"
@.str.5 = [31 x i8] c" tinyweb [-option value ...]\0A\00"
@.str.6 = [11 x i8] c"\0AOPTIONS:\0A\00"
@.str.7 = [10 x i8] c" -%s %s\0A\00"
@.str.8 = [8 x i8] c"<empty>\00"
@EXIT_FAILURE = global i32 0
define void @show_usage_and_exit() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @mg_version()
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %1, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%14 = tail call i8** (...) @mg_get_valid_option_names()
%15 = load i8*, i8** %14
%16 = icmp eq i8* %15, null
br i1 %16, label %31, label %17
17: ; preds = %0, %17
%18 = phi i64 [ %27, %17 ], [ 0, %0 ]
%19 = phi i8* [ %29, %17 ], [ %15, %0 ]
%20 = load i32, i32* @stderr
%21 = or i64 %18, 1
%22 = getelementptr inbounds i8*, i8** %14, i64 %21
%23 = load i8*, i8** %22
%24 = icmp eq i8* %23, null
%25 = select i1 %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* %23
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %19, i8* %25)
%27 = add nuw i64 %18, 2
%28 = getelementptr inbounds i8*, i8** %14, i64 %27
%29 = load i8*, i8** %28
%30 = icmp eq i8* %29, null
br i1 %30, label %31, label %17
31: ; preds = %17, %0
%32 = load i32, i32* @EXIT_FAILURE
%33 = tail call i32 @exit(i32 %32)
unreachable
}