#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 _system(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int main(int argc, char *argv[]) {
  int status;
  if ((status = _system("date")) < 0) {
    perror("_system(\"date\")");
    exit(-1);
  }
  if ((status = _system("nosuchcommand")) < 0) {
    perror("_system(nosuchcommand)");
    exit(-1);
  }
  if ((status = _system("who; exit 44")) < 0) {
    perror("_system(who;exit 44)");
    exit(-1);
  }
  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   1050 <_system@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1174 <main+0x44>
lea    0xea0(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
lea    0xe9a(%rip),%rdi
call   1050 <_system@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    11a2 <main+0x72>
lea    0xe90(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
lea    0xe91(%rip),%rdi
call   1050 <_system@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    11d0 <main+0xa0>
lea    0xe86(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <_system@plt>
test   %eax,%eax
js     1165 <main+0x35>
lea    0xecd(%rip),%rdi
call   1050 <_system@plt>
test   %eax,%eax
js     116e <main+0x3e>
lea    0xee2(%rip),%rdi
call   1050 <_system@plt>
test   %eax,%eax
js     1177 <main+0x47>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe99(%rip),%rdi
jmp    117e <main+0x4e>
lea    0xeae(%rip),%rdi
jmp    117e <main+0x4e>
lea    0xec9(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"date\00"
@.str.1 = [16 x i8] c"_system(\22date\22)\00"
@.str.2 = [14 x i8] c"nosuchcommand\00"
@.str.3 = [23 x i8] c"_system(nosuchcommand)\00"
@.str.4 = [13 x i8] c"who; exit 44\00"
@.str.5 = [21 x i8] c"_system(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 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %2
%13 = call i32 @_system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 %13, i32* %6
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @exit(i32 -1)
unreachable
18: ; preds = %12
%19 = call i32 @_system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
store i32 %19, i32* %6
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 @exit(i32 -1)
unreachable
24: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"date\00"
@.str.1 = [16 x i8] c"_system(\22date\22)\00"
@.str.2 = [14 x i8] c"nosuchcommand\00"
@.str.3 = [23 x i8] c"_system(nosuchcommand)\00"
@.str.4 = [13 x i8] c"who; exit 44\00"
@.str.5 = [21 x i8] c"_system(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 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = tail call i32 @_system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%13 = tail call i32 @exit(i32 -1)
unreachable
14: ; preds = %8
%15 = tail call i32 @_system(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
%19 = tail call i32 @exit(i32 -1)
unreachable
20: ; preds = %14
ret i32 0
}