#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ pr_exit(int);
int /*<<< orphan*/ stderr;
int system(char *);
int main(int argc, char const *argv[]) {
  int status;
  if ((status = system("date")) < 0) {
    fprintf(stderr, "system() error\n");
  }
  pr_exit(status);
  if ((status = system("nosuchcommand")) < 0) {
    fprintf(stderr, "system() error\n");
  }
  pr_exit(status);
  if ((status = system("who; exit 44")) < 0) {
    fprintf(stderr, "system() error\n");
  }
  pr_exit(status);
  return 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    0xeb3(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1173 <main+0x43>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%edi
call   1050 <pr_exit@plt>
lea    0xe93(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    11a8 <main+0x78>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
lea    0xe62(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%edi
call   1050 <pr_exit@plt>
lea    0xe6c(%rip),%rdi
call   1030 <system@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    11dd <main+0xad>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
lea    0xe2d(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x14(%rbp),%edi
call   1050 <pr_exit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1158 <main+0x28>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
call   1040 <fprintf@plt>
mov    %ebx,%edi
call   1050 <pr_exit@plt>
lea    0xeaf(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1186 <main+0x56>
mov    0x2e68(%rip),%rax
mov    (%rax),%edi
lea    0xe84(%rip),%rsi
call   1040 <fprintf@plt>
mov    %ebx,%edi
call   1050 <pr_exit@plt>
lea    0xe8f(%rip),%rdi
call   1030 <system@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    11b4 <main+0x84>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
lea    0xe56(%rip),%rsi
call   1040 <fprintf@plt>
mov    %ebx,%edi
call   1050 <pr_exit@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"date\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"system() error\0A\00"
@.str.2 = [14 x i8] c"nosuchcommand\00"
@.str.3 = [13 x i8] c"who; exit 44\00"
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 @system(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %7, i32* %6
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %9, %2
%13 = load i32, i32* %6
%14 = call i32 @pr_exit(i32 %13)
%15 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 %15, i32* %6
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %17, %12
%21 = load i32, i32* %6
%22 = call i32 @pr_exit(i32 %21)
%23 = call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
store i32 %23, i32* %6
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %25, %20
%29 = load i32, i32* %6
%30 = call i32 @pr_exit(i32 %29)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"date\00"
@stderr = global i32 0
@.str.1 = [16 x i8] c"system() error\0A\00"
@.str.2 = [14 x i8] c"nosuchcommand\00"
@.str.3 = [13 x i8] c"who; exit 44\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @system(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %5, %2
%9 = tail call i32 @pr_exit(i32 %3)
%10 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %12, %8
%16 = tail call i32 @pr_exit(i32 %10)
%17 = tail call i32 @system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* @stderr
%21 = tail call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %19, %15
%23 = tail call i32 @pr_exit(i32 %17)
ret i32 0
}