#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 /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SIGTSTP;
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ getpid();
scalar_t__ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int i, secs;
  pid_t pid;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s <n>\n", argv[0]);
    exit(0);
  }
  secs = atoi(argv[1]);
  for (i = 0; i < secs; i++)
    sleep(1);
  pid = getpid();
  if (kill(-pid, SIGTSTP) < 0)
    fprintf(stderr, "kill (tstp) error");
  exit(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)
cmpl   $0x2,-0x8(%rbp)
je     11a5 <main+0x45>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11e0 <main+0x80>
mov    $0x1,%edi
call   1080 <sleep@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11bc <main+0x5c>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x1c(%rbp)
xor    %edi,%edi
sub    -0x1c(%rbp),%edi
mov    0x2df2(%rip),%rax
mov    (%rax),%esi
call   1050 <kill@plt>
cmp    $0x0,%rax
jge    121e <main+0xbe>
mov    0x2dca(%rip),%rax
mov    (%rax),%edi
lea    0xdf8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    11cb <main+0x6b>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
test   %eax,%eax
jle    118f <main+0x2f>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%edi
call   1080 <sleep@plt>
add    $0xffffffff,%ebx
jne    1180 <main+0x20>
xor    %eax,%eax
call   1030 <getpid@plt>
neg    %eax
mov    0x2e49(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1050 <kill@plt>
test   %rax,%rax
jns    11c4 <main+0x64>
mov    0x2e24(%rip),%rax
mov    (%rax),%edi
lea    0xe52(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe22(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"Usage: %s <n>\0A\00"
@SIGTSTP = global i32 0
@.str.1 = [18 x i8] c"kill (tstp) error\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 0)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %7
store i32 0, i32* %6
br label %23
23: ; preds = %29, %18
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %32
27: ; preds = %23
%28 = call i32 @sleep(i32 1)
br label %29
29: ; preds = %27
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %23
32: ; preds = %23
%33 = call i32 (...) @getpid()
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = sub nsw i32 0, %34
%36 = load i32, i32* @SIGTSTP
%37 = call i64 @kill(i32 %35, i32 %36)
%38 = icmp slt i64 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %32
%40 = load i32, i32* @stderr
%41 = call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %42
42: ; preds = %39, %32
%43 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"Usage: %s <n>\0A\00"
@SIGTSTP = global i32 0
@.str.1 = [18 x i8] c"kill (tstp) error\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9, %14
%15 = phi i32 [ %17, %14 ], [ 0, %9 ]
%16 = tail call i32 @sleep(i32 1)
%17 = add nuw nsw i32 %15, 1
%18 = icmp eq i32 %17, %12
br i1 %18, label %19, label %14
19: ; preds = %14, %9
%20 = tail call i32 (...) @getpid()
%21 = sub nsw i32 0, %20
%22 = load i32, i32* @SIGTSTP
%23 = tail call i64 @kill(i32 %21, i32 %22)
%24 = icmp slt i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %19
%26 = load i32, i32* @stderr
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %26, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %28
28: ; preds = %25, %19
%29 = tail call i32 @exit(i32 0)
unreachable
}