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

/* Variables and functions */
int atoi(char *);
int difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  int i, start;
  time_t last = time(NULL), now;
  if (argc > 1)
    start = atoi(argv[1]);
  else
    start = 30;
  for (i = start; i > 0; i--) {
    fprintf(stdout, "%d\n", i);
    fflush(stdout);
    sleep(1);
    now = time(NULL);
    if (difftime(now, last) > 2)
      fprintf(stdout, "JobSuspended\n");
    last = now;
  }
  fprintf(stdout, "AllDone\n");
  return (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)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11a1 <main+0x41>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    11a8 <main+0x48>
movl   $0x1e,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1235 <main+0xd5>
mov    0x2e21(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe35(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1030 <difftime@plt>
cmp    $0x2,%eax
jle    1221 <main+0xc1>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
lea    0xdea(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11ae <main+0x4e>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
lea    0xdcd(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%r12d
mov    $0x1e,%ebx
cmp    $0x2,%ebp
jl     1193 <main+0x33>
mov    0x8(%r14),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    1208 <main+0xa8>
mov    0x2e46(%rip),%r13
lea    0xe5f(%rip),%r14
lea    0xe5c(%rip),%r15
jmp    11bd <main+0x5d>
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%eax
mov    %ebp,%r12d
cmp    $0x1,%ebx
mov    %eax,%ebx
jle    1208 <main+0xa8>
mov    0x0(%r13),%edi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
call   1060 <fflush@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r12d,%esi
call   1030 <difftime@plt>
cmp    $0x3,%eax
jl     11b0 <main+0x50>
mov    0x0(%r13),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11b0 <main+0x50>
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
lea    0xdfa(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [14 x i8] c"JobSuspended\0A\00"
@.str.2 = [9 x i8] c"AllDone\0A\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
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 @time(i32* null)
store i32 %10, i32* %8
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %7
br label %19
18: ; preds = %2
store i32 30, i32* %7
br label %19
19: ; preds = %18, %13
%20 = load i32, i32* %7
store i32 %20, i32* %6
br label %21
21: ; preds = %41, %19
%22 = load i32, i32* %6
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %44
24: ; preds = %21
%25 = load i32, i32* @stdout
%26 = load i32, i32* %6
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %26)
%28 = load i32, i32* @stdout
%29 = call i32 @fflush(i32 %28)
%30 = call i32 @sleep(i32 1)
%31 = call i32 @time(i32* null)
store i32 %31, i32* %9
%32 = load i32, i32* %9
%33 = load i32, i32* %8
%34 = call i32 @difftime(i32 %32, i32 %33)
%35 = icmp sgt i32 %34, 2
br i1 %35, label %36, label %39
36: ; preds = %24
%37 = load i32, i32* @stdout
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %39
39: ; preds = %36, %24
%40 = load i32, i32* %9
store i32 %40, i32* %8
br label %41
41: ; preds = %39
%42 = load i32, i32* %6
%43 = add nsw i32 %42, -1
store i32 %43, i32* %6
br label %21
44: ; preds = %21
%45 = load i32, i32* @stdout
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [14 x i8] c"JobSuspended\0A\00"
@.str.2 = [9 x i8] c"AllDone\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @time(i32* null)
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %2, %5
%11 = phi i32 [ 30, %2 ], [ %8, %5 ]
br label %12
12: ; preds = %10, %26
%13 = phi i32 [ %27, %26 ], [ %11, %10 ]
%14 = phi i32 [ %20, %26 ], [ %3, %10 ]
%15 = load i32, i32* @stdout
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%17 = load i32, i32* @stdout
%18 = tail call i32 @fflush(i32 %17)
%19 = tail call i32 @sleep(i32 1)
%20 = tail call i32 @time(i32* null)
%21 = tail call i32 @difftime(i32 %20, i32 %14)
%22 = icmp sgt i32 %21, 2
br i1 %22, label %23, label %26
23: ; preds = %12
%24 = load i32, i32* @stdout
%25 = tail call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %23, %12
%27 = add nsw i32 %13, -1
%28 = icmp sgt i32 %13, 1
br i1 %28, label %12, label %29
29: ; preds = %26, %5
%30 = load i32, i32* @stdout
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}