#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*/ fprintf(int /*<<< orphan*/, char *, char);
scalar_t__ isprint(char);
char optopt;
int /*<<< orphan*/ stderr;
void handle_bad_opts(void) {
  if ((optopt == 'c') || (optopt == 'd')) {
    fprintf(stderr, "ERROR: option -%c requires an argument.\n\n", optopt);
  } else if (isprint(optopt)) {
    fprintf(stderr, "ERROR: unknown option `-%c'.\n\n", optopt);
  } else {
    fprintf(stderr, "ERROR: unknown option character `\\x%x'.\n\n", optopt);
  }
}


x86 assembly (clang, -O0):
<handle_bad_opts>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
movsbl (%rax),%eax
cmp    $0x63,%eax
je     114a <handle_bad_opts+0x2a>
mov    0x2eaa(%rip),%rax
movsbl (%rax),%eax
cmp    $0x64,%eax
jne    116e <handle_bad_opts+0x4e>
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
mov    0x2e87(%rip),%rax
movsbl (%rax),%edx
call   1030 <fprintf@plt>
jmp    11cf <handle_bad_opts+0xaf>
mov    0x2e73(%rip),%rax
movsbl (%rax),%edi
call   1040 <isprint@plt>
cmp    $0x0,%rax
je     11ab <handle_bad_opts+0x8b>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xe93(%rip),%rsi
mov    0x2e4a(%rip),%rax
movsbl (%rax),%edx
call   1030 <fprintf@plt>
jmp    11ca <handle_bad_opts+0xaa>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
lea    0xe8e(%rip),%rsi
mov    0x2e26(%rip),%rax
movsbl (%rax),%edx
call   1030 <fprintf@plt>
jmp    11cf <handle_bad_opts+0xaf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_bad_opts>:
push   %rbx
mov    0x2ec0(%rip),%rbx
mov    (%rbx),%al
lea    -0x63(%rax),%ecx
cmp    $0x1,%cl
ja     114b <handle_bad_opts+0x2b>
mov    0x2e9f(%rip),%rcx
mov    (%rcx),%edi
movsbl %al,%edx
lea    0xebb(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>
movsbl %al,%edi
call   1040 <isprint@plt>
mov    0x2e7e(%rip),%rcx
mov    (%rcx),%edi
mov    (%rbx),%cl
movsbl %cl,%edx
test   %rax,%rax
je     1173 <handle_bad_opts+0x53>
lea    0xebd(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>
lea    0xecf(%rip),%rsi
pop    %rbx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@optopt = global i8 0
@stderr = global i32 0
@.str = [42 x i8] c"ERROR: option -%c requires an argument.\0A\0A\00"
@.str.1 = [31 x i8] c"ERROR: unknown option `-%c'.\0A\0A\00"
@.str.2 = [42 x i8] c"ERROR: unknown option character `\\x%x'.\0A\0A\00"
define void @handle_bad_opts() {
%1 = load i8, i8* @optopt
%2 = sext i8 %1 to i32
%3 = icmp eq i32 %2, 99
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = load i8, i8* @optopt
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 100
br i1 %7, label %8, label %12
8: ; preds = %4, %0
%9 = load i32, i32* @stderr
%10 = load i8, i8* @optopt
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8 signext %10)
br label %25
12: ; preds = %4
%13 = load i8, i8* @optopt
%14 = call i64 @isprint(i8 signext %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* @stderr
%18 = load i8, i8* @optopt
%19 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8 signext %18)
br label %24
20: ; preds = %12
%21 = load i32, i32* @stderr
%22 = load i8, i8* @optopt
%23 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8 signext %22)
br label %24
24: ; preds = %20, %16
br label %25
25: ; preds = %24, %8
ret void
}

LLVM IR (-O2):
@optopt = global i8 0
@stderr = global i32 0
@.str = [42 x i8] c"ERROR: option -%c requires an argument.\0A\0A\00"
@.str.1 = [31 x i8] c"ERROR: unknown option `-%c'.\0A\0A\00"
@.str.2 = [42 x i8] c"ERROR: unknown option character `\\x%x'.\0A\0A\00"
define void @handle_bad_opts() {
%1 = load i8, i8* @optopt
%2 = add i8 %1, -99
%3 = icmp ult i8 %2, 2
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8 signext %1)
br label %16
7: ; preds = %0
%8 = tail call i64 @isprint(i8 signext %1)
%9 = icmp eq i64 %8, 0
%10 = load i32, i32* @stderr
%11 = load i8, i8* @optopt
br i1 %9, label %14, label %12
12: ; preds = %7
%13 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8 signext %11)
br label %16
14: ; preds = %7
%15 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i8 signext %11)
br label %16
16: ; preds = %12, %14, %4
ret void
}