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

/* Variables and functions */
int getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ input_binary(char *);
int /*<<< orphan*/ optarg;
scalar_t__ opterr;
int optind;
#define required_argument 128
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int input_check_restart(int argc, char **argv) {
  char filename[1024];
  int restart = 0;
  opterr = 0;
  optind = 1;
  while (1) {
    static struct option long_options[] = {
        {"restart", required_argument, 0, 'r'}, {0, 0, 0, 0}};
    int option_index = 0;
    int c = getopt_long(argc, argv, "", long_options, &option_index);
    if (c == -1)
      break;
    switch (c) {
    case 'r':
      restart = 1;
      strcpy(filename, optarg);
      break;
    default:
      break;
    }
  }
  if (restart == 1) {
    input_binary(filename);
  }
  return restart;
}


x86 assembly (clang, -O0):
<input_check_restart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x414(%rbp)
mov    0x2e7d(%rip),%rax
movq   $0x0,(%rax)
mov    0x2e7f(%rip),%rax
movl   $0x1,(%rax)
movl   $0x0,-0x418(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe88(%rip),%rdx
lea    0x2eba(%rip),%rcx
lea    -0x418(%rbp),%r8
call   1040 <getopt_long@plt>
mov    %eax,-0x41c(%rbp)
cmpl   $0xffffffff,-0x41c(%rbp)
jne    11aa <input_check_restart+0x7a>
jmp    11ec <input_check_restart+0xbc>
mov    -0x41c(%rbp),%eax
sub    $0x72,%eax
jne    11e2 <input_check_restart+0xb2>
jmp    11be <input_check_restart+0x8e>
movl   $0x1,-0x414(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2e22(%rip),%rax
mov    (%rax),%esi
call   1030 <strcpy@plt>
jmp    11e7 <input_check_restart+0xb7>
jmp    11e7 <input_check_restart+0xb7>
jmp    1167 <input_check_restart+0x37>
cmpl   $0x1,-0x414(%rbp)
jne    1205 <input_check_restart+0xd5>
lea    -0x410(%rbp),%rdi
call   1050 <input_binary@plt>
mov    -0x414(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_check_restart>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e83(%rip),%rax
movq   $0x0,(%rax)
mov    0x2e85(%rip),%rax
movl   $0x1,(%rax)
xor    %r14d,%r14d
lea    0xe9c(%rip),%r15
lea    0x2ece(%rip),%r12
lea    0xc(%rsp),%r13
jmp    1199 <input_check_restart+0x69>
nopl   0x0(%rax)
mov    0x2e71(%rip),%rax
mov    (%rax),%esi
lea    0x10(%rsp),%rdi
call   1030 <strcpy@plt>
mov    $0x1,%r14d
movl   $0x0,0xc(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1040 <getopt_long@plt>
cmp    $0x72,%eax
je     1180 <input_check_restart+0x50>
cmp    $0xffffffff,%eax
jne    1199 <input_check_restart+0x69>
cmp    $0x1,%r14d
jne    11ce <input_check_restart+0x9e>
lea    0x10(%rsp),%rdi
call   1050 <input_binary@plt>
mov    %r14d,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@opterr = global i64 0
@optind = global i32 0
@input_check_restart.long_options = internal global [2 x %struct.option] [%struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8 -128, i32 0, i32 114 }, %struct.option zeroinitializer]
@.str = [8 x i8] c"restart\00"
@.str.1 = [1 x i8] zeroinitializer
@optarg = global i32 0
define i32 @input_check_restart(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [1024 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %6
store i64 0, i64* @opterr
store i32 1, i32* @optind
br label %9
9: ; preds = %2, %23
store i32 0, i32* %7
%10 = load i32, i32* %3
%11 = load i8**, i8*** %4
%12 = call i32 @getopt_long(i32 %10, i8** %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([2 x %struct.option], [2 x %struct.option]* @input_check_restart.long_options, i64 0, i64 0), i32* %7)
store i32 %12, i32* %8
%13 = load i32, i32* %8
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %16
15: ; preds = %9
br label %24
16: ; preds = %9
%17 = load i32, i32* %8
switch i32 %17, label %22 [
i32 114, label %18
]
18: ; preds = %16
store i32 1, i32* %6
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%20 = load i32, i32* @optarg
%21 = call i32 @strcpy(i8* %19, i32 %20)
br label %23
22: ; preds = %16
br label %23
23: ; preds = %22, %18
br label %9
24: ; preds = %15
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%29 = call i32 @input_binary(i8* %28)
br label %30
30: ; preds = %27, %24
%31 = load i32, i32* %6
ret i32 %31
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@opterr = global i64 0
@optind = global i32 0
@input_check_restart.long_options = internal global [2 x %struct.option] [%struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8 -128, i32 0, i32 114 }, %struct.option zeroinitializer]
@.str = [8 x i8] c"restart\00"
@.str.1 = [1 x i8] zeroinitializer
@optarg = global i32 0
define i32 @input_check_restart(i32 %0, i8** %1) {
%3 = alloca [1024 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
store i64 0, i64* @opterr
store i32 1, i32* @optind
%6 = bitcast i32* %4 to i8*
br label %7
7: ; preds = %13, %2
%8 = phi i32 [ 0, %2 ], [ %14, %13 ]
store i32 0, i32* %4
%9 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %struct.option* getelementptr inbounds ([2 x %struct.option], [2 x %struct.option]* @input_check_restart.long_options, i64 0, i64 0), i32* %4)
switch i32 %9, label %13 [
i32 -1, label %15
i32 114, label %10
]
10: ; preds = %7
%11 = load i32, i32* @optarg
%12 = call i32 @strcpy(i8* %5, i32 %11)
br label %13
13: ; preds = %10, %7
%14 = phi i32 [ 1, %10 ], [ %8, %7 ]
br label %7
15: ; preds = %7
%16 = icmp eq i32 %8, 1
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = call i32 @input_binary(i8* %5)
br label %19
19: ; preds = %17, %15
ret i32 %8
}