#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*/ EINVAL;
int /*<<< orphan*/ errno;
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int optind;
int parse_ui(char *, unsigned int *);
int parse_ul(int /*<<< orphan*/, unsigned long *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ print_help(int);
int reconfigure(unsigned int, unsigned long);
int handle_reconfigure(int argc, char **argv) {
  int ret, c;
  unsigned int minor;
  unsigned long cache_size = 0;
  while ((c = getopt(argc, argv, "c:")) != -1) {
    switch (c) {
    case 'c':
      ret = parse_ul(optarg, &cache_size);
      if (ret)
        goto handle_reconfigure_error;
      break;
    default:
      errno = EINVAL;
      goto handle_reconfigure_error;
    }
  }
  if (argc - optind != 1) {
    errno = EINVAL;
    goto handle_reconfigure_error;
  }
  ret = parse_ui(argv[optind], &minor);
  if (ret)
    goto handle_reconfigure_error;
  return reconfigure(minor, cache_size);
handle_reconfigure_error:
  perror("error interpreting reconfigure parameters");
  print_help(-1);
  return 0;
}


x86 assembly (clang, -O0):
<handle_reconfigure>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe7b(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
je     11ec <handle_reconfigure+0x8c>
mov    -0x18(%rbp),%eax
sub    $0x63,%eax
jne    11d0 <handle_reconfigure+0x70>
jmp    11a7 <handle_reconfigure+0x47>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1050 <parse_ul@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11cb <handle_reconfigure+0x6b>
jmp    1259 <handle_reconfigure+0xf9>
jmp    11e7 <handle_reconfigure+0x87>
mov    0x2df1(%rip),%rax
mov    (%rax),%ecx
mov    0x2df0(%rip),%rax
mov    %ecx,(%rax)
jmp    1259 <handle_reconfigure+0xf9>
jmp    1177 <handle_reconfigure+0x17>
mov    -0x8(%rbp),%eax
mov    0x2dea(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x1,%eax
je     1218 <handle_reconfigure+0xb8>
mov    0x2dc0(%rip),%rax
mov    (%rax),%ecx
mov    0x2dbf(%rip),%rax
mov    %ecx,(%rax)
jmp    1259 <handle_reconfigure+0xf9>
mov    -0x10(%rbp),%rax
mov    0x2dbd(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <parse_ui@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1245 <handle_reconfigure+0xe5>
jmp    1259 <handle_reconfigure+0xf9>
mov    -0x1c(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1040 <reconfigure@plt>
mov    %eax,-0x4(%rbp)
jmp    1276 <handle_reconfigure+0x116>
lea    0xda3(%rip),%rdi
call   1060 <perror@plt>
mov    $0xffffffff,%edi
call   1080 <print_help@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_reconfigure>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
movq   $0x0,0x8(%rsp)
lea    0xe7f(%rip),%r14
mov    0x2e70(%rip),%r12
lea    0x8(%rsp),%r15
nopl   (%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1070 <getopt@plt>
cmp    $0x63,%eax
jne    11b4 <handle_reconfigure+0x54>
mov    (%r12),%edi
mov    %r15,%rsi
call   1050 <parse_ul@plt>
test   %eax,%eax
je     1190 <handle_reconfigure+0x30>
jmp    11fe <handle_reconfigure+0x9e>
cmp    $0xffffffff,%eax
jne    11ec <handle_reconfigure+0x8c>
mov    0x2e20(%rip),%rax
movslq (%rax),%rax
sub    %eax,%ebp
cmp    $0x1,%ebp
jne    11ec <handle_reconfigure+0x8c>
mov    (%rbx,%rax,8),%rdi
lea    0x4(%rsp),%rsi
call   1030 <parse_ui@plt>
test   %eax,%eax
jne    11fe <handle_reconfigure+0x9e>
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%rsi
call   1040 <reconfigure@plt>
jmp    1216 <handle_reconfigure+0xb6>
mov    0x2dd5(%rip),%rax
mov    (%rax),%eax
mov    0x2dd4(%rip),%rcx
mov    %eax,(%rcx)
lea    0xdfe(%rip),%rdi
call   1060 <perror@plt>
mov    $0xffffffff,%edi
call   1080 <print_help@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"c:\00"
@optarg = global i32 0
@EINVAL = global i32 0
@errno = global i32 0
@optind = global i32 0
@.str.1 = [42 x i8] c"error interpreting reconfigure parameters\00"
define i32 @handle_reconfigure(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %9
br label %10
10: ; preds = %26, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %7
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %27
15: ; preds = %10
%16 = load i32, i32* %7
switch i32 %16, label %24 [
i32 99, label %17
]
17: ; preds = %15
%18 = load i32, i32* @optarg
%19 = call i32 @parse_ul(i32 %18, i64* %9)
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
br label %48
23: ; preds = %17
br label %26
24: ; preds = %15
%25 = load i32, i32* @EINVAL
store i32 %25, i32* @errno
br label %48
26: ; preds = %23
br label %10
27: ; preds = %10
%28 = load i32, i32* %4
%29 = load i32, i32* @optind
%30 = sub nsw i32 %28, %29
%31 = icmp ne i32 %30, 1
br i1 %31, label %32, label %34
32: ; preds = %27
%33 = load i32, i32* @EINVAL
store i32 %33, i32* @errno
br label %48
34: ; preds = %27
%35 = load i8**, i8*** %5
%36 = load i32, i32* @optind
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %35, i64 %37
%39 = load i8*, i8** %38
%40 = call i32 @parse_ui(i8* %39, i32* %8)
store i32 %40, i32* %6
%41 = load i32, i32* %6
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %34
br label %48
44: ; preds = %34
%45 = load i32, i32* %8
%46 = load i64, i64* %9
%47 = call i32 @reconfigure(i32 %45, i64 %46)
store i32 %47, i32* %3
br label %51
48: ; preds = %43, %32, %24, %22
%49 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%50 = call i32 @print_help(i32 -1)
store i32 0, i32* %3
br label %51
51: ; preds = %48, %44
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str = [3 x i8] c"c:\00"
@optarg = global i32 0
@EINVAL = global i32 0
@errno = global i32 0
@optind = global i32 0
@.str.1 = [42 x i8] c"error interpreting reconfigure parameters\00"
define i32 @handle_reconfigure(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i64
%5 = bitcast i32* %3 to i8*
%6 = bitcast i64* %4 to i8*
store i64 0, i64* %4
br label %7
7: ; preds = %9, %2
%8 = call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %8, label %27 [
i32 -1, label %13
i32 99, label %9
]
9: ; preds = %7
%10 = load i32, i32* @optarg
%11 = call i32 @parse_ul(i32 %10, i64* %4)
%12 = icmp eq i32 %11, 0
br i1 %12, label %7, label %29
13: ; preds = %7
%14 = load i32, i32* @optind
%15 = sub nsw i32 %0, %14
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = sext i32 %14 to i64
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
%21 = call i32 @parse_ui(i8* %20, i32* %3)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %17
%24 = load i32, i32* %3
%25 = load i64, i64* %4
%26 = call i32 @reconfigure(i32 %24, i64 %25)
br label %32
27: ; preds = %7, %13
%28 = load i32, i32* @EINVAL
store i32 %28, i32* @errno
br label %29
29: ; preds = %9, %27, %17
%30 = call i32 @perror(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @print_help(i32 -1)
br label %32
32: ; preds = %29, %23
%33 = phi i32 [ 0, %29 ], [ %26, %23 ]
ret i32 %33
}