#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 EXIT_SUCCESS;
int PI_prolog_init(int, char **);
int /*<<< orphan*/ PI_shutdown();
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ load_know();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ qa_dialog();
int main(int argc, char *argv[]) {
  int status;
  printf("Welcome to Q&A.\n");
  status = PI_prolog_init(argc, argv);
  if (status != 0)
    error("Prolog initilization failed.");
  load_know();
  qa_dialog();
  PI_shutdown();
  printf("Goodbye.\n");
  return EXIT_SUCCESS;
}


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    0xe83(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1080 <PI_prolog_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11a7 <main+0x47>
lea    0xe6f(%rip),%rdi
call   1070 <error@plt>
mov    $0x0,%al
call   1050 <load_know@plt>
mov    $0x0,%al
call   1060 <qa_dialog@plt>
mov    $0x0,%al
call   1040 <PI_shutdown@plt>
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1080 <PI_prolog_init@plt>
test   %eax,%eax
je     118e <main+0x2e>
lea    0xe77(%rip),%rdi
call   1070 <error@plt>
xor    %eax,%eax
call   1050 <load_know@plt>
xor    %eax,%eax
call   1060 <qa_dialog@plt>
xor    %eax,%eax
call   1040 <PI_shutdown@plt>
lea    0xe83(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e2a(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Welcome to Q&A.\0A\00"
@.str.1 = [29 x i8] c"Prolog initilization failed.\00"
@.str.2 = [10 x i8] c"Goodbye.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %4
%9 = load i8**, i8*** %5
%10 = call i32 @PI_prolog_init(i32 %8, i8** %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %2
%16 = call i32 (...) @load_know()
%17 = call i32 (...) @qa_dialog()
%18 = call i32 (...) @PI_shutdown()
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%20 = load i32, i32* @EXIT_SUCCESS
ret i32 %20
}

LLVM IR (-O2):
@.str.1 = [29 x i8] c"Prolog initilization failed.\00"
@EXIT_SUCCESS = global i32 0
@str = [16 x i8] c"Welcome to Q&A.\00"
@str.3 = [9 x i8] c"Goodbye.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @PI_prolog_init(i32 %0, i8** %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
%9 = tail call i32 (...) @load_know()
%10 = tail call i32 (...) @qa_dialog()
%11 = tail call i32 (...) @PI_shutdown()
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.3, i64 0, i64 0))
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}