#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 pid_t;

/* Variables and functions */
scalar_t__ WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
int cc_up_is_valid_system_return(pid_t status, char *command) {
  if (status == -1) {

    ;
    return -1;
  } else {

    ;
    if (WIFEXITED(status)) {
      if (0 == WEXITSTATUS(status)) {

        ;
        return 0;
      } else {

        ;
        return -1;
      }
    } else {

      ;
      return -1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<cc_up_is_valid_system_return>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1145 <cc_up_is_valid_system_return+0x25>
movl   $0xffffffff,-0x4(%rbp)
jmp    118c <cc_up_is_valid_system_return+0x6c>
mov    -0x8(%rbp),%edi
call   1040 <WIFEXITED@plt>
cmp    $0x0,%rax
je     1185 <cc_up_is_valid_system_return+0x65>
mov    -0x8(%rbp),%edi
call   1030 <WEXITSTATUS@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1179 <cc_up_is_valid_system_return+0x59>
movl   $0x0,-0x4(%rbp)
jmp    118c <cc_up_is_valid_system_return+0x6c>
movl   $0xffffffff,-0x4(%rbp)
jmp    118c <cc_up_is_valid_system_return+0x6c>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cc_up_is_valid_system_return>:
push   %rbp
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
cmp    $0xffffffff,%edi
je     1145 <cc_up_is_valid_system_return+0x25>
mov    %edi,%ebp
call   1040 <WIFEXITED@plt>
test   %rax,%rax
je     1145 <cc_up_is_valid_system_return+0x25>
mov    %ebp,%edi
call   1030 <WEXITSTATUS@plt>
neg    %rax
sbb    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cc_up_is_valid_system_return(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 -1, i32* %3
br label %20
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i64 @WIFEXITED(i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %9
%14 = load i32, i32* %4
%15 = call i64 @WEXITSTATUS(i32 %14)
%16 = icmp eq i64 0, %15
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 0, i32* %3
br label %20
18: ; preds = %13
store i32 -1, i32* %3
br label %20
19: ; preds = %9
store i32 -1, i32* %3
br label %20
20: ; preds = %19, %18, %17, %8
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @cc_up_is_valid_system_return(i32 %0, i8* nocapture readnone %1) {
%3 = icmp eq i32 %0, -1
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = tail call i64 @WIFEXITED(i32 %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call i64 @WEXITSTATUS(i32 %0)
%9 = icmp ne i64 %8, 0
%10 = sext i1 %9 to i32
br label %11
11: ; preds = %4, %7, %2
%12 = phi i32 [ -1, %2 ], [ %10, %7 ], [ -1, %4 ]
ret i32 %12
}