#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 */
char getopt(int, char **, char *);
void bake_args(int argc, char **argv, int *opt) {
  char ch;
  *opt = 0;
  while ((ch = getopt(argc, argv, "sf")) != -1) {
    switch (ch) {
    case 's':
      *opt |= (1 << 0);
      break;
    case 'f':
      *opt |= (1 << 1);
      break;
    default:
      break;
    }
  }
}


x86 assembly (clang, -O0):
<bake_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xec5(%rip),%rdx
call   1030 <getopt@plt>
mov    %al,-0x19(%rbp)
movsbl %al,%eax
cmp    $0xffffffff,%eax
je     119f <bake_args+0x8f>
movsbl -0x19(%rbp),%eax
mov    %eax,-0x20(%rbp)
sub    $0x66,%eax
je     1185 <bake_args+0x75>
jmp    1164 <bake_args+0x54>
mov    -0x20(%rbp),%eax
sub    $0x73,%eax
jne    1195 <bake_args+0x85>
jmp    1175 <bake_args+0x65>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    %ecx,(%rax)
jmp    119a <bake_args+0x8a>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    %ecx,(%rax)
jmp    119a <bake_args+0x8a>
jmp    119a <bake_args+0x8a>
jmp    112d <bake_args+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bake_args>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x0,(%rdx)
lea    0xed4(%rip),%rdx
call   1030 <getopt@plt>
cmp    $0xff,%al
je     116d <bake_args+0x5d>
lea    0xec4(%rip),%r15
jmp    1159 <bake_args+0x49>
xchg   %ax,%ax
mov    $0x1,%eax
or     %eax,(%r14)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <getopt@plt>
cmp    $0xff,%al
je     116d <bake_args+0x5d>
movsbl %al,%eax
cmp    $0x73,%eax
je     1140 <bake_args+0x30>
cmp    $0x66,%eax
jne    1148 <bake_args+0x38>
mov    $0x2,%eax
jmp    1145 <bake_args+0x35>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"sf\00"
define void @bake_args(i32 %0, i8** %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* %2, i32** %6
%8 = load i32*, i32** %6
store i32 0, i32* %8
br label %9
9: ; preds = %27, %3
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call signext i8 @getopt(i32 %10, i8** %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8 %12, i8* %7
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %28
15: ; preds = %9
%16 = load i8, i8* %7
%17 = sext i8 %16 to i32
switch i32 %17, label %26 [
i32 115, label %18
i32 102, label %22
]
18: ; preds = %15
%19 = load i32*, i32** %6
%20 = load i32, i32* %19
%21 = or i32 %20, 1
store i32 %21, i32* %19
br label %27
22: ; preds = %15
%23 = load i32*, i32** %6
%24 = load i32, i32* %23
%25 = or i32 %24, 2
store i32 %25, i32* %23
br label %27
26: ; preds = %15
br label %27
27: ; preds = %26, %22, %18
br label %9
28: ; preds = %9
ret void
}

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