#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
scalar_t__ get_pig(char *, char ***);
scalar_t__ print_pig(char ***, char ***);
int /*<<< orphan*/ prompt(char ***);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  char **text;
  char **pig;
  prompt(&text);
  if (get_pig("default.pig", &pig) < 0) {
    fprintf(stderr, "%s: Could not find %s\n", argv[0], "default.pig");
    exit(1);
  }
  if (print_pig(&text, &pig) < 0) {
    fprintf(stderr, "%s: Output failed\n", argv[0]);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <prompt@plt>
lea    0xe8a(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <get_pig@plt>
cmp    $0x0,%rax
jge    11b8 <main+0x68>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe6c(%rip),%rsi
lea    0xe59(%rip),%rcx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <print_pig@plt>
cmp    $0x0,%rax
jge    11ed <main+0x9d>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe3d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rdi
call   1030 <prompt@plt>
lea    0xe97(%rip),%rdi
mov    %rsp,%rsi
call   1060 <get_pig@plt>
test   %rax,%rax
jns    11a1 <main+0x51>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe83(%rip),%rsi
lea    0xe70(%rip),%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1040 <print_pig@plt>
test   %rax,%rax
jns    11cd <main+0x7d>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe5d(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"default.pig\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"%s: Could not find %s\0A\00"
@.str.2 = [19 x i8] c"%s: Output failed\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @prompt(i8*** %6)
%9 = call i64 @get_pig(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8*** %7)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = call i64 @print_pig(i8*** %6, i8*** %7)
%20 = icmp slt i64 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %21, %18
%28 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"default.pig\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"%s: Could not find %s\0A\00"
@.str.2 = [19 x i8] c"%s: Output failed\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = bitcast i8*** %3 to i8*
%6 = bitcast i8*** %4 to i8*
%7 = call i32 @prompt(i8*** %3)
%8 = call i64 @get_pig(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8*** %4)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %1
%13 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %12, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = call i64 @print_pig(i8*** %3, i8*** %4)
%17 = icmp slt i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %1
%21 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %18, %15
%23 = call i32 @exit(i32 0)
unreachable
}