#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 {
  char *member_0;
  int member_1;
  char member_3;
  int /*<<< orphan*/ *member_2;
};

/* Variables and functions */
scalar_t__ EXIT_FAILURE;
scalar_t__ EXIT_SUCCESS;
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ exit(scalar_t__);
int getopt_long(int, char **, char *, struct option *, int /*<<< orphan*/ *);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ show_help();
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int /*<<< orphan*/ systemcore_get_instance();
scalar_t__ systemcore_init(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int opt = 0;
  int number = 5;
  char text[256] = "Carsten";
  struct option longopts[] = {{"help", 0, NULL, 'h'},
                              {"number", 1, NULL, 'n'},
                              {"text", 1, NULL, 't'},
                              {0, 0, 0, 0}};
  while ((opt = getopt_long(argc, argv, "hn:s:", longopts, NULL)) != -1) {
    switch (opt) {
    case 'h':
      show_help();
      exit(EXIT_SUCCESS);
      break;
    case 'n':
      number = atoi(optarg);
      if (number < 0 || number > 10) {
        printf("%s: Number out of range -- (0 ... 10).", argv[0]);
        show_help();
        exit(EXIT_FAILURE);
      }
      break;
    case 's':
      strcpy(text, optarg);
      break;
    case '?':
      show_help();
      break;
    default:
      show_help();
      exit(EXIT_FAILURE);
      break;
    }
  }
  if (systemcore_init(systemcore_get_instance()) == EXIT_SUCCESS) {
    printf("Number: %d.\n", number);
    printf("Text: %s.\n", text);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
lea    0xe3b(%rip),%rsi
mov    $0x100,%edx
call   1070 <memcpy@plt>
lea    -0x180(%rbp),%rdi
lea    0x2bc3(%rip),%rsi
mov    $0x60,%edx
call   1070 <memcpy@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x180(%rbp),%rcx
lea    0xf15(%rip),%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1050 <getopt_long@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1311 <main+0x181>
mov    -0x14(%rbp),%eax
mov    %eax,-0x184(%rbp)
sub    $0x3f,%eax
je     12ea <main+0x15a>
jmp    1229 <main+0x99>
mov    -0x184(%rbp),%eax
sub    $0x68,%eax
je     1265 <main+0xd5>
jmp    123d <main+0xad>
mov    -0x184(%rbp),%eax
sub    $0x6e,%eax
je     127b <main+0xeb>
jmp    1251 <main+0xc1>
mov    -0x184(%rbp),%eax
sub    $0x73,%eax
je     12d0 <main+0x140>
jmp    12f6 <main+0x166>
mov    $0x0,%al
call   1080 <show_help@plt>
mov    0x2d55(%rip),%rax
mov    (%rax),%rdi
call   10b0 <exit@plt>
mov    0x2d6e(%rip),%rax
mov    (%rax),%edi
call   10a0 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     12a0 <main+0x110>
cmpl   $0xa,-0x18(%rbp)
jle    12cb <main+0x13b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1080 <show_help@plt>
mov    0x2d0d(%rip),%rax
mov    (%rax),%rdi
call   10b0 <exit@plt>
jmp    130c <main+0x17c>
lea    -0x120(%rbp),%rdi
mov    0x2d12(%rip),%rax
mov    (%rax),%esi
call   1040 <strcpy@plt>
jmp    130c <main+0x17c>
mov    $0x0,%al
call   1080 <show_help@plt>
jmp    130c <main+0x17c>
mov    $0x0,%al
call   1080 <show_help@plt>
mov    0x2ccc(%rip),%rax
mov    (%rax),%rdi
call   10b0 <exit@plt>
jmp    11e7 <main+0x57>
mov    $0x0,%al
call   1090 <systemcore_get_instance@plt>
mov    %eax,%edi
call   1030 <systemcore_init@plt>
mov    0x2ca2(%rip),%rcx
cmp    (%rcx),%rax
jne    1355 <main+0x1c5>
mov    -0x18(%rbp),%esi
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2c6c(%rip),%rax
mov    (%rax),%rdi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x178,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe53(%rip),%rsi
lea    0x70(%rsp),%r15
mov    $0x100,%edx
mov    %r15,%rdi
call   1070 <memcpy@plt>
movaps 0x2c2a(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0x2c0e(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2bf2(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2bd6(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2bba(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0x2b9e(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    $0x5,%eax
lea    0xefe(%rip),%r12
lea    0x10(%rsp),%r13
mov    0x2dd1(%rip),%r14
nop
mov    %eax,0xc(%rsp)
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %r8d,%r8d
call   1050 <getopt_long@plt>
cmp    $0x6d,%eax
jle    1260 <main+0xd0>
cmp    $0x73,%eax
jne    1270 <main+0xe0>
mov    (%r14),%esi
mov    %r15,%rdi
call   1040 <strcpy@plt>
jmp    1230 <main+0xa0>
nopw   0x0(%rax,%rax,1)
cmp    $0x3f,%eax
jne    1295 <main+0x105>
xor    %eax,%eax
call   1080 <show_help@plt>
jmp    1230 <main+0xa0>
xchg   %ax,%ax
cmp    $0x6e,%eax
jne    12b5 <main+0x125>
mov    (%r14),%edi
call   10a0 <atoi@plt>
cmp    $0xb,%eax
jb     1220 <main+0x90>
mov    (%rbx),%rsi
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12b5 <main+0x125>
cmp    $0xffffffff,%eax
je     12cb <main+0x13b>
cmp    $0x68,%eax
jne    12b5 <main+0x125>
xor    %eax,%eax
call   1080 <show_help@plt>
mov    0x2d1b(%rip),%rax
mov    (%rax),%rdi
call   10b0 <exit@plt>
xor    %eax,%eax
call   1080 <show_help@plt>
mov    0x2d0d(%rip),%rax
mov    (%rax),%rdi
call   10b0 <exit@plt>
xor    %eax,%eax
call   1090 <systemcore_get_instance@plt>
mov    %eax,%edi
call   1030 <systemcore_init@plt>
mov    0x2ce8(%rip),%rbx
mov    (%rbx),%rdi
cmp    %rdi,%rax
jne    1310 <main+0x180>
lea    0xe4f(%rip),%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe4a(%rip),%rdi
lea    0x70(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rbx),%rdi
call   10b0 <exit@plt>

LLVM IR (-O0):
%struct.option = type { i8*, i32, i8, i32* }
@__const.main.text = [256 x i8] c"Carsten\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [5 x i8] c"help\00"
@.str.1 = [7 x i8] c"number\00"
@.str.2 = [5 x i8] c"text\00"
@__const.main.longopts = [4 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 104 to i32*) }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 110 to i32*) }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 116 to i32*) }, %struct.option zeroinitializer]
@.str.3 = [6 x i8] c"hn:s:\00"
@EXIT_SUCCESS = global i64 0
@optarg = global i32 0
@.str.4 = [39 x i8] c"%s: Number out of range -- (0 ... 10).\00"
@EXIT_FAILURE = global i64 0
@.str.5 = [13 x i8] c"Number: %d.\0A\00"
@.str.6 = [11 x i8] c"Text: %s.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [256 x i8]
%9 = alloca [4 x %struct.option]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 5, i32* %7
%10 = bitcast [256 x i8]* %8 to i8*
%11 = bitcast [4 x %struct.option]* %9 to i8*
br label %12
12: ; preds = %51, %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %9, i64 0, i64 0
%16 = call i32 @getopt_long(i32 %13, i8** %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %struct.option* %15, i32* null)
store i32 %16, i32* %6
%17 = icmp ne i32 %16, -1
br i1 %17, label %18, label %52
18: ; preds = %12
%19 = load i32, i32* %6
switch i32 %19, label %47 [
i32 104, label %20
i32 110, label %24
i32 115, label %41
i32 63, label %45
]
20: ; preds = %18
%21 = call i32 (...) @show_help()
%22 = load i64, i64* @EXIT_SUCCESS
%23 = call i32 @exit(i64 %22)
unreachable
24: ; preds = %18
%25 = load i32, i32* @optarg
%26 = call i32 @atoi(i32 %25)
store i32 %26, i32* %7
%27 = load i32, i32* %7
%28 = icmp slt i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %24
%30 = load i32, i32* %7
%31 = icmp sgt i32 %30, 10
br i1 %31, label %32, label %40
32: ; preds = %29, %24
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 0
%35 = load i8*, i8** %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* %35)
%37 = call i32 (...) @show_help()
%38 = load i64, i64* @EXIT_FAILURE
%39 = call i32 @exit(i64 %38)
unreachable
40: ; preds = %29
br label %51
41: ; preds = %18
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%43 = load i32, i32* @optarg
%44 = call i32 @strcpy(i8* %42, i32 %43)
br label %51
45: ; preds = %18
%46 = call i32 (...) @show_help()
br label %51
47: ; preds = %18
%48 = call i32 (...) @show_help()
%49 = load i64, i64* @EXIT_FAILURE
%50 = call i32 @exit(i64 %49)
unreachable
51: ; preds = %45, %41, %40
br label %12
52: ; preds = %12
%53 = call i32 (...) @systemcore_get_instance()
%54 = call i64 @systemcore_init(i32 %53)
%55 = load i64, i64* @EXIT_SUCCESS
%56 = icmp eq i64 %54, %55
br i1 %56, label %57, label %62
57: ; preds = %52
%58 = load i32, i32* %7
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %58)
%60 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %60)
br label %62
62: ; preds = %57, %52
%63 = load i64, i64* @EXIT_SUCCESS
%64 = call i32 @exit(i64 %63)
unreachable
}

LLVM IR (-O2):
%struct.option = type { i8*, i32, i8, i32* }
@__const.main.text = [256 x i8] c"Carsten\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [5 x i8] c"help\00"
@.str.1 = [7 x i8] c"number\00"
@.str.2 = [5 x i8] c"text\00"
@__const.main.longopts = [4 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i32 0, i8 0, i32* inttoptr (i64 104 to i32*) }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 110 to i32*) }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i32 1, i8 0, i32* inttoptr (i64 116 to i32*) }, %struct.option zeroinitializer]
@.str.3 = [6 x i8] c"hn:s:\00"
@EXIT_SUCCESS = global i64 0
@optarg = global i32 0
@.str.4 = [39 x i8] c"%s: Number out of range -- (0 ... 10).\00"
@EXIT_FAILURE = global i64 0
@.str.5 = [13 x i8] c"Number: %d.\0A\00"
@.str.6 = [11 x i8] c"Text: %s.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [256 x i8]
%4 = alloca [4 x %struct.option]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%6 = bitcast [4 x %struct.option]* %4 to i8*
%7 = getelementptr inbounds [4 x %struct.option], [4 x %struct.option]* %4, i64 0, i64 0
br label %8
8: ; preds = %16, %2
%9 = phi i32 [ %18, %16 ], [ 5, %2 ]
br label %10
10: ; preds = %31, %8
%11 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), %struct.option* %7, i32* null)
switch i32 %11, label %32 [
i32 -1, label %36
i32 104, label %12
i32 110, label %16
i32 115, label %26
i32 63, label %29
]
12: ; preds = %10
%13 = call i32 (...) @show_help()
%14 = load i64, i64* @EXIT_SUCCESS
%15 = call i32 @exit(i64 %14)
unreachable
16: ; preds = %10
%17 = load i32, i32* @optarg
%18 = call i32 @atoi(i32 %17)
%19 = icmp ugt i32 %18, 10
br i1 %19, label %20, label %8
20: ; preds = %16
%21 = load i8*, i8** %1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* %21)
%23 = call i32 (...) @show_help()
%24 = load i64, i64* @EXIT_FAILURE
%25 = call i32 @exit(i64 %24)
unreachable
26: ; preds = %10
%27 = load i32, i32* @optarg
%28 = call i32 @strcpy(i8* %5, i32 %27)
br label %31
29: ; preds = %10
%30 = call i32 (...) @show_help()
br label %31
31: ; preds = %29, %26
br label %10
32: ; preds = %10
%33 = call i32 (...) @show_help()
%34 = load i64, i64* @EXIT_FAILURE
%35 = call i32 @exit(i64 %34)
unreachable
36: ; preds = %10
%37 = call i32 (...) @systemcore_get_instance()
%38 = call i64 @systemcore_init(i32 %37)
%39 = load i64, i64* @EXIT_SUCCESS
%40 = icmp eq i64 %38, %39
br i1 %40, label %41, label %45
41: ; preds = %36
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i32 %9)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8* %5)
%44 = load i64, i64* @EXIT_SUCCESS
br label %45
45: ; preds = %41, %36
%46 = phi i64 [ %44, %41 ], [ %39, %36 ]
%47 = call i32 @exit(i64 %46)
unreachable
}