#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*/ _getopt_reset(int, char **);
int _set_do(int, char **);
int _set_list();
int _set_unset();
int _set_usage();
int getopt(int, char **, char *);
int optind;
scalar_t__ strcmp(char *, char *);
int builtin_set(int argc, char *argv[]) {
  int o;
  _getopt_reset(argc, argv);
  while ((o = getopt(argc, argv, "o")) != -1)
    switch (o) {
    case 'o':
      break;
    default:
      return _set_usage();
    }
  if (argc == optind) {
    if (optind > 1 && strcmp(argv[optind - 1], "--") == 0)
      return _set_unset();
    return _set_list();
  }
  return _set_do(argc, argv);
}


x86 assembly (clang, -O0):
<builtin_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <_getopt_reset@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe67(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     11d4 <builtin_set+0x64>
mov    -0x14(%rbp),%eax
sub    $0x6f,%eax
jne    11c0 <builtin_set+0x50>
jmp    11bb <builtin_set+0x4b>
jmp    11cf <builtin_set+0x5f>
mov    $0x0,%al
call   1030 <_set_usage@plt>
mov    %eax,-0x4(%rbp)
jmp    1250 <builtin_set+0xe0>
jmp    118b <builtin_set+0x1b>
mov    -0x8(%rbp),%eax
mov    0x2e0a(%rip),%rcx
cmp    (%rcx),%eax
jne    1241 <builtin_set+0xd1>
mov    0x2dfb(%rip),%rax
cmpl   $0x1,(%rax)
jle    1232 <builtin_set+0xc2>
mov    -0x10(%rbp),%rax
mov    0x2de7(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xdee(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1232 <builtin_set+0xc2>
mov    $0x0,%al
call   1070 <_set_unset@plt>
mov    %eax,-0x4(%rbp)
jmp    1250 <builtin_set+0xe0>
mov    $0x0,%al
call   1090 <_set_list@plt>
mov    %eax,-0x4(%rbp)
jmp    1250 <builtin_set+0xe0>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <_set_do@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<builtin_set>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
call   1060 <_getopt_reset@plt>
lea    0xe7a(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1080 <getopt@plt>
cmp    $0x6f,%eax
je     1190 <builtin_set+0x20>
cmp    $0xffffffff,%eax
jne    11db <builtin_set+0x6b>
mov    0x2e3a(%rip),%rax
cmp    %ebx,(%rax)
jne    11e7 <builtin_set+0x77>
cmp    $0x2,%ebx
jl     11cf <builtin_set+0x5f>
add    $0xffffffff,%ebx
mov    (%r14,%rbx,8),%rdi
lea    0xe3d(%rip),%rsi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11f6 <builtin_set+0x86>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1090 <_set_list@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <_set_usage@plt>
mov    %ebx,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <_set_do@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1070 <_set_unset@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"o\00"
@optind = global i32 0
@.str.1 = [3 x i8] c"--\00"
define i32 @builtin_set(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @_getopt_reset(i32 %7, i8** %8)
br label %10
10: ; preds = %20, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %6
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = load i32, i32* %6
switch i32 %16, label %18 [
i32 111, label %17
]
17: ; preds = %15
br label %20
18: ; preds = %15
%19 = call i32 (...) @_set_usage()
store i32 %19, i32* %3
br label %45
20: ; preds = %17
br label %10
21: ; preds = %10
%22 = load i32, i32* %4
%23 = load i32, i32* @optind
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %41
25: ; preds = %21
%26 = load i32, i32* @optind
%27 = icmp sgt i32 %26, 1
br i1 %27, label %28, label %39
28: ; preds = %25
%29 = load i8**, i8*** %5
%30 = load i32, i32* @optind
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %29, i64 %32
%34 = load i8*, i8** %33
%35 = call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %28
%38 = call i32 (...) @_set_unset()
store i32 %38, i32* %3
br label %45
39: ; preds = %28, %25
%40 = call i32 (...) @_set_list()
store i32 %40, i32* %3
br label %45
41: ; preds = %21
%42 = load i32, i32* %4
%43 = load i8**, i8*** %5
%44 = call i32 @_set_do(i32 %42, i8** %43)
store i32 %44, i32* %3
br label %45
45: ; preds = %41, %39, %37, %18
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.str = [2 x i8] c"o\00"
@optind = global i32 0
@.str.1 = [3 x i8] c"--\00"
define i32 @builtin_set(i32 %0, i8** %1) {
%3 = tail call i32 @_getopt_reset(i32 %0, i8** %1)
br label %4
4: ; preds = %4, %2
%5 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
switch i32 %5, label %6 [
i32 -1, label %8
i32 111, label %4
]
6: ; preds = %4
%7 = tail call i32 (...) @_set_usage()
br label %26
8: ; preds = %4
%9 = load i32, i32* @optind
%10 = icmp eq i32 %9, %0
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = icmp sgt i32 %0, 1
br i1 %12, label %13, label %22
13: ; preds = %11
%14 = add nsw i32 %0, -1
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = tail call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = tail call i32 (...) @_set_unset()
br label %26
22: ; preds = %13, %11
%23 = tail call i32 (...) @_set_list()
br label %26
24: ; preds = %8
%25 = tail call i32 @_set_do(i32 %0, i8** %1)
br label %26
26: ; preds = %24, %22, %20, %6
%27 = phi i32 [ %7, %6 ], [ %21, %20 ], [ %23, %22 ], [ %25, %24 ]
ret i32 %27
}