#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*/ abort();
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ help();
int /*<<< orphan*/ isprint(char);
int /*<<< orphan*/ optarg;
scalar_t__ opterr;
char optopt;
int /*<<< orphan*/ stderr;
int parseinput(int argc, char **argv, int *m) {
  int c, itmp;
  opterr = 0;
  while ((c = getopt(argc, argv, "m:h")) != -1) {
    switch (c) {
    case 'h':
      help();
      break;
    case 'm':
      itmp = atoi(optarg);
      if (itmp > 0) {
        *m = itmp;
        fprintf(stderr, "# Bin size: %d\n", *m);
      } else
        fprintf(stderr, "# Invalid bin number: %d. Using %d instead\n", itmp,
                *m);
      break;
    case '?':
      if (optopt == 'n')
        fprintf(stderr, "Option -%c requires an argument.\n", optopt);
      else if (isprint(optopt))
        fprintf(stderr, "Unknown option `-%c'.\n", optopt);
      else
        fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt);
      abort();
    default:
      abort();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<parseinput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e4e(%rip),%rax
movq   $0x0,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe71(%rip),%rdx
call   1060 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     1303 <parseinput+0x1a3>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x3f,%eax
je     1253 <parseinput+0xf3>
jmp    11b4 <parseinput+0x54>
mov    -0x24(%rbp),%eax
sub    $0x68,%eax
je     11d6 <parseinput+0x76>
jmp    11c5 <parseinput+0x65>
mov    -0x24(%rbp),%eax
sub    $0x6d,%eax
je     11e2 <parseinput+0x82>
jmp    12f7 <parseinput+0x197>
mov    $0x0,%al
call   1070 <help@plt>
jmp    12fe <parseinput+0x19e>
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    122b <parseinput+0xcb>
mov    -0x20(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2dc3(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
lea    0xde8(%rip),%rsi
movsbl %al,%edx
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    124e <parseinput+0xee>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
lea    0xdd0(%rip),%rsi
movsbl %al,%edx
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12fe <parseinput+0x19e>
mov    0x2d86(%rip),%rax
movsbl (%rax),%eax
cmp    $0x6e,%eax
jne    128c <parseinput+0x12c>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
lea    0xdca(%rip),%rsi
mov    0x2d63(%rip),%rax
movsbl (%rax),%edx
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12f0 <parseinput+0x190>
mov    0x2d4d(%rip),%rax
movsbl (%rax),%edi
call   1050 <isprint@plt>
cmp    $0x0,%eax
je     12ca <parseinput+0x16a>
mov    0x2d25(%rip),%rax
mov    (%rax),%edi
lea    0xdae(%rip),%rsi
mov    0x2d25(%rip),%rax
movsbl (%rax),%edx
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12eb <parseinput+0x18b>
mov    0x2cff(%rip),%rax
mov    (%rax),%edi
lea    0xd9f(%rip),%rsi
mov    0x2cff(%rip),%rax
movsbl (%rax),%edx
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    12f0 <parseinput+0x190>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1181 <parseinput+0x21>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseinput>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e4e(%rip),%rax
movq   $0x0,(%rax)
lea    0xe78(%rip),%r15
mov    0x2e69(%rip),%r12
mov    0x2e3a(%rip),%r13
jmp    11b0 <parseinput+0x50>
mov    0x0(%r13),%edi
mov    (%r14),%ecx
movsbl %al,%edx
lea    0xe6b(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <getopt@plt>
cmp    $0x6c,%eax
jg     11d0 <parseinput+0x70>
cmp    $0x68,%eax
jne    1200 <parseinput+0xa0>
xor    %eax,%eax
call   1070 <help@plt>
jmp    11b0 <parseinput+0x50>
cmp    $0x6d,%eax
jne    125f <parseinput+0xff>
mov    (%r12),%edi
call   1080 <atoi@plt>
test   %eax,%eax
jle    1198 <parseinput+0x38>
mov    %eax,(%r14)
mov    0x0(%r13),%edi
movsbl %al,%edx
lea    0xe0d(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11b0 <parseinput+0x50>
cmp    $0xffffffff,%eax
jne    1216 <parseinput+0xb6>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x3f,%eax
jne    125f <parseinput+0xff>
mov    0x2dbe(%rip),%rbx
mov    (%rbx),%al
cmp    $0x6e,%al
jne    1233 <parseinput+0xd3>
lea    0xe11(%rip),%rsi
mov    $0x6e,%al
jmp    1251 <parseinput+0xf1>
movsbl %al,%edi
call   1050 <isprint@plt>
test   %eax,%eax
mov    (%rbx),%al
lea    0xe33(%rip),%rcx
lea    0xe15(%rip),%rsi
cmove  %rcx,%rsi
mov    0x0(%r13),%edi
movsbl %al,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@opterr = global i64 0
@.str = [4 x i8] c"m:h\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [16 x i8] c"# Bin size: %d\0A\00"
@.str.2 = [44 x i8] c"# Invalid bin number: %d. Using %d instead\0A\00"
@optopt = global i8 0
@.str.3 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@.str.4 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.5 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
define i32 @parseinput(i32 %0, i8** %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* %2, i32** %6
store i64 0, i64* @opterr
br label %9
9: ; preds = %64, %3
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 %12, i32* %7
%13 = icmp ne i32 %12, -1
br i1 %13, label %14, label %65
14: ; preds = %9
%15 = load i32, i32* %7
switch i32 %15, label %62 [
i32 104, label %16
i32 109, label %18
i32 63, label %39
]
16: ; preds = %14
%17 = call i32 (...) @help()
br label %64
18: ; preds = %14
%19 = load i32, i32* @optarg
%20 = call i32 @atoi(i32 %19)
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %18
%24 = load i32, i32* %8
%25 = load i32*, i32** %6
store i32 %24, i32* %25
%26 = load i32, i32* @stderr
%27 = load i32*, i32** %6
%28 = load i32, i32* %27
%29 = trunc i32 %28 to i8
%30 = call i32 (i32, i8*, i8, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8 signext %29)
br label %38
31: ; preds = %18
%32 = load i32, i32* @stderr
%33 = load i32, i32* %8
%34 = trunc i32 %33 to i8
%35 = load i32*, i32** %6
%36 = load i32, i32* %35
%37 = call i32 (i32, i8*, i8, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8 signext %34, i32 %36)
br label %38
38: ; preds = %31, %23
br label %64
39: ; preds = %14
%40 = load i8, i8* @optopt
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 110
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = load i32, i32* @stderr
%45 = load i8, i8* @optopt
%46 = call i32 (i32, i8*, i8, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8 signext %45)
br label %60
47: ; preds = %39
%48 = load i8, i8* @optopt
%49 = call i32 @isprint(i8 signext %48)
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %55
51: ; preds = %47
%52 = load i32, i32* @stderr
%53 = load i8, i8* @optopt
%54 = call i32 (i32, i8*, i8, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8 signext %53)
br label %59
55: ; preds = %47
%56 = load i32, i32* @stderr
%57 = load i8, i8* @optopt
%58 = call i32 (i32, i8*, i8, ...) @fprintf(i32 %56, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8 signext %57)
br label %59
59: ; preds = %55, %51
br label %60
60: ; preds = %59, %43
%61 = call i32 (...) @abort()
unreachable
62: ; preds = %14
%63 = call i32 (...) @abort()
unreachable
64: ; preds = %38, %16
br label %9
65: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@opterr = global i64 0
@.str = [4 x i8] c"m:h\00"
@optarg = global i32 0
@stderr = global i32 0
@.str.1 = [16 x i8] c"# Bin size: %d\0A\00"
@.str.2 = [44 x i8] c"# Invalid bin number: %d. Using %d instead\0A\00"
@optopt = global i8 0
@.str.3 = [34 x i8] c"Option -%c requires an argument.\0A\00"
@.str.4 = [23 x i8] c"Unknown option `-%c'.\0A\00"
@.str.5 = [34 x i8] c"Unknown option character `\\x%x'.\0A\00"
define i32 @parseinput(i32 %0, i8** %1, i32* nocapture %2) {
store i64 0, i64* @opterr
br label %4
4: ; preds = %16, %3
%5 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
switch i32 %5, label %36 [
i32 -1, label %38
i32 104, label %6
i32 109, label %8
i32 63, label %22
]
6: ; preds = %4
%7 = tail call i32 (...) @help()
br label %16
8: ; preds = %4
%9 = load i32, i32* @optarg
%10 = tail call i32 @atoi(i32 %9)
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %8
store i32 %10, i32* %2
%13 = load i32, i32* @stderr
%14 = trunc i32 %10 to i8
%15 = tail call i32 (i32, i8*, i8, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8 signext %14)
br label %16
16: ; preds = %12, %17, %6
br label %4
17: ; preds = %8
%18 = load i32, i32* @stderr
%19 = trunc i32 %10 to i8
%20 = load i32, i32* %2
%21 = tail call i32 (i32, i8*, i8, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8 signext %19, i32 %20)
br label %16
22: ; preds = %4
%23 = load i8, i8* @optopt
%24 = icmp eq i8 %23, 110
br i1 %24, label %30, label %25
25: ; preds = %22
%26 = tail call i32 @isprint(i8 signext %23)
%27 = icmp eq i32 %26, 0
%28 = load i8, i8* @optopt
%29 = select i1 %27, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0)
br label %30
30: ; preds = %22, %25
%31 = phi i8 [ %28, %25 ], [ 110, %22 ]
%32 = phi i8* [ %29, %25 ], [ getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), %22 ]
%33 = load i32, i32* @stderr
%34 = tail call i32 (i32, i8*, i8, ...) @fprintf(i32 %33, i8* %32, i8 signext %31)
%35 = tail call i32 (...) @abort()
unreachable
36: ; preds = %4
%37 = tail call i32 (...) @abort()
unreachable
38: ; preds = %4
ret i32 0
}