#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, "Unknown 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    0xebc(%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     120f <main+0xcf>
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>
jmp    116f <main+0x2f>
mov    0x2dc2(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2dae(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     124f <main+0x10f>
lea    0xdd0(%rip),%rdi
call   1030 <puts@plt>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     126c <main+0x12c>
mov    -0x18(%rbp),%rsi
lea    0xdc0(%rip),%rdi
call   1040 <printf@plt>
lea    0xdc9(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12aa <main+0x16a>
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    127f <main+0x13f>
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),%r12
cmp    (%r12),%al
jne    1180 <main+0x40>
mov    0x2e68(%rip),%rax
mov    (%rax),%r15
lea    (%rbx,%r15,8),%r12
lea    0xe9b(%rip),%r14
jmp    11fb <main+0xbb>
lea    0xe92(%rip),%r14
xor    %ecx,%ecx
lea    0xe70(%rip),%r15
jmp    11b6 <main+0x76>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <getopt@plt>
mov    %r13d,%ecx
cmp    (%r12),%al
je     11dc <main+0x9c>
movsbl %al,%eax
mov    $0x1,%r13d
cmp    $0x74,%eax
je     11a0 <main+0x60>
cmp    $0x64,%eax
jne    1249 <main+0x109>
mov    0x2e24(%rip),%rax
mov    (%rax),%r14
mov    %ecx,%r13d
jmp    11a0 <main+0x60>
mov    0x2df5(%rip),%rax
mov    (%rax),%r15
lea    (%rbx,%r15,8),%r12
test   %r13d,%r13d
je     11fb <main+0xbb>
lea    0xe24(%rip),%rdi
call   1030 <puts@plt>
sub    %r15d,%ebp
cmpb   $0x0,(%r14)
je     1213 <main+0xd3>
lea    0xe1c(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
lea    0xe22(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1244 <main+0x104>
mov    %ebp,%ebp
xor    %r14d,%r14d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rbx,8),%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1230 <main+0xf0>
jmp    126e <main+0x12e>
xor    %r14d,%r14d
jmp    126e <main+0x12e>
mov    0x2d78(%rip),%rax
mov    (%rax),%edi
mov    0x2d9f(%rip),%rax
mov    (%rax),%rdx
lea    0xda1(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%r14d
mov    %r14d,%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 = [22 x i8] c"Unknown 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 = %28, %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 %29
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 ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %26)
store i32 1, i32* %3
br label %67
28: ; preds = %23, %21
br label %10
29: ; preds = %10
%30 = load i64, i64* @optind
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = sub nsw i64 %32, %30
%34 = trunc i64 %33 to i32
store i32 %34, i32* %4
%35 = load i64, i64* @optind
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 %35
store i8** %37, i8*** %5
%38 = load i32, i32* %7
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %29
%41 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %40, %29
%43 = load i8*, i8** %6
%44 = getelementptr inbounds i8, i8* %43, i64 0
%45 = load i8, i8* %44
%46 = icmp ne i8 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %42
%48 = load i8*, i8** %6
%49 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %47, %42
%51 = 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 %52
52: ; preds = %63, %50
%53 = load i32, i32* %8
%54 = load i32, i32* %4
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %66
56: ; preds = %52
%57 = load i8**, i8*** %5
%58 = load i32, i32* %8
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8*, i8** %57, i64 %59
%61 = load i8*, i8** %60
%62 = call i32 @puts(i8* %61)
br label %63
63: ; preds = %56
%64 = load i32, i32* %8
%65 = add nsw i32 %64, 1
store i32 %65, i32* %8
br label %52
66: ; preds = %52
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 = [22 x i8] c"Unknown 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 %6, label %9
6: ; preds = %2
%7 = load i64, i64* @optind
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
br label %32
9: ; preds = %2, %20
%10 = phi i8 [ %23, %20 ], [ %3, %2 ]
%11 = phi i32 [ %22, %20 ], [ 0, %2 ]
%12 = phi i8* [ %21, %20 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %2 ]
%13 = sext i8 %10 to i32
switch i32 %13, label %16 [
i32 100, label %14
i32 116, label %20
]
14: ; preds = %9
%15 = load i8*, i8** @optarg
br label %20
16: ; preds = %9
%17 = load i32, i32* @stderr
%18 = load i8*, i8** @optarg
%19 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %18)
br label %54
20: ; preds = %9, %14
%21 = phi i8* [ %15, %14 ], [ %12, %9 ]
%22 = phi i32 [ %11, %14 ], [ 1, %9 ]
%23 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%24 = load i8, i8* @EOF
%25 = icmp eq i8 %23, %24
br i1 %25, label %26, label %9
26: ; preds = %20
%27 = load i64, i64* @optind
%28 = getelementptr inbounds i8*, i8** %1, i64 %27
%29 = icmp eq i32 %22, 0
br i1 %29, label %32, label %30
30: ; preds = %26
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %6, %30, %26
%33 = phi i8** [ %8, %6 ], [ %28, %30 ], [ %28, %26 ]
%34 = phi i64 [ %7, %6 ], [ %27, %30 ], [ %27, %26 ]
%35 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %6 ], [ %21, %30 ], [ %21, %26 ]
%36 = trunc i64 %34 to i32
%37 = sub i32 %0, %36
%38 = load i8, i8* %35
%39 = icmp eq i8 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %32
%41 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %35)
br label %42
42: ; preds = %40, %32
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%44 = icmp sgt i32 %37, 0
br i1 %44, label %45, label %54
45: ; preds = %42
%46 = zext i32 %37 to i64
br label %47
47: ; preds = %45, %47
%48 = phi i64 [ 0, %45 ], [ %52, %47 ]
%49 = getelementptr inbounds i8*, i8** %33, i64 %48
%50 = load i8*, i8** %49
%51 = tail call i32 @puts(i8* dereferenceable(1) %50)
%52 = add nuw nsw i64 %48, 1
%53 = icmp eq i64 %52, %46
br i1 %53, label %54, label %47
54: ; preds = %47, %42, %16
%55 = phi i32 [ 1, %16 ], [ 0, %42 ], [ 0, %47 ]
ret i32 %55
}