#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 */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int getopt(int, char **, char *);
int /*<<< orphan*/ howto();
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ strtoul(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
int parse_args(int argc, char **argv, uint32_t *gpio_address,
               uint32_t *max_offset) {
  int par;
  while ((par = getopt(argc, argv, "a:o:")) != -1) {
    switch (par) {
    case 'a':
      *gpio_address = strtoul(optarg, NULL, 0);
      break;
    case 'o':
      *max_offset = strtoul(optarg, NULL, 0);
      break;
    default:
      printf("%c: parametro sconosciuto.\n", par);
      howto();
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<parse_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe9b(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     1204 <parse_args+0xc4>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x61,%eax
je     119b <parse_args+0x5b>
jmp    118a <parse_args+0x4a>
mov    -0x28(%rbp),%eax
sub    $0x6f,%eax
je     11bc <parse_args+0x7c>
jmp    11dd <parse_args+0x9d>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtoul@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    11ff <parse_args+0xbf>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtoul@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    11ff <parse_args+0xbf>
mov    -0x24(%rbp),%esi
lea    0xe1e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <howto@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    120b <parse_args+0xcb>
jmp    1157 <parse_args+0x17>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_args>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r13
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xea3(%rip),%r12
jmp    1175 <parse_args+0x35>
nop
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtoul@plt>
mov    %eax,(%r14)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <getopt@plt>
mov    %r15,%r14
cmp    $0x61,%eax
je     1160 <parse_args+0x20>
mov    %r13,%r14
cmp    $0x6f,%eax
je     1160 <parse_args+0x20>
cmp    $0xffffffff,%eax
jne    119b <parse_args+0x5b>
xor    %eax,%eax
jmp    11b5 <parse_args+0x75>
lea    0xe63(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <howto@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"a:o:\00"
@optarg = global i32 0
@.str.1 = [28 x i8] c"%c: parametro sconosciuto.\0A\00"
define i32 @parse_args(i32 %0, i8** %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
br label %11
11: ; preds = %30, %4
%12 = load i32, i32* %6
%13 = load i8**, i8*** %7
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %14, i32* %10
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %31
16: ; preds = %11
%17 = load i32, i32* %10
switch i32 %17, label %26 [
i32 97, label %18
i32 111, label %22
]
18: ; preds = %16
%19 = load i32, i32* @optarg
%20 = call i32 @strtoul(i32 %19, i32* null, i32 0)
%21 = load i32*, i32** %8
store i32 %20, i32* %21
br label %30
22: ; preds = %16
%23 = load i32, i32* @optarg
%24 = call i32 @strtoul(i32 %23, i32* null, i32 0)
%25 = load i32*, i32** %9
store i32 %24, i32* %25
br label %30
26: ; preds = %16
%27 = load i32, i32* %10
%28 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %27)
%29 = call i32 (...) @howto()
store i32 -1, i32* %5
br label %32
30: ; preds = %22, %18
br label %11
31: ; preds = %11
store i32 0, i32* %5
br label %32
32: ; preds = %31, %26
%33 = load i32, i32* %5
ret i32 %33
}

LLVM IR (-O2):
@.str = [5 x i8] c"a:o:\00"
@optarg = global i32 0
@.str.1 = [28 x i8] c"%c: parametro sconosciuto.\0A\00"
define i32 @parse_args(i32 %0, i8** %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
br label %5
5: ; preds = %11, %4
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %6, label %8 [
i32 -1, label %15
i32 97, label %11
i32 111, label %7
]
7: ; preds = %5
br label %11
8: ; preds = %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%10 = tail call i32 (...) @howto()
br label %15
11: ; preds = %5, %7
%12 = phi i32* [ %3, %7 ], [ %2, %5 ]
%13 = load i32, i32* @optarg
%14 = tail call i32 @strtoul(i32 %13, i32* null, i32 0)
store i32 %14, i32* %12
br label %5
15: ; preds = %5, %8
%16 = phi i32 [ -1, %8 ], [ 0, %5 ]
ret i32 %16
}