#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 WEXITSTATUS(int);
scalar_t__ WIFEXITED(int);
scalar_t__ WIFSIGNALED(int);
scalar_t__ WIFSTOPPEN(int);
int WSTOPSIG(int);
int WTERMSIG(int);
int /*<<< orphan*/ printf(char *, int, ...);
void pr_exit(int status) {
  if (WIFEXITED(status))
    printf("normal termination, exit status = %d\n", WEXITSTATUS(status));
  else if (WIFSIGNALED(status))
    printf("abnormal termination, signal number = %d%s\n", WTERMSIG(status),
           "");
  else if (WIFSTOPPEN(status))
    printf("child stopped, signal number = %d\n", WSTOPSIG(status));
}


x86 assembly (clang, -O0):
<pr_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1080 <WIFEXITED@plt>
cmp    $0x0,%rax
je     11aa <pr_exit+0x3a>
mov    -0x4(%rbp),%edi
call   1070 <WEXITSTATUS@plt>
mov    %eax,%esi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1214 <pr_exit+0xa4>
mov    -0x4(%rbp),%edi
call   1040 <WIFSIGNALED@plt>
cmp    $0x0,%rax
je     11e0 <pr_exit+0x70>
mov    -0x4(%rbp),%edi
call   1060 <WTERMSIG@plt>
mov    %eax,%esi
lea    0xe59(%rip),%rdi
lea    0xea0(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120f <pr_exit+0x9f>
mov    -0x4(%rbp),%edi
call   1050 <WIFSTOPPEN@plt>
cmp    $0x0,%rax
je     120a <pr_exit+0x9a>
mov    -0x4(%rbp),%edi
call   1090 <WSTOPSIG@plt>
mov    %eax,%esi
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120f <pr_exit+0x9f>
jmp    1214 <pr_exit+0xa4>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_exit>:
push   %rbx
mov    %edi,%ebx
call   1080 <WIFEXITED@plt>
test   %rax,%rax
je     1195 <pr_exit+0x25>
mov    %ebx,%edi
call   1070 <WEXITSTATUS@plt>
lea    0xe75(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>
mov    %ebx,%edi
call   1040 <WIFSIGNALED@plt>
test   %rax,%rax
je     11c0 <pr_exit+0x50>
mov    %ebx,%edi
call   1060 <WTERMSIG@plt>
lea    0xe77(%rip),%rdi
lea    0xebe(%rip),%rdx
mov    %eax,%esi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>
mov    %ebx,%edi
call   1050 <WIFSTOPPEN@plt>
test   %rax,%rax
je     11dc <pr_exit+0x6c>
mov    %ebx,%edi
call   1090 <WSTOPSIG@plt>
lea    0xe78(%rip),%rdi
jmp    118b <pr_exit+0x1b>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"normal termination, exit status = %d\0A\00"
@.str.1 = [44 x i8] c"abnormal termination, signal number = %d%s\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [35 x i8] c"child stopped, signal number = %d\0A\00"
define void @pr_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @WIFEXITED(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @WEXITSTATUS(i32 %7)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %28
10: ; preds = %1
%11 = load i32, i32* %2
%12 = call i64 @WIFSIGNALED(i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* %2
%16 = call i32 @WTERMSIG(i32 %15)
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %16, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %27
18: ; preds = %10
%19 = load i32, i32* %2
%20 = call i64 @WIFSTOPPEN(i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i32, i32* %2
%24 = call i32 @WSTOPSIG(i32 %23)
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %22, %18
br label %27
27: ; preds = %26, %14
br label %28
28: ; preds = %27, %6
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"normal termination, exit status = %d\0A\00"
@.str.1 = [44 x i8] c"abnormal termination, signal number = %d%s\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [35 x i8] c"child stopped, signal number = %d\0A\00"
define void @pr_exit(i32 %0) {
%2 = tail call i64 @WIFEXITED(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @WEXITSTATUS(i32 %0)
%6 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %19
7: ; preds = %1
%8 = tail call i64 @WIFSIGNALED(i32 %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = tail call i32 @WTERMSIG(i32 %0)
%12 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %19
13: ; preds = %7
%14 = tail call i64 @WIFSTOPPEN(i32 %0)
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = tail call i32 @WSTOPSIG(i32 %0)
%18 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %10, %16, %13, %4
ret void
}