#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 */
char *StripPath(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, char *);
void PrintUsage(char *pgmName) {
  char *actualName;
  if (!(actualName = StripPath(pgmName)))
    actualName = "sigtrap";
  printf(
      "\n"
      "  program: %s - trap and report process control signals\n\n"
      "    usage:\n\n"
      "      %s [seconds]\n\n"
      "      where [seconds] is the lifetime of the program - default = "
      "20s.\n\n"
      "    the program sleeps for a second, reports process id and tick count\n"
      "    before sleeping again. any process control signals: SIGINT, "
      "SIGQUIT\n"
      "    SIGHUP, SIGTERM, SIGABRT, SIGCONT, SIGTSTP, are trapped and\n"
      "    reported before being actioned.\n\n",
      actualName, actualName);
  exit(127);
}


x86 assembly (clang, -O0):
<PrintUsage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <StripPath@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    115e <PrintUsage+0x2e>
lea    0xea6(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    $0x7f,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<PrintUsage>:
push   %rax
call   1040 <StripPath@plt>
test   %rax,%rax
lea    0xec0(%rip),%rdx
cmovne %rax,%rdx
lea    0xebd(%rip),%rdi
mov    %rdx,%rsi
call   1030 <printf@plt>
mov    $0x7f,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"sigtrap\00"
@.str.1 = [406 x i8] c"\0A program: %s - trap and report process control signals\0A\0A usage:\0A\0A %s [seconds]\0A\0A where [seconds] is the lifetime of the program - default = 20s.\0A\0A the program sleeps for a second, reports process id and tick count\0A before sleeping again. any process control signals: SIGINT, SIGQUIT\0A SIGHUP, SIGTERM, SIGABRT, SIGCONT, SIGTSTP, are trapped and\0A reported before being actioned.\0A\0A\00"
define void @PrintUsage(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @StripPath(i8* %4)
store i8* %5, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %8, label %7
7: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %3
br label %8
8: ; preds = %7, %1
%9 = load i8*, i8** %3
%10 = load i8*, i8** %3
%11 = call i32 @printf(i8* getelementptr inbounds ([406 x i8], [406 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %10)
%12 = call i32 @exit(i32 127)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"sigtrap\00"
@.str.1 = [406 x i8] c"\0A program: %s - trap and report process control signals\0A\0A usage:\0A\0A %s [seconds]\0A\0A where [seconds] is the lifetime of the program - default = 20s.\0A\0A the program sleeps for a second, reports process id and tick count\0A before sleeping again. any process control signals: SIGINT, SIGQUIT\0A SIGHUP, SIGTERM, SIGABRT, SIGCONT, SIGTSTP, are trapped and\0A reported before being actioned.\0A\0A\00"
define void @PrintUsage(i8* %0) {
%2 = tail call i8* @StripPath(i8* %0)
%3 = icmp eq i8* %2, null
%4 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([406 x i8], [406 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* %4)
%6 = tail call i32 @exit(i32 127)
unreachable
}