#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 capture(char *);
int /*<<< orphan*/ deep_dish_pizza(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ strlen(char *);
scalar_t__ strncmp(char *, char *, scalar_t__);
int uncapture(int);
char *test_one_deep_dish_pizza(int n, char *expected) {
  char output[strlen(expected) * sizeof(char)];
  memset(output, 0, strlen(expected) * sizeof(char));
  do {
    int result = ({
                   int ret, std_save = capture(output);
                   deep_dish_pizza(n);
                   ret = uncapture(std_save);
                   ret;
                 }) == (0);
    printf("%s", (result ? "+" : "-"));
    if (!result)
      return "deep_dish_pizza did not run successfully";
  } while (0);
  do {
    int result = output != NULL;
    printf("%s", (result ? "+" : "-"));
    if (!result)
      return "deep_dish_pizza output was null";
  } while (0);
  do {
    int result = strlen(output) > 0;
    printf("%s", (result ? "+" : "-"));
    if (!result)
      return "deep_dish_pizza output was empty";
  } while (0);
  do {
    int result = strncmp(expected, output, strlen(expected)) == 0;
    printf("%s", (result ? "+" : "-"));
    if (!result)
      return "deep_dish_pizza did not have correct output";
  } while (0);
  return (0);
}


x86 assembly (clang, -O0):
<test_one_deep_dish_pizza>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdx
mov    %rdx,%rax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x50(%rbp),%rdi
shl    $0x0,%rax
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    -0x50(%rbp),%rdi
call   1080 <capture@plt>
mov    %eax,-0x34(%rbp)
mov    -0xc(%rbp),%edi
call   1090 <deep_dish_pizza@plt>
mov    -0x34(%rbp),%edi
call   1040 <uncapture@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%ecx
lea    0xdff(%rip),%rsi
lea    0xdf6(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xde5(%rip),%rdi
call   1060 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jne    1241 <test_one_deep_dish_pizza+0xd1>
lea    0xdd6(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x3c(%rbp)
jmp    13b1 <test_one_deep_dish_pizza+0x241>
jmp    1246 <test_one_deep_dish_pizza+0xd6>
jmp    124b <test_one_deep_dish_pizza+0xdb>
jmp    1250 <test_one_deep_dish_pizza+0xe0>
mov    -0x50(%rbp),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%ecx
lea    0xd98(%rip),%rsi
lea    0xd8f(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xd7e(%rip),%rdi
call   1060 <printf@plt>
cmpl   $0x0,-0x40(%rbp)
jne    12a8 <test_one_deep_dish_pizza+0x138>
lea    0xd98(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x3c(%rbp)
jmp    13b1 <test_one_deep_dish_pizza+0x241>
jmp    12ad <test_one_deep_dish_pizza+0x13d>
jmp    12b2 <test_one_deep_dish_pizza+0x142>
jmp    12b7 <test_one_deep_dish_pizza+0x147>
mov    -0x50(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%ecx
lea    0xd2c(%rip),%rsi
lea    0xd23(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xd12(%rip),%rdi
call   1060 <printf@plt>
cmpl   $0x0,-0x44(%rbp)
jne    1314 <test_one_deep_dish_pizza+0x1a4>
lea    0xd4c(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x3c(%rbp)
jmp    13b1 <test_one_deep_dish_pizza+0x241>
jmp    1319 <test_one_deep_dish_pizza+0x1a9>
jmp    131e <test_one_deep_dish_pizza+0x1ae>
jmp    1323 <test_one_deep_dish_pizza+0x1b3>
mov    -0x18(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    -0x50(%rbp),%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%ecx
lea    0xca8(%rip),%rsi
lea    0xc9f(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
lea    0xc8e(%rip),%rdi
call   1060 <printf@plt>
cmpl   $0x0,-0x48(%rbp)
jne    1398 <test_one_deep_dish_pizza+0x228>
lea    0xce9(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x3c(%rbp)
jmp    13b1 <test_one_deep_dish_pizza+0x241>
jmp    139d <test_one_deep_dish_pizza+0x22d>
jmp    13a2 <test_one_deep_dish_pizza+0x232>
movq   $0x0,-0x8(%rbp)
movl   $0x1,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_one_deep_dish_pizza>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%r15d
mov    %rsi,%rdi
call   1050 <strlen@plt>
mov    %rsp,%r13
lea    0xf(%rax),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r13
mov    %r13,%rsp
mov    %r13,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1070 <memset@plt>
mov    %r13,%rdi
call   1080 <capture@plt>
mov    %eax,%r12d
mov    %r15d,%edi
call   1090 <deep_dish_pizza@plt>
mov    %r12d,%edi
call   1040 <uncapture@plt>
mov    %eax,%ebx
test   %eax,%eax
lea    0xe34(%rip),%r12
lea    0xe2f(%rip),%r15
mov    %r15,%rsi
cmove  %r12,%rsi
lea    0xe1c(%rip),%rdi
call   1060 <printf@plt>
test   %ebx,%ebx
je     11f6 <test_one_deep_dish_pizza+0x86>
lea    0xe13(%rip),%rbx
jmp    126b <test_one_deep_dish_pizza+0xfb>
lea    0xe03(%rip),%rdi
mov    %r12,%rsi
call   1060 <printf@plt>
mov    %r13,%rdi
call   1050 <strlen@plt>
mov    %rax,%rbx
test   %rax,%rax
mov    %r15,%rsi
cmovg  %r12,%rsi
lea    0xddf(%rip),%rdi
call   1060 <printf@plt>
test   %rbx,%rbx
jle    1264 <test_one_deep_dish_pizza+0xf4>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
test   %rax,%rax
cmove  %r12,%r15
lea    0xdb1(%rip),%rdi
lea    0xdfb(%rip),%rbx
cmove  %rax,%rbx
mov    %r15,%rsi
call   1060 <printf@plt>
jmp    126b <test_one_deep_dish_pizza+0xfb>
lea    0xdc5(%rip),%rbx
mov    %rbx,%rax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [41 x i8] c"deep_dish_pizza did not run successfully\00"
@.str.4 = [32 x i8] c"deep_dish_pizza output was null\00"
@.str.5 = [33 x i8] c"deep_dish_pizza output was empty\00"
@.str.6 = [44 x i8] c"deep_dish_pizza did not have correct output\00"
define i8* @test_one_deep_dish_pizza(i32 %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%16 = load i8*, i8** %5
%17 = call i64 @strlen(i8* %16)
%18 = mul i64 %17, 1
%19 = call i8* @llvm.stacksave()
store i8* %19, i8** %6
%20 = alloca i8, i64 %18
store i64 %18, i64* %7
%21 = load i8*, i8** %5
%22 = call i64 @strlen(i8* %21)
%23 = mul i64 %22, 1
%24 = trunc i64 %23 to i32
%25 = call i32 @memset(i8* %20, i32 0, i32 %24)
br label %26
26: ; preds = %2
%27 = call i32 @capture(i8* %20)
store i32 %27, i32* %10
%28 = load i32, i32* %4
%29 = call i32 @deep_dish_pizza(i32 %28)
%30 = load i32, i32* %10
%31 = call i32 @uncapture(i32 %30)
store i32 %31, i32* %9
%32 = load i32, i32* %9
store i32 %32, i32* %11
%33 = load i32, i32* %11
%34 = icmp eq i32 %33, 0
%35 = zext i1 %34 to i32
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = icmp ne i32 %36, 0
%38 = zext i1 %37 to i64
%39 = select i1 %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%40 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %39)
%41 = load i32, i32* %8
%42 = icmp ne i32 %41, 0
br i1 %42, label %44, label %43
43: ; preds = %26
store i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i8** %3
store i32 1, i32* %12
br label %94
44: ; preds = %26
br label %45
45: ; preds = %44
br label %46
46: ; preds = %45
br label %47
47: ; preds = %46
%48 = icmp ne i8* %20, null
%49 = zext i1 %48 to i32
store i32 %49, i32* %13
%50 = load i32, i32* %13
%51 = icmp ne i32 %50, 0
%52 = zext i1 %51 to i64
%53 = select i1 %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%54 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %53)
%55 = load i32, i32* %13
%56 = icmp ne i32 %55, 0
br i1 %56, label %58, label %57
57: ; preds = %47
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8** %3
store i32 1, i32* %12
br label %94
58: ; preds = %47
br label %59
59: ; preds = %58
br label %60
60: ; preds = %59
br label %61
61: ; preds = %60
%62 = call i64 @strlen(i8* %20)
%63 = icmp sgt i64 %62, 0
%64 = zext i1 %63 to i32
store i32 %64, i32* %14
%65 = load i32, i32* %14
%66 = icmp ne i32 %65, 0
%67 = zext i1 %66 to i64
%68 = select i1 %66, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%69 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %68)
%70 = load i32, i32* %14
%71 = icmp ne i32 %70, 0
br i1 %71, label %73, label %72
72: ; preds = %61
store i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8** %3
store i32 1, i32* %12
br label %94
73: ; preds = %61
br label %74
74: ; preds = %73
br label %75
75: ; preds = %74
br label %76
76: ; preds = %75
%77 = load i8*, i8** %5
%78 = load i8*, i8** %5
%79 = call i64 @strlen(i8* %78)
%80 = call i64 @strncmp(i8* %77, i8* %20, i64 %79)
%81 = icmp eq i64 %80, 0
%82 = zext i1 %81 to i32
store i32 %82, i32* %15
%83 = load i32, i32* %15
%84 = icmp ne i32 %83, 0
%85 = zext i1 %84 to i64
%86 = select i1 %84, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%87 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %86)
%88 = load i32, i32* %15
%89 = icmp ne i32 %88, 0
br i1 %89, label %91, label %90
90: ; preds = %76
store i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i8** %3
store i32 1, i32* %12
br label %94
91: ; preds = %76
br label %92
92: ; preds = %91
br label %93
93: ; preds = %92
store i8* null, i8** %3
store i32 1, i32* %12
br label %94
94: ; preds = %93, %90, %72, %57, %43
%95 = load i8*, i8** %6
%96 = load i8*, i8** %3
ret i8* %96
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [2 x i8] c"+\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [41 x i8] c"deep_dish_pizza did not run successfully\00"
@.str.5 = [33 x i8] c"deep_dish_pizza output was empty\00"
@.str.6 = [44 x i8] c"deep_dish_pizza did not have correct output\00"
define i8* @test_one_deep_dish_pizza(i32 %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = alloca i8, i64 %3
%5 = trunc i64 %3 to i32
%6 = call i32 @memset(i8* %4, i32 0, i32 %5)
%7 = call i32 @capture(i8* %4)
%8 = call i32 @deep_dish_pizza(i32 %0)
%9 = call i32 @uncapture(i32 %7)
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
br i1 %10, label %13, label %26
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = call i64 @strlen(i8* %4)
%16 = icmp sgt i64 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%18 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %17)
br i1 %16, label %19, label %26
19: ; preds = %13
%20 = call i64 @strlen(i8* dereferenceable(1) %1)
%21 = call i64 @strncmp(i8* %1, i8* %4, i64 %20)
%22 = icmp eq i64 %21, 0
%23 = select i1 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%24 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = select i1 %22, i8* null, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0)
br label %26
26: ; preds = %19, %13, %2
%27 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), %13 ], [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), %2 ], [ %25, %19 ]
ret i8* %27
}