#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*/ fatal(char *, char const *, char *);
int optind;
char *optopt;
void bad_option(const char *what, char **argv) {
  if (optopt == 0)
    fatal("unrecognised %s option %s", what, argv[optind - 1]);
  else
    fatal("unrecognised %s option -%c", what, optopt);
}


x86 assembly (clang, -O0):
<bad_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
cmpq   $0x0,(%rax)
jne    115d <bad_option+0x4d>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    0x2ea0(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xead(%rip),%rdi
call   1030 <fatal@plt>
jmp    1177 <bad_option+0x67>
mov    -0x8(%rbp),%rsi
mov    0x2e80(%rip),%rax
mov    (%rax),%rdx
lea    0xea8(%rip),%rdi
call   1030 <fatal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bad_option>:
mov    %rdi,%rax
mov    0x2ece(%rip),%rcx
mov    (%rcx),%rdx
test   %rdx,%rdx
je     1131 <bad_option+0x21>
lea    0xef1(%rip),%rdi
mov    %rax,%rsi
jmp    1030 <fatal@plt>
mov    0x2ea8(%rip),%rcx
movslq (%rcx),%rcx
mov    -0x8(%rsi,%rcx,8),%rdx
lea    0xeb9(%rip),%rdi
mov    %rax,%rsi
jmp    1030 <fatal@plt>

LLVM IR (-O0):
@optopt = global i8* null
@.str = [26 x i8] c"unrecognised %s option %s\00"
@optind = global i32 0
@.str.1 = [27 x i8] c"unrecognised %s option -%c\00"
define void @bad_option(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = load i8*, i8** @optopt
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = load i8**, i8*** %4
%10 = load i32, i32* @optind
%11 = sub nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %9, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %14)
br label %20
16: ; preds = %2
%17 = load i8*, i8** %3
%18 = load i8*, i8** @optopt
%19 = call i32 @fatal(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %17, i8* %18)
br label %20
20: ; preds = %16, %7
ret void
}

LLVM IR (-O2):
@optopt = global i8* null
@.str = [26 x i8] c"unrecognised %s option %s\00"
@optind = global i32 0
@.str.1 = [27 x i8] c"unrecognised %s option -%c\00"
define void @bad_option(i8* %0, i8** nocapture %1) {
%3 = load i8*, i8** @optopt
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = load i32, i32* @optind
%7 = add nsw i32 %6, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @fatal(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %10)
br label %14
12: ; preds = %2
%13 = tail call i32 @fatal(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %3)
br label %14
14: ; preds = %12, %5
ret void
}