#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__ opterr;
char optopt;
int /*<<< orphan*/ write(int, char *, int);
void getopterror(int which) {
  static char error1[] = "Unknown option `-x'.\n";
  static char error2[] = "Missing argument for `-x'.\n";
  if (opterr) {
    if (which) {
      error2[23] = optopt;
      write(2, error2, 28);
    } else {
      error1[17] = optopt;
      write(2, error1, 22);
    }
  }
}


x86 assembly (clang, -O0):
<getopterror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
cmpq   $0x0,(%rax)
je     118a <getopterror+0x7a>
cmpl   $0x0,-0x4(%rbp)
je     1160 <getopterror+0x50>
mov    0x2eab(%rip),%rax
mov    (%rax),%al
mov    %al,0x2f22(%rip)
mov    $0x2,%edi
lea    0x2eff(%rip),%rsi
mov    $0x1c,%edx
call   1030 <write@plt>
jmp    1185 <getopterror+0x75>
mov    0x2e81(%rip),%rax
mov    (%rax),%al
mov    %al,0x2ed2(%rip)
mov    $0x2,%edi
lea    0x2eb5(%rip),%rsi
mov    $0x16,%edx
call   1030 <write@plt>
jmp    118a <getopterror+0x7a>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getopterror>:
mov    0x2ec1(%rip),%rax
cmpq   $0x0,(%rax)
je     1146 <getopterror+0x36>
mov    0x2ec4(%rip),%rax
mov    (%rax),%al
test   %edi,%edi
je     1147 <getopterror+0x37>
mov    %al,0x2f37(%rip)
lea    0x2f19(%rip),%rsi
mov    $0x2,%edi
mov    $0x1c,%edx
jmp    1030 <write@plt>
ret
mov    %al,0x2ef4(%rip)
lea    0x2edc(%rip),%rsi
mov    $0x2,%edi
mov    $0x16,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@getopterror.error1 = internal global [22 x i8] c"Unknown option `-x'.\0A\00"
@getopterror.error2 = internal global [28 x i8] c"Missing argument for `-x'.\0A\00"
@opterr = global i64 0
@optopt = global i8 0
define void @getopterror(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i64, i64* @opterr
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i8, i8* @optopt
store i8 %9, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @getopterror.error2, i64 0, i64 23)
%10 = call i32 @write(i32 2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @getopterror.error2, i64 0, i64 0), i32 28)
br label %14
11: ; preds = %5
%12 = load i8, i8* @optopt
store i8 %12, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @getopterror.error1, i64 0, i64 17)
%13 = call i32 @write(i32 2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @getopterror.error1, i64 0, i64 0), i32 22)
br label %14
14: ; preds = %11, %8
br label %15
15: ; preds = %14, %1
ret void
}

LLVM IR (-O2):
@getopterror.error1 = internal global [22 x i8] c"Unknown option `-x'.\0A\00"
@getopterror.error2 = internal global [28 x i8] c"Missing argument for `-x'.\0A\00"
@opterr = global i64 0
@optopt = global i8 0
define void @getopterror(i32 %0) {
%2 = load i64, i64* @opterr
%3 = icmp eq i64 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = icmp eq i32 %0, 0
%6 = load i8, i8* @optopt
br i1 %5, label %9, label %7
7: ; preds = %4
store i8 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @getopterror.error2, i64 0, i64 23)
%8 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @getopterror.error2, i64 0, i64 0), i32 28)
br label %11
9: ; preds = %4
store i8 %6, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @getopterror.error1, i64 0, i64 17)
%10 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @getopterror.error1, i64 0, i64 0), i32 22)
br label %11
11: ; preds = %7, %9, %1
ret void
}