#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ write_data(int /*<<< orphan*/ *);
int main(void) {
  FILE *output;
  output = popen("more", "w");
  if (!output) {
    fprintf(stderr, "incorrect parameters or too many files.\n");
    return EXIT_FAILURE;
  }
  write_data(output);
  if (pclose(output) != 0) {
    fprintf(stderr, "Could not run more or other error.\n");
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xea8(%rip),%rsi
call   1060 <popen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1197 <main+0x57>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
lea    0xe86(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d4 <main+0x94>
mov    -0x10(%rbp),%rdi
call   1040 <write_data@plt>
mov    -0x10(%rbp),%rdi
call   1030 <pclose@plt>
cmp    $0x0,%rax
je     11c8 <main+0x88>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1060 <popen@plt>
test   %rax,%rax
je     1181 <main+0x41>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <write_data@plt>
mov    %rbx,%rdi
call   1030 <pclose@plt>
mov    0x2e5d(%rip),%rbx
test   %rax,%rax
je     119d <main+0x5d>
lea    0xeb1(%rip),%rsi
jmp    118f <main+0x4f>
mov    0x2e50(%rip),%rbx
lea    0xe78(%rip),%rsi
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
call   1050 <fprintf@plt>
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"more\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.2 = [41 x i8] c"incorrect parameters or too many files.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [36 x i8] c"Could not run more or other error.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @popen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = icmp ne i32* %4, null
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
store i32 %9, i32* %1
br label %21
10: ; preds = %0
%11 = load i32*, i32** %2
%12 = call i32 @write_data(i32* %11)
%13 = load i32*, i32** %2
%14 = call i64 @pclose(i32* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %10
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
br label %19
19: ; preds = %16, %10
%20 = load i32, i32* @EXIT_SUCCESS
store i32 %20, i32* %1
br label %21
21: ; preds = %19, %6
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [5 x i8] c"more\00"
@.str.1 = [2 x i8] c"w\00"
@stderr = global i32 0
@.str.2 = [41 x i8] c"incorrect parameters or too many files.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [36 x i8] c"Could not run more or other error.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32* @popen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i32 @write_data(i32* %1)
%5 = tail call i64 @pclose(i32* %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %3, %0
%8 = phi i8* [ getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), %0 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), %3 ]
%9 = phi i32* [ @EXIT_FAILURE, %0 ], [ @EXIT_SUCCESS, %3 ]
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* %8)
br label %12
12: ; preds = %7, %3
%13 = phi i32* [ @EXIT_SUCCESS, %3 ], [ %9, %7 ]
%14 = load i32, i32* %13
ret i32 %14
}