#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 */
struct option {
  scalar_t__ flag;
  int val;
  int has_arg;
  int /*<<< orphan*/ *name;
};
typedef int /*<<< orphan*/ optstring;

/* Variables and functions */
int /*<<< orphan*/ abort();
#define optional_argument 129
#define required_argument 128
const char *optstring_from_long_options(const struct option *opt) {
  static char optstring[256] = {0};
  char *osp = optstring;
  for (; opt->name != NULL; opt++) {
    if (opt->flag == 0 && opt->val > 0 && opt->val < 256) {
      *osp++ = opt->val;
      switch (opt->has_arg) {
      case optional_argument:
        *osp++ = ':';
        *osp++ = ':';
        break;
      case required_argument:
        *osp++ = ':';
        break;
      }
    }
  }
  *osp++ = '\0';
  if (osp - optstring >= (int)sizeof(optstring)) {
    abort();
  }
  return optstring;
}


x86 assembly (clang, -O0):
<optstring_from_long_options>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0x2f1d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,0x10(%rax)
je     11fe <optstring_from_long_options+0xee>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
jne    11e8 <optstring_from_long_options+0xd8>
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x8(%rax)
jle    11e8 <optstring_from_long_options+0xd8>
mov    -0x8(%rbp),%rax
cmpl   $0x100,0x8(%rax)
jge    11e8 <optstring_from_long_options+0xd8>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x80,%eax
je     11d1 <optstring_from_long_options+0xc1>
jmp    1195 <optstring_from_long_options+0x85>
mov    -0x14(%rbp),%eax
sub    $0x81,%eax
jne    11e3 <optstring_from_long_options+0xd3>
jmp    11a8 <optstring_from_long_options+0x98>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x3a,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x3a,(%rax)
jmp    11e3 <optstring_from_long_options+0xd3>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x3a,(%rax)
jmp    11e8 <optstring_from_long_options+0xd8>
jmp    11ed <optstring_from_long_options+0xdd>
mov    -0x8(%rbp),%rax
add    $0x18,%rax
mov    %rax,-0x8(%rbp)
jmp    1127 <optstring_from_long_options+0x17>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
lea    0x2e25(%rip),%rcx
sub    %rcx,%rax
cmp    $0x100,%rax
jl     1231 <optstring_from_long_options+0x121>
mov    $0x0,%al
call   1030 <abort@plt>
lea    0x2e08(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<optstring_from_long_options>:
push   %rax
lea    0x2f28(%rip),%rax
cmpq   $0x0,0x10(%rdi)
mov    %rax,%rdx
je     1191 <optstring_from_long_options+0x81>
add    $0xc,%rdi
lea    0x2f13(%rip),%rcx
nopl   (%rax)
cmpq   $0x0,-0xc(%rdi)
jne    1180 <optstring_from_long_options+0x70>
mov    -0x4(%rdi),%esi
lea    -0x1(%rsi),%edx
cmp    $0xfe,%edx
ja     1180 <optstring_from_long_options+0x70>
lea    0x1(%rcx),%rdx
mov    %sil,(%rcx)
mov    (%rdi),%esi
cmp    $0x80,%esi
je     116d <optstring_from_long_options+0x5d>
cmp    $0x81,%esi
jne    1183 <optstring_from_long_options+0x73>
lea    0x2(%rcx),%rdx
movb   $0x3a,0x1(%rcx)
mov    $0x3,%esi
jmp    1172 <optstring_from_long_options+0x62>
mov    $0x2,%esi
add    %rsi,%rcx
movb   $0x3a,(%rdx)
nopl   0x0(%rax,%rax,1)
mov    %rcx,%rdx
cmpq   $0x0,0x1c(%rdi)
lea    0x18(%rdi),%rdi
mov    %rdx,%rcx
jne    1130 <optstring_from_long_options+0x20>
movb   $0x0,(%rdx)
neg    %rax
add    %rdx,%rax
add    $0x1,%rax
cmp    $0x100,%rax
jge    11af <optstring_from_long_options+0x9f>
lea    0x2e93(%rip),%rax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
%struct.option = type { i64, i32, i32, i32* }
@optstring_from_long_options.optstring = internal global [256 x i8] zeroinitializer
define i8* @optstring_from_long_options(%struct.option* %0) {
%2 = alloca %struct.option*
%3 = alloca i8*
store %struct.option* %0, %struct.option** %2
store i8* getelementptr inbounds ([256 x i8], [256 x i8]* @optstring_from_long_options.optstring, i64 0, i64 0), i8** %3
br label %4
4: ; preds = %44, %1
%5 = load %struct.option*, %struct.option** %2
%6 = getelementptr inbounds %struct.option, %struct.option* %5, i32 0, i32 3
%7 = load i32*, i32** %6
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %47
9: ; preds = %4
%10 = load %struct.option*, %struct.option** %2
%11 = getelementptr inbounds %struct.option, %struct.option* %10, i32 0, i32 0
%12 = load i64, i64* %11
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %43
14: ; preds = %9
%15 = load %struct.option*, %struct.option** %2
%16 = getelementptr inbounds %struct.option, %struct.option* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %43
19: ; preds = %14
%20 = load %struct.option*, %struct.option** %2
%21 = getelementptr inbounds %struct.option, %struct.option* %20, i32 0, i32 1
%22 = load i32, i32* %21
%23 = icmp slt i32 %22, 256
br i1 %23, label %24, label %43
24: ; preds = %19
%25 = load %struct.option*, %struct.option** %2
%26 = getelementptr inbounds %struct.option, %struct.option* %25, i32 0, i32 1
%27 = load i32, i32* %26
%28 = trunc i32 %27 to i8
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
store i8 %28, i8* %29
%31 = load %struct.option*, %struct.option** %2
%32 = getelementptr inbounds %struct.option, %struct.option* %31, i32 0, i32 2
%33 = load i32, i32* %32
switch i32 %33, label %42 [
i32 129, label %34
i32 128, label %39
]
34: ; preds = %24
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %3
store i8 58, i8* %35
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %3
store i8 58, i8* %37
br label %42
39: ; preds = %24
%40 = load i8*, i8** %3
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %3
store i8 58, i8* %40
br label %42
42: ; preds = %24, %39, %34
br label %43
43: ; preds = %42, %19, %14, %9
br label %44
44: ; preds = %43
%45 = load %struct.option*, %struct.option** %2
%46 = getelementptr inbounds %struct.option, %struct.option* %45, i32 1
store %struct.option* %46, %struct.option** %2
br label %4
47: ; preds = %4
%48 = load i8*, i8** %3
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %3
store i8 0, i8* %48
%50 = load i8*, i8** %3
%51 = ptrtoint i8* %50 to i64
%52 = sub i64 %51, ptrtoint ([256 x i8]* @optstring_from_long_options.optstring to i64)
%53 = icmp sge i64 %52, 256
br i1 %53, label %54, label %56
54: ; preds = %47
%55 = call i32 (...) @abort()
unreachable
56: ; preds = %47
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @optstring_from_long_options.optstring, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.option = type { i64, i32, i32, i32* }
@optstring_from_long_options.optstring = internal global [256 x i8] zeroinitializer
define i8* @optstring_from_long_options(%struct.option* nocapture %0) {
%2 = getelementptr inbounds %struct.option, %struct.option* %0, i64 0, i32 3
%3 = load i32*, i32** %2
%4 = icmp eq i32* %3, null
br i1 %4, label %33, label %5
5: ; preds = %1, %27
%6 = phi i8* [ %28, %27 ], [ getelementptr inbounds ([256 x i8], [256 x i8]* @optstring_from_long_options.optstring, i64 0, i64 0), %1 ]
%7 = phi %struct.option* [ %29, %27 ], [ %0, %1 ]
%8 = getelementptr inbounds %struct.option, %struct.option* %7, i64 0, i32 0
%9 = load i64, i64* %8
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %5
%12 = getelementptr inbounds %struct.option, %struct.option* %7, i64 0, i32 1
%13 = load i32, i32* %12
%14 = add i32 %13, -1
%15 = icmp ult i32 %14, 255
br i1 %15, label %16, label %27
16: ; preds = %11
%17 = trunc i32 %13 to i8
%18 = getelementptr inbounds i8, i8* %6, i64 1
store i8 %17, i8* %6
%19 = getelementptr inbounds %struct.option, %struct.option* %7, i64 0, i32 2
%20 = load i32, i32* %19
switch i32 %20, label %27 [
i32 129, label %21
i32 128, label %23
]
21: ; preds = %16
%22 = getelementptr inbounds i8, i8* %6, i64 2
store i8 58, i8* %18
br label %23
23: ; preds = %16, %21
%24 = phi i64 [ 3, %21 ], [ 2, %16 ]
%25 = phi i8* [ %22, %21 ], [ %18, %16 ]
%26 = getelementptr inbounds i8, i8* %6, i64 %24
store i8 58, i8* %25
br label %27
27: ; preds = %23, %5, %11, %16
%28 = phi i8* [ %18, %16 ], [ %6, %11 ], [ %6, %5 ], [ %26, %23 ]
%29 = getelementptr inbounds %struct.option, %struct.option* %7, i64 1
%30 = getelementptr inbounds %struct.option, %struct.option* %7, i64 1, i32 3
%31 = load i32*, i32** %30
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %5
33: ; preds = %27, %1
%34 = phi i8* [ getelementptr inbounds ([256 x i8], [256 x i8]* @optstring_from_long_options.optstring, i64 0, i64 0), %1 ], [ %28, %27 ]
%35 = getelementptr inbounds i8, i8* %34, i64 1
store i8 0, i8* %34
%36 = ptrtoint i8* %35 to i64
%37 = sub i64 %36, ptrtoint ([256 x i8]* @optstring_from_long_options.optstring to i64)
%38 = icmp sgt i64 %37, 255
br i1 %38, label %39, label %41
39: ; preds = %33
%40 = tail call i32 (...) @abort()
unreachable
41: ; preds = %33
ret i8* getelementptr inbounds ([256 x i8], [256 x i8]* @optstring_from_long_options.optstring, i64 0, i64 0)
}