int printstatus(status)
int status;
{
  int exited = 0;
  if (WIFSTOPPED(status)) {
    tprintf("[{WIFSTOPPED(s) && WSTOPSIG(s) == %s}", signame(WSTOPSIG(status)));
    status &= ~((WSTOPSIG(status)) << 8 | 0x7f);
  } else if (WIFSIGNALED(status)) {
    tprintf("[{WIFSIGNALED(s) && WTERMSIG(s) == %s%s}",
            signame(WTERMSIG(status)),
            ((status)&0200) ? " && WCOREDUMP(s)" : "");
    status &= ~(((0) << 8 | (WTERMSIG(status))) | 0x80);
  } else if (WIFEXITED(status)) {
    tprintf("[{WIFEXITED(s) && WEXITSTATUS(s) == %d}", WEXITSTATUS(status));
    exited = 1;
    status &= ~((WEXITSTATUS(status)) << 8 | (0));
  } else {
    tprintf("[%#x]", status);
    return 0;
  }
  if (status == 0)
    tprintf("]");
  else
    tprintf(" | %#x]", status);
  return exited;
}


x86 assembly (clang, -O0):
<printstatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1050 <WIFSTOPPED@plt>
cmp    $0x0,%eax
je     11e6 <printstatus+0x66>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1090 <WSTOPSIG@plt>
mov    %eax,%edi
mov    $0x0,%al
call   10a0 <signame@plt>
mov    %eax,%esi
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1040 <tprintf@plt>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1090 <WSTOPSIG@plt>
shl    $0x8,%eax
or     $0x7f,%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    12d3 <printstatus+0x153>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1030 <WIFSIGNALED@plt>
cmp    $0x0,%eax
je     125a <printstatus+0xda>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1060 <WTERMSIG@plt>
mov    %eax,%edi
mov    $0x0,%al
call   10a0 <signame@plt>
mov    %eax,%esi
mov    -0x8(%rbp),%ecx
and    $0x80,%ecx
lea    0xe41(%rip),%rdx
lea    0xe2a(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1040 <tprintf@plt>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1060 <WTERMSIG@plt>
or     $0x0,%eax
or     $0x80,%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    12ce <printstatus+0x14e>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1080 <WIFEXITED@plt>
cmp    $0x0,%eax
je     12ac <printstatus+0x12c>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1070 <WEXITSTATUS@plt>
mov    %eax,%esi
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1040 <tprintf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1070 <WEXITSTATUS@plt>
shl    $0x8,%eax
or     $0x0,%eax
xor    $0xffffffff,%eax
and    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    12c9 <printstatus+0x149>
mov    -0x8(%rbp),%esi
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1040 <tprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1307 <printstatus+0x187>
jmp    12ce <printstatus+0x14e>
jmp    12d3 <printstatus+0x153>
cmpl   $0x0,-0x8(%rbp)
jne    12f0 <printstatus+0x170>
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1040 <tprintf@plt>
jmp    1301 <printstatus+0x181>
mov    -0x8(%rbp),%esi
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1040 <tprintf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printstatus>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <WIFSTOPPED@plt>
test   %eax,%eax
je     11cc <printstatus+0x4c>
mov    %ebp,%edi
xor    %eax,%eax
call   1090 <WSTOPSIG@plt>
mov    %eax,%edi
xor    %eax,%eax
call   10a0 <signame@plt>
lea    0xe55(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <tprintf@plt>
mov    %ebp,%edi
xor    %eax,%eax
call   1090 <WSTOPSIG@plt>
shl    $0x8,%eax
xor    $0xffffff80,%eax
and    %ebp,%eax
jne    1227 <printstatus+0xa7>
jmp    1278 <printstatus+0xf8>
xor    %ebx,%ebx
mov    %ebp,%edi
xor    %eax,%eax
call   1030 <WIFSIGNALED@plt>
test   %eax,%eax
je     1239 <printstatus+0xb9>
mov    %ebp,%edi
xor    %eax,%eax
call   1060 <WTERMSIG@plt>
mov    %eax,%edi
xor    %eax,%eax
call   10a0 <signame@plt>
test   $0x80,%bpl
lea    0xe67(%rip),%rcx
lea    0xe50(%rip),%rdx
cmove  %rcx,%rdx
lea    0xe1c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <tprintf@plt>
mov    %ebp,%edi
xor    %eax,%eax
call   1060 <WTERMSIG@plt>
not    %eax
and    $0xffffff7f,%eax
and    %ebp,%eax
je     1278 <printstatus+0xf8>
lea    0xe60(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <tprintf@plt>
jmp    1286 <printstatus+0x106>
xor    %ebx,%ebx
mov    %ebp,%edi
xor    %eax,%eax
call   1080 <WIFEXITED@plt>
test   %eax,%eax
je     128f <printstatus+0x10f>
mov    %ebp,%edi
xor    %eax,%eax
call   1070 <WEXITSTATUS@plt>
lea    0xe08(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <tprintf@plt>
mov    %ebp,%edi
xor    %eax,%eax
call   1070 <WEXITSTATUS@plt>
shl    $0x8,%eax
not    %eax
mov    $0x1,%ebx
and    %ebp,%eax
jne    1227 <printstatus+0xa7>
lea    0xe15(%rip),%rdi
xor    %eax,%eax
call   1040 <tprintf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xdf2(%rip),%rdi
mov    %ebp,%esi
jmp    1230 <printstatus+0xb0>

LLVM IR (-O0):
@.str = [38 x i8] c"[{WIFSTOPPED(s) && WSTOPSIG(s) == %s}\00"
@.str.1 = [41 x i8] c"[{WIFSIGNALED(s) && WTERMSIG(s) == %s%s}\00"
@.str.2 = [17 x i8] c" && WCOREDUMP(s)\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [40 x i8] c"[{WIFEXITED(s) && WEXITSTATUS(s) == %d}\00"
@.str.5 = [6 x i8] c"[%#x]\00"
@.str.6 = [2 x i8] c"]\00"
@.str.7 = [8 x i8] c" | %#x]\00"
define i32 @printstatus(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %3
%6 = call i32 (i32, ...) bitcast (i32 (...)* @WIFSTOPPED to i32 (i32, ...)*)(i32 %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %1
%9 = load i32, i32* %3
%10 = call i32 (i32, ...) bitcast (i32 (...)* @WSTOPSIG to i32 (i32, ...)*)(i32 %9)
%11 = call i32 (i32, ...) bitcast (i32 (...)* @signame to i32 (i32, ...)*)(i32 %10)
%12 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %3
%14 = call i32 (i32, ...) bitcast (i32 (...)* @WSTOPSIG to i32 (i32, ...)*)(i32 %13)
%15 = shl i32 %14, 8
%16 = or i32 %15, 127
%17 = xor i32 %16, -1
%18 = load i32, i32* %3
%19 = and i32 %18, %17
store i32 %19, i32* %3
br label %61
20: ; preds = %1
%21 = load i32, i32* %3
%22 = call i32 (i32, ...) bitcast (i32 (...)* @WIFSIGNALED to i32 (i32, ...)*)(i32 %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %41
24: ; preds = %20
%25 = load i32, i32* %3
%26 = call i32 (i32, ...) bitcast (i32 (...)* @WTERMSIG to i32 (i32, ...)*)(i32 %25)
%27 = call i32 (i32, ...) bitcast (i32 (...)* @signame to i32 (i32, ...)*)(i32 %26)
%28 = load i32, i32* %3
%29 = and i32 %28, 128
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i64
%32 = select i1 %30, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%33 = call i32 (i8*, i32, i8*, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %27, i8* %32)
%34 = load i32, i32* %3
%35 = call i32 (i32, ...) bitcast (i32 (...)* @WTERMSIG to i32 (i32, ...)*)(i32 %34)
%36 = or i32 0, %35
%37 = or i32 %36, 128
%38 = xor i32 %37, -1
%39 = load i32, i32* %3
%40 = and i32 %39, %38
store i32 %40, i32* %3
br label %60
41: ; preds = %20
%42 = load i32, i32* %3
%43 = call i32 (i32, ...) bitcast (i32 (...)* @WIFEXITED to i32 (i32, ...)*)(i32 %42)
%44 = icmp ne i32 %43, 0
br i1 %44, label %45, label %56
45: ; preds = %41
%46 = load i32, i32* %3
%47 = call i32 (i32, ...) bitcast (i32 (...)* @WEXITSTATUS to i32 (i32, ...)*)(i32 %46)
%48 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i32 %47)
store i32 1, i32* %4
%49 = load i32, i32* %3
%50 = call i32 (i32, ...) bitcast (i32 (...)* @WEXITSTATUS to i32 (i32, ...)*)(i32 %49)
%51 = shl i32 %50, 8
%52 = or i32 %51, 0
%53 = xor i32 %52, -1
%54 = load i32, i32* %3
%55 = and i32 %54, %53
store i32 %55, i32* %3
br label %59
56: ; preds = %41
%57 = load i32, i32* %3
%58 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %57)
store i32 0, i32* %2
br label %71
59: ; preds = %45
br label %60
60: ; preds = %59, %24
br label %61
61: ; preds = %60, %8
%62 = load i32, i32* %3
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %66
64: ; preds = %61
%65 = call i32 (i8*, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %69
66: ; preds = %61
%67 = load i32, i32* %3
%68 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %66, %64
%70 = load i32, i32* %4
store i32 %70, i32* %2
br label %71
71: ; preds = %69, %56
%72 = load i32, i32* %2
ret i32 %72
}

LLVM IR (-O2):
@.str = [38 x i8] c"[{WIFSTOPPED(s) && WSTOPSIG(s) == %s}\00"
@.str.1 = [41 x i8] c"[{WIFSIGNALED(s) && WTERMSIG(s) == %s%s}\00"
@.str.2 = [17 x i8] c" && WCOREDUMP(s)\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [40 x i8] c"[{WIFEXITED(s) && WEXITSTATUS(s) == %d}\00"
@.str.5 = [6 x i8] c"[%#x]\00"
@.str.6 = [2 x i8] c"]\00"
@.str.7 = [8 x i8] c" | %#x]\00"
define i32 @printstatus(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @WIFSTOPPED to i32 (i32, ...)*)(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @WSTOPSIG to i32 (i32, ...)*)(i32 %0)
%6 = tail call i32 (i32, ...) bitcast (i32 (...)* @signame to i32 (i32, ...)*)(i32 %5)
%7 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @WSTOPSIG to i32 (i32, ...)*)(i32 %0)
%9 = shl i32 %8, 8
%10 = xor i32 %9, -128
br label %35
11: ; preds = %1
%12 = tail call i32 (i32, ...) bitcast (i32 (...)* @WIFSIGNALED to i32 (i32, ...)*)(i32 %0)
%13 = icmp eq i32 %12, 0
br i1 %13, label %24, label %14
14: ; preds = %11
%15 = tail call i32 (i32, ...) bitcast (i32 (...)* @WTERMSIG to i32 (i32, ...)*)(i32 %0)
%16 = tail call i32 (i32, ...) bitcast (i32 (...)* @signame to i32 (i32, ...)*)(i32 %15)
%17 = and i32 %0, 128
%18 = icmp eq i32 %17, 0
%19 = select i1 %18, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0)
%20 = tail call i32 (i8*, i32, i8*, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, i32, i8*, ...)*)(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* %19)
%21 = tail call i32 (i32, ...) bitcast (i32 (...)* @WTERMSIG to i32 (i32, ...)*)(i32 %0)
%22 = or i32 %21, 128
%23 = xor i32 %22, -1
br label %35
24: ; preds = %11
%25 = tail call i32 (i32, ...) bitcast (i32 (...)* @WIFEXITED to i32 (i32, ...)*)(i32 %0)
%26 = icmp eq i32 %25, 0
br i1 %26, label %33, label %27
27: ; preds = %24
%28 = tail call i32 (i32, ...) bitcast (i32 (...)* @WEXITSTATUS to i32 (i32, ...)*)(i32 %0)
%29 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i32 %28)
%30 = tail call i32 (i32, ...) bitcast (i32 (...)* @WEXITSTATUS to i32 (i32, ...)*)(i32 %0)
%31 = shl i32 %30, 8
%32 = xor i32 %31, -1
br label %35
33: ; preds = %24
%34 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %0)
br label %44
35: ; preds = %14, %27, %4
%36 = phi i32 [ %10, %4 ], [ %23, %14 ], [ %32, %27 ]
%37 = phi i32 [ 0, %4 ], [ 0, %14 ], [ 1, %27 ]
%38 = and i32 %36, %0
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %35
%41 = tail call i32 (i8*, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %44
42: ; preds = %35
%43 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @tprintf to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i32 %38)
br label %44
44: ; preds = %40, %42, %33
%45 = phi i32 [ 0, %33 ], [ %37, %42 ], [ %37, %40 ]
ret i32 %45
}