#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 getopt(int, char **, char *);
void bake_args(int argc, char **argv, int *opt) {
  int ch;
  while ((ch = getopt(argc, argv, "asnrvm")) != -1) {
    switch (ch) {
    case 'a':
      *opt = ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4));
      break;
    case 's':
      *opt |= (1 << 0);
      break;
    case 'n':
      *opt |= (1 << 1);
      break;
    case 'r':
      *opt |= (1 << 2);
      break;
    case 'v':
      *opt |= (1 << 3);
      break;
    case 'm':
      *opt |= (1 << 4);
      break;
    }
  }
  if (!*opt)
    *opt = ((1 << 0));
}


x86 assembly (clang, -O0):
<bake_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xf27(%rip),%rdx
call   1030 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     11ca <bake_args+0xba>
mov    -0x1c(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x15,%eax
ja     11c5 <bake_args+0xb5>
mov    -0x28(%rbp),%rax
lea    0xe9e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rax
movl   $0x1f,(%rax)
jmp    11c5 <bake_args+0xb5>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
jmp    11c5 <bake_args+0xb5>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    %ecx,(%rax)
jmp    11c5 <bake_args+0xb5>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
or     $0x4,%ecx
mov    %ecx,(%rax)
jmp    11c5 <bake_args+0xb5>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
or     $0x8,%ecx
mov    %ecx,(%rax)
jmp    11c5 <bake_args+0xb5>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
or     $0x10,%ecx
mov    %ecx,(%rax)
jmp    1123 <bake_args+0x13>
mov    -0x18(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11e1 <bake_args+0xd1>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bake_args>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xf31(%rip),%r15
lea    0xed2(%rip),%r12
jmp    1146 <bake_args+0x36>
mov    $0x10,%eax
cs nopw 0x0(%rax,%rax,1)
nop
or     (%rbx),%eax
mov    %eax,%ecx
mov    %ecx,(%rbx)
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <getopt@plt>
lea    -0x61(%rax),%edx
cmp    $0x15,%edx
ja     1183 <bake_args+0x73>
mov    $0x1,%eax
mov    $0x1f,%ecx
movslq (%r12,%rdx,4),%rdx
add    %r12,%rdx
jmp    *%rdx
mov    $0x2,%eax
jmp    1140 <bake_args+0x30>
mov    $0x4,%eax
jmp    1140 <bake_args+0x30>
mov    $0x8,%eax
jmp    1140 <bake_args+0x30>
cmp    $0xffffffff,%eax
jne    1146 <bake_args+0x36>
cmpl   $0x0,(%rbx)
jne    1193 <bake_args+0x83>
movl   $0x1,(%rbx)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"asnrvm\00"
define void @bake_args(i32 %0, i8** %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* %2, i32** %6
br label %8
8: ; preds = %37, %3
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = call i32 @getopt(i32 %9, i8** %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %11, i32* %7
%12 = icmp ne i32 %11, -1
br i1 %12, label %13, label %38
13: ; preds = %8
%14 = load i32, i32* %7
switch i32 %14, label %37 [
i32 97, label %15
i32 115, label %17
i32 110, label %21
i32 114, label %25
i32 118, label %29
i32 109, label %33
]
15: ; preds = %13
%16 = load i32*, i32** %6
store i32 31, i32* %16
br label %37
17: ; preds = %13
%18 = load i32*, i32** %6
%19 = load i32, i32* %18
%20 = or i32 %19, 1
store i32 %20, i32* %18
br label %37
21: ; preds = %13
%22 = load i32*, i32** %6
%23 = load i32, i32* %22
%24 = or i32 %23, 2
store i32 %24, i32* %22
br label %37
25: ; preds = %13
%26 = load i32*, i32** %6
%27 = load i32, i32* %26
%28 = or i32 %27, 4
store i32 %28, i32* %26
br label %37
29: ; preds = %13
%30 = load i32*, i32** %6
%31 = load i32, i32* %30
%32 = or i32 %31, 8
store i32 %32, i32* %30
br label %37
33: ; preds = %13
%34 = load i32*, i32** %6
%35 = load i32, i32* %34
%36 = or i32 %35, 16
store i32 %36, i32* %34
br label %37
37: ; preds = %13, %33, %29, %25, %21, %17, %15
br label %8
38: ; preds = %8
%39 = load i32*, i32** %6
%40 = load i32, i32* %39
%41 = icmp ne i32 %40, 0
br i1 %41, label %44, label %42
42: ; preds = %38
%43 = load i32*, i32** %6
store i32 1, i32* %43
br label %44
44: ; preds = %42, %38
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"asnrvm\00"
define void @bake_args(i32 %0, i8** %1, i32* nocapture %2) {
br label %4
4: ; preds = %16, %3
%5 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
switch i32 %5, label %16 [
i32 -1, label %17
i32 97, label %14
i32 115, label %10
i32 110, label %6
i32 114, label %7
i32 118, label %8
i32 109, label %9
]
6: ; preds = %4
br label %10
7: ; preds = %4
br label %10
8: ; preds = %4
br label %10
9: ; preds = %4
br label %10
10: ; preds = %4, %9, %8, %7, %6
%11 = phi i32 [ 2, %6 ], [ 4, %7 ], [ 8, %8 ], [ 16, %9 ], [ 1, %4 ]
%12 = load i32, i32* %2
%13 = or i32 %12, %11
br label %14
14: ; preds = %10, %4
%15 = phi i32 [ 31, %4 ], [ %13, %10 ]
store i32 %15, i32* %2
br label %16
16: ; preds = %14, %4
br label %4
17: ; preds = %4
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 1, i32* %2
br label %21
21: ; preds = %20, %17
ret void
}