#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 */
typedef scalar_t__ off_t;

/* Variables and functions */
scalar_t__ eslib_procfs_readfile(char *, char **);
int /*<<< orphan*/ printf(char *, ...);
int prntout() {
  off_t fsize;
  char *fdata;
  printf("**********************************************************\n");
  fsize = eslib_procfs_readfile("/proc/self/status", &fdata);
  if (fsize <= 0)
    printf("error reading /proc/self/status\n");
  else
    printf("%s\n", fdata);
  printf("**********************************************************\n\n");
  fsize = eslib_procfs_readfile("/proc/mounts", &fdata);
  if (fsize <= 0)
    printf("error reading /proc/self/status\n");
  else
    printf("%s\n", fdata);
  printf("**********************************************************\n");
  return 0;
}


x86 assembly (clang, -O0):
<prntout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <eslib_procfs_readfile@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jg     1168 <prntout+0x48>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    117a <prntout+0x5a>
mov    -0x10(%rbp),%rsi
lea    0xefc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf21(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <eslib_procfs_readfile@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jg     11ba <prntout+0x9a>
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cc <prntout+0xac>
mov    -0x10(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prntout>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xf19(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xf53(%rip),%rdi
lea    0x8(%rsp),%r15
mov    %r15,%rsi
call   1040 <eslib_procfs_readfile@plt>
lea    0xf31(%rip),%rbx
mov    %rbx,%rdi
test   %rax,%rax
jle    1160 <prntout+0x40>
mov    0x8(%rsp),%rdi
call   1030 <puts@plt>
lea    0xea1(%rip),%rdi
call   1030 <puts@plt>
lea    0xe88(%rip),%rdi
mov    %r15,%rsi
call   1040 <eslib_procfs_readfile@plt>
test   %rax,%rax
jle    118a <prntout+0x6a>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [60 x i8] c"**********************************************************\0A\00"
@.str.1 = [18 x i8] c"/proc/self/status\00"
@.str.2 = [33 x i8] c"error reading /proc/self/status\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
@.str.4 = [61 x i8] c"**********************************************************\0A\0A\00"
@.str.5 = [13 x i8] c"/proc/mounts\00"
define i32 @prntout() {
%1 = alloca i64
%2 = alloca i8*
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%4 = call i64 @eslib_procfs_readfile(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %2)
store i64 %4, i64* %1
%5 = load i64, i64* %1
%6 = icmp sle i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %12
9: ; preds = %0
%10 = load i8*, i8** %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %7
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0))
%14 = call i64 @eslib_procfs_readfile(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %2)
store i64 %14, i64* %1
%15 = load i64, i64* %1
%16 = icmp sle i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %22
19: ; preds = %12
%20 = load i8*, i8** %2
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %19, %17
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [18 x i8] c"/proc/self/status\00"
@.str.5 = [13 x i8] c"/proc/mounts\00"
@str.6 = [60 x i8] c"**********************************************************\0A\00"
@str.7 = [59 x i8] c"**********************************************************\00"
@str.9 = [32 x i8] c"error reading /proc/self/status\00"
define i32 @prntout() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.7, i64 0, i64 0))
%4 = call i64 @eslib_procfs_readfile(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8** %1)
%5 = icmp slt i64 %4, 1
%6 = load i8*, i8** %1
%7 = select i1 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0), i8* %6
%8 = call i32 @puts(i8* dereferenceable(1) %7)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str.6, i64 0, i64 0))
%10 = call i64 @eslib_procfs_readfile(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8** %1)
%11 = icmp slt i64 %10, 1
%12 = load i8*, i8** %1
%13 = select i1 %11, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @str.9, i64 0, i64 0), i8* %12
%14 = call i32 @puts(i8* dereferenceable(1) %13)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.7, i64 0, i64 0))
ret i32 0
}