#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*/ assert(int);
int /*<<< orphan*/ getoption(char **, int *, int *);
int mutator_opt(char **, int *, int *);
int show_all_opt(int);
int show_opt(char **, int *, int *);
int builtin_shopt(char *argv[]) {
  int argp = 1;
  int opts[2];
  assert(argv && argv[0]);
  opts[0] = -1;
  opts[1] = 0;
  getoption(argv, &argp, opts);
  if (opts[0] == -1 && !argv[argp])
    return show_all_opt(opts[1]);
  else if (opts[0] == -1 && argv[argp])
    return show_opt(argv, &argp, opts);
  else
    return mutator_opt(argv, &argp, opts);
}


x86 assembly (clang, -O0):
<builtin_shopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x1d(%rbp)
je     1181 <builtin_shopt+0x31>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
movl   $0xffffffff,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rdx
lea    -0x14(%rbp),%rsi
call   1060 <getoption@plt>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    11da <builtin_shopt+0x8a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    11da <builtin_shopt+0x8a>
mov    -0x18(%rbp),%edi
call   1050 <show_all_opt@plt>
mov    %eax,-0x4(%rbp)
jmp    1224 <builtin_shopt+0xd4>
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1210 <builtin_shopt+0xc0>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1210 <builtin_shopt+0xc0>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rdx
lea    -0x14(%rbp),%rsi
call   1070 <show_opt@plt>
mov    %eax,-0x4(%rbp)
jmp    1224 <builtin_shopt+0xd4>
mov    -0x10(%rbp),%rdi
lea    -0x1c(%rbp),%rdx
lea    -0x14(%rbp),%rsi
call   1030 <mutator_opt@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<builtin_shopt>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movl   $0x1,0x4(%rsp)
test   %rdi,%rdi
je     1171 <builtin_shopt+0x21>
xor    %edi,%edi
cmpq   $0x0,(%rbx)
setne  %dil
jmp    1173 <builtin_shopt+0x23>
xor    %edi,%edi
call   1040 <assert@plt>
mov    $0xffffffff,%eax
mov    %rax,0x8(%rsp)
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1060 <getoption@plt>
cmpl   $0xffffffff,0x8(%rsp)
je     11af <builtin_shopt+0x5f>
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <mutator_opt@plt>
jmp    11d8 <builtin_shopt+0x88>
movslq 0x4(%rsp),%rax
cmpq   $0x0,(%rbx,%rax,8)
je     11cf <builtin_shopt+0x7f>
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1070 <show_opt@plt>
jmp    11d8 <builtin_shopt+0x88>
mov    0xc(%rsp),%edi
call   1050 <show_all_opt@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @builtin_shopt(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32
%5 = alloca [2 x i32]
store i8** %0, i8*** %3
store i32 1, i32* %4
%6 = load i8**, i8*** %3
%7 = icmp ne i8** %6, null
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i8**, i8*** %3
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br label %13
13: ; preds = %8, %1
%14 = phi i1 [ false, %1 ], [ %12, %8 ]
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 -1, i32* %17
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
store i32 0, i32* %18
%19 = load i8**, i8*** %3
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%21 = call i32 @getoption(i8** %19, i32* %4, i32* %20)
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%23 = load i32, i32* %22
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %36
25: ; preds = %13
%26 = load i8**, i8*** %3
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8*, i8** %26, i64 %28
%30 = load i8*, i8** %29
%31 = icmp ne i8* %30, null
br i1 %31, label %36, label %32
32: ; preds = %25
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%34 = load i32, i32* %33
%35 = call i32 @show_all_opt(i32 %34)
store i32 %35, i32* %2
br label %55
36: ; preds = %25, %13
%37 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %51
40: ; preds = %36
%41 = load i8**, i8*** %3
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = icmp ne i8* %45, null
br i1 %46, label %47, label %51
47: ; preds = %40
%48 = load i8**, i8*** %3
%49 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%50 = call i32 @show_opt(i8** %48, i32* %4, i32* %49)
store i32 %50, i32* %2
br label %55
51: ; preds = %40, %36
%52 = load i8**, i8*** %3
%53 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%54 = call i32 @mutator_opt(i8** %52, i32* %4, i32* %53)
store i32 %54, i32* %2
br label %55
55: ; preds = %51, %47, %32
%56 = load i32, i32* %2
ret i32 %56
}

LLVM IR (-O2):
define i32 @builtin_shopt(i8** %0) {
%2 = alloca i32
%3 = alloca [2 x i32]
%4 = bitcast i32* %2 to i8*
store i32 1, i32* %2
%5 = bitcast [2 x i32]* %3 to i8*
%6 = icmp eq i8** %0, null
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i8*, i8** %0
%9 = icmp ne i8* %8, null
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %7, %1
%12 = phi i32 [ 0, %1 ], [ %10, %7 ]
%13 = tail call i32 @assert(i32 %12)
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
store i32 -1, i32* %14
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
store i32 0, i32* %15
%16 = call i32 @getoption(i8** %0, i32* %2, i32* %14)
%17 = load i32, i32* %14
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %30
19: ; preds = %11
%20 = load i32, i32* %2
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %0, i64 %21
%23 = load i8*, i8** %22
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = load i32, i32* %15
%27 = call i32 @show_all_opt(i32 %26)
br label %32
28: ; preds = %19
%29 = call i32 @show_opt(i8** %0, i32* %2, i32* %14)
br label %32
30: ; preds = %11
%31 = call i32 @mutator_opt(i8** %0, i32* %2, i32* %14)
br label %32
32: ; preds = %30, %28, %25
%33 = phi i32 [ %29, %28 ], [ %31, %30 ], [ %27, %25 ]
ret i32 %33
}