#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*/ dfi_exit();
scalar_t__ dfi_init();
int /*<<< orphan*/ dfo_init();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ kdump_select_check();
int /*<<< orphan*/ stderr;
int stdout_write_dump();
int /*<<< orphan*/ zg_exit(int);
int do_stdout(void) {
  int rc;
  if (dfi_init() != 0)
    do {
      do {
        fprintf(stderr, "%s: ", "zgetdump");
        fprintf(stderr, "Dump cannot be processed (is not complete)");
        fprintf(stderr, "\n");
      } while (0);
      zg_exit(1);
    } while (0);
  dfo_init();
  kdump_select_check();
  rc = stdout_write_dump();
  dfi_exit();
  return rc;
}


x86 assembly (clang, -O0):
<do_stdout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <dfi_init@plt>
cmp    $0x0,%rax
je     11ee <do_stdout+0x7e>
jmp    118e <do_stdout+0x1e>
jmp    1193 <do_stdout+0x23>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe5d(%rip),%rsi
lea    0xe5b(%rip),%rdx
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2e28(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1090 <zg_exit@plt>
jmp    11ee <do_stdout+0x7e>
mov    $0x0,%al
call   1060 <dfo_init@plt>
mov    $0x0,%al
call   1070 <kdump_select_check@plt>
mov    $0x0,%al
call   1040 <stdout_write_dump@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <dfi_exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_stdout>:
push   %rbx
xor    %eax,%eax
call   1050 <dfi_init@plt>
test   %rax,%rax
je     11c5 <do_stdout+0x55>
mov    0x2e5c(%rip),%rbx
mov    (%rbx),%edi
lea    0xe73(%rip),%rsi
lea    0xe71(%rip),%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe6a(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rbx),%edi
lea    0xe85(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   1090 <zg_exit@plt>
xor    %eax,%eax
call   1060 <dfo_init@plt>
xor    %eax,%eax
call   1070 <kdump_select_check@plt>
xor    %eax,%eax
call   1040 <stdout_write_dump@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <dfi_exit@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [5 x i8] c"%s: \00"
@.str.1 = [9 x i8] c"zgetdump\00"
@.str.2 = [43 x i8] c"Dump cannot be processed (is not complete)\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @do_stdout() {
%1 = alloca i32
%2 = call i64 (...) @dfi_init()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %16
4: ; preds = %0
br label %5
5: ; preds = %4
br label %6
6: ; preds = %5
%7 = load i32, i32* @stderr
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%9 = load i32, i32* @stderr
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %6
%14 = call i32 @zg_exit(i32 1)
br label %15
15: ; preds = %13
br label %16
16: ; preds = %15, %0
%17 = call i32 (...) @dfo_init()
%18 = call i32 (...) @kdump_select_check()
%19 = call i32 (...) @stdout_write_dump()
store i32 %19, i32* %1
%20 = call i32 (...) @dfi_exit()
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"%s: \00"
@.str.1 = [9 x i8] c"zgetdump\00"
@.str.2 = [43 x i8] c"Dump cannot be processed (is not complete)\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @do_stdout() {
%1 = tail call i64 (...) @dfi_init()
%2 = icmp eq i64 %1, 0
br i1 %2, label %11, label %3
3: ; preds = %0
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%10 = tail call i32 @zg_exit(i32 1)
br label %11
11: ; preds = %3, %0
%12 = tail call i32 (...) @dfo_init()
%13 = tail call i32 (...) @kdump_select_check()
%14 = tail call i32 (...) @stdout_write_dump()
%15 = tail call i32 (...) @dfi_exit()
ret i32 %14
}