#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 EOF;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char getopt(int, char **, char *);
char *optarg;
scalar_t__ optind;
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  char *delivery = "";
  int thick = 0;
  int count = 0;
  char ch;
  while ((ch = getopt(argc, argv, "d:t")) != EOF) {
    switch (ch) {
    case 'd':
      delivery = optarg;
      break;
    case 't':
      thick = 1;
      break;
    default:
      fprintf(stderr, "Unkown option: '%s'\n", optarg);
      return 1;
    }
    argc -= optind;
    argv += optind;
    if (thick) {
      puts("Thick crust.");
    }
    if (delivery[0]) {
      printf("To be delivered %s.\n", delivery);
    }
    puts("Ingredients:");
    for (count = 0; count < argc; ++count) {
      puts(argv[count]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xebb(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe83(%rip),%rdx
call   1060 <getopt@plt>
mov    %al,-0x21(%rbp)
movsbl %al,%eax
mov    0x2e51(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     12aa <main+0x16a>
movsbl -0x21(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x64,%eax
je     11c0 <main+0x80>
jmp    11af <main+0x6f>
mov    -0x28(%rbp),%eax
sub    $0x74,%eax
je     11d3 <main+0x93>
jmp    11df <main+0x9f>
mov    0x2e31(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    120a <main+0xca>
movl   $0x1,-0x1c(%rbp)
jmp    120a <main+0xca>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
mov    0x2e09(%rip),%rax
mov    (%rax),%rdx
lea    0xe0b(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12b1 <main+0x171>
mov    0x2dc7(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2db3(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     124a <main+0x10a>
lea    0xdd4(%rip),%rdi
call   1030 <puts@plt>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1267 <main+0x127>
mov    -0x18(%rbp),%rsi
lea    0xdc4(%rip),%rdi
call   1040 <printf@plt>
lea    0xdcd(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12a5 <main+0x165>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <puts@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    127a <main+0x13a>
jmp    116f <main+0x2f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xea9(%rip),%rdx
call   1060 <getopt@plt>
mov    0x2e7d(%rip),%rdx
xor    %ecx,%ecx
cmp    (%rdx),%al
je     127a <main+0x13a>
lea    0xea4(%rip),%r14
xor    %r15d,%r15d
jmp    11a0 <main+0x60>
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
lea    0xe74(%rip),%rdx
call   1060 <getopt@plt>
mov    0x2e48(%rip),%rcx
cmp    (%rcx),%al
je     1252 <main+0x112>
movsbl %al,%eax
cmp    $0x64,%eax
je     11d0 <main+0x90>
cmp    $0x74,%eax
jne    1256 <main+0x116>
mov    0x2e20(%rip),%rax
mov    (%rax),%rax
sub    %eax,%ebp
lea    (%rbx,%rax,8),%rbx
mov    $0x1,%r15d
jmp    11ef <main+0xaf>
nopl   0x0(%rax)
mov    0x2e21(%rip),%rax
mov    (%rax),%r14
mov    0x2df7(%rip),%rax
mov    (%rax),%rax
sub    %eax,%ebp
lea    (%rbx,%rax,8),%rbx
test   %r15d,%r15d
je     1247 <main+0x107>
lea    0xe23(%rip),%rdi
call   1030 <puts@plt>
cmpb   $0x0,(%r14)
je     1210 <main+0xd0>
lea    0xe1e(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
lea    0xe24(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1180 <main+0x40>
mov    %ebp,%r12d
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%r13,8),%rdi
call   1030 <puts@plt>
add    $0x1,%r13
cmp    %r13,%r12
jne    1230 <main+0xf0>
jmp    1180 <main+0x40>
xor    %r15d,%r15d
cmpb   $0x0,(%r14)
jne    1201 <main+0xc1>
jmp    1210 <main+0xd0>
xor    %ecx,%ecx
jmp    127a <main+0x13a>
mov    0x2d6b(%rip),%rax
mov    (%rax),%edi
mov    0x2d92(%rip),%rax
mov    (%rax),%rdx
lea    0xd94(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"d:t\00"
@EOF = global i8 0
@optarg = global i8* null
@stderr = global i32 0
@.str.2 = [21 x i8] c"Unkown option: '%s'\0A\00"
@optind = global i64 0
@.str.3 = [13 x i8] c"Thick crust.\00"
@.str.4 = [21 x i8] c"To be delivered %s.\0A\00"
@.str.5 = [13 x i8] c"Ingredients:\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %10
10: ; preds = %65, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call signext i8 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i8 %13, i8* %9
%14 = sext i8 %13 to i32
%15 = load i8, i8* @EOF
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %14, %16
br i1 %17, label %18, label %66
18: ; preds = %10
%19 = load i8, i8* %9
%20 = sext i8 %19 to i32
switch i32 %20, label %24 [
i32 100, label %21
i32 116, label %23
]
21: ; preds = %18
%22 = load i8*, i8** @optarg
store i8* %22, i8** %6
br label %28
23: ; preds = %18
store i32 1, i32* %7
br label %28
24: ; preds = %18
%25 = load i32, i32* @stderr
%26 = load i8*, i8** @optarg
%27 = call i32 @fprintf(i32 %25, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %26)
store i32 1, i32* %3
br label %67
28: ; preds = %23, %21
%29 = load i64, i64* @optind
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = sub nsw i64 %31, %29
%33 = trunc i64 %32 to i32
store i32 %33, i32* %4
%34 = load i64, i64* @optind
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 %34
store i8** %36, i8*** %5
%37 = load i32, i32* %7
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %28
%40 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %41
41: ; preds = %39, %28
%42 = load i8*, i8** %6
%43 = getelementptr inbounds i8, i8* %42, i64 0
%44 = load i8, i8* %43
%45 = icmp ne i8 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %41
%47 = load i8*, i8** %6
%48 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %47)
br label %49
49: ; preds = %46, %41
%50 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %8
br label %51
51: ; preds = %62, %49
%52 = load i32, i32* %8
%53 = load i32, i32* %4
%54 = icmp slt i32 %52, %53
br i1 %54, label %55, label %65
55: ; preds = %51
%56 = load i8**, i8*** %5
%57 = load i32, i32* %8
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8*, i8** %56, i64 %58
%60 = load i8*, i8** %59
%61 = call i32 @puts(i8* %60)
br label %62
62: ; preds = %55
%63 = load i32, i32* %8
%64 = add nsw i32 %63, 1
store i32 %64, i32* %8
br label %51
65: ; preds = %51
br label %10
66: ; preds = %10
store i32 0, i32* %3
br label %67
67: ; preds = %66, %24
%68 = load i32, i32* %3
ret i32 %68
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"d:t\00"
@EOF = global i8 0
@optarg = global i8* null
@stderr = global i32 0
@.str.2 = [21 x i8] c"Unkown option: '%s'\0A\00"
@optind = global i64 0
@.str.3 = [13 x i8] c"Thick crust.\00"
@.str.4 = [21 x i8] c"To be delivered %s.\0A\00"
@.str.5 = [13 x i8] c"Ingredients:\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = load i8, i8* @EOF
%5 = icmp eq i8 %3, %4
br i1 %5, label %60, label %10
6: ; preds = %53, %48
%7 = tail call signext i8 @getopt(i32 %41, i8** %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%8 = load i8, i8* @EOF
%9 = icmp eq i8 %7, %8
br i1 %9, label %60, label %10
10: ; preds = %2, %6
%11 = phi i8 [ %7, %6 ], [ %3, %2 ]
%12 = phi i32 [ %42, %6 ], [ 0, %2 ]
%13 = phi i8* [ %43, %6 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%14 = phi i8** [ %40, %6 ], [ %1, %2 ]
%15 = phi i32 [ %41, %6 ], [ %0, %2 ]
%16 = sext i8 %11 to i32
switch i32 %16, label %22 [
i32 100, label %26
i32 116, label %17
]
17: ; preds = %10
%18 = load i64, i64* @optind
%19 = trunc i64 %18 to i32
%20 = sub i32 %15, %19
%21 = getelementptr inbounds i8*, i8** %14, i64 %18
br label %33
22: ; preds = %10
%23 = load i32, i32* @stderr
%24 = load i8*, i8** @optarg
%25 = tail call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %60
26: ; preds = %10
%27 = load i8*, i8** @optarg
%28 = load i64, i64* @optind
%29 = trunc i64 %28 to i32
%30 = sub i32 %15, %29
%31 = getelementptr inbounds i8*, i8** %14, i64 %28
%32 = icmp eq i32 %12, 0
br i1 %32, label %39, label %33
33: ; preds = %17, %26
%34 = phi i8** [ %21, %17 ], [ %31, %26 ]
%35 = phi i32 [ %20, %17 ], [ %30, %26 ]
%36 = phi i32 [ 1, %17 ], [ %12, %26 ]
%37 = phi i8* [ %13, %17 ], [ %27, %26 ]
%38 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %39
39: ; preds = %33, %26
%40 = phi i8** [ %34, %33 ], [ %31, %26 ]
%41 = phi i32 [ %35, %33 ], [ %30, %26 ]
%42 = phi i32 [ %36, %33 ], [ 0, %26 ]
%43 = phi i8* [ %37, %33 ], [ %27, %26 ]
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 0
br i1 %45, label %48, label %46
46: ; preds = %39
%47 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %43)
br label %48
48: ; preds = %46, %39
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%50 = icmp sgt i32 %41, 0
br i1 %50, label %51, label %6
51: ; preds = %48
%52 = zext i32 %41 to i64
br label %53
53: ; preds = %51, %53
%54 = phi i64 [ 0, %51 ], [ %58, %53 ]
%55 = getelementptr inbounds i8*, i8** %40, i64 %54
%56 = load i8*, i8** %55
%57 = tail call i32 @puts(i8* dereferenceable(1) %56)
%58 = add nuw nsw i64 %54, 1
%59 = icmp eq i64 %58, %52
br i1 %59, label %6, label %53
60: ; preds = %6, %2, %22
%61 = phi i32 [ 1, %22 ], [ 0, %2 ], [ 0, %6 ]
ret i32 %61
}