#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 scalar_t__ time_t;

/* Variables and functions */
int atoi(char *);
int difftime(scalar_t__, scalar_t__);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdout;
scalar_t__ 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, "%2.2d  %u\n", i, (unsigned)last);
    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    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11a2 <main+0x42>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x18(%rbp)
jmp    11a9 <main+0x49>
movl   $0x1e,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1241 <main+0xe1>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rax
mov    %eax,%ecx
lea    0xe2e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e00(%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    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <difftime@plt>
cmp    $0x2,%eax
jle    122b <main+0xcb>
mov    0x2dc5(%rip),%rax
mov    (%rax),%edi
lea    0xde7(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11af <main+0x4f>
mov    0x2d98(%rip),%rax
mov    (%rax),%edi
lea    0xdc8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%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,%rbx
mov    %edi,%ebp
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,%r15
mov    $0x1e,%r13d
cmp    $0x2,%ebp
jl     1195 <main+0x35>
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
mov    %eax,%r13d
test   %eax,%eax
jle    120e <main+0xae>
mov    0x2e44(%rip),%rbp
lea    0xe5d(%rip),%r14
lea    0xe61(%rip),%r12
jmp    11c0 <main+0x60>
nopl   0x0(%rax)
lea    -0x1(%r13),%eax
mov    %rbx,%r15
cmp    $0x1,%r13d
mov    %eax,%r13d
jle    120e <main+0xae>
mov    0x0(%rbp),%edi
mov    %r14,%rsi
mov    %r13d,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    0x0(%rbp),%edi
call   1060 <fflush@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
xor    %edi,%edi
call   1050 <time@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <difftime@plt>
cmp    $0x3,%eax
jl     11b0 <main+0x50>
mov    0x0(%rbp),%edi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    11b0 <main+0x50>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
lea    0xdfb(%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 = [11 x i8] c"%2.2d %u\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 i64
%9 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i64 @time(i32* null)
store i64 %10, i64* %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 = %43, %19
%22 = load i32, i32* %6
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %46
24: ; preds = %21
%25 = load i32, i32* @stdout
%26 = load i32, i32* %6
%27 = load i64, i64* %8
%28 = trunc i64 %27 to i32
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %26, i32 %28)
%30 = load i32, i32* @stdout
%31 = call i32 @fflush(i32 %30)
%32 = call i32 @sleep(i32 1)
%33 = call i64 @time(i32* null)
store i64 %33, i64* %9
%34 = load i64, i64* %9
%35 = load i64, i64* %8
%36 = call i32 @difftime(i64 %34, i64 %35)
%37 = icmp sgt i32 %36, 2
br i1 %37, label %38, label %41
38: ; preds = %24
%39 = load i32, i32* @stdout
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %41
41: ; preds = %38, %24
%42 = load i64, i64* %9
store i64 %42, i64* %8
br label %43
43: ; preds = %41
%44 = load i32, i32* %6
%45 = add nsw i32 %44, -1
store i32 %45, i32* %6
br label %21
46: ; preds = %21
%47 = load i32, i32* @stdout
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, 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 = [11 x i8] c"%2.2d %u\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 i64 @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 %30
10: ; preds = %2, %5
%11 = phi i32 [ 30, %2 ], [ %8, %5 ]
br label %12
12: ; preds = %10, %27
%13 = phi i32 [ %28, %27 ], [ %11, %10 ]
%14 = phi i64 [ %21, %27 ], [ %3, %10 ]
%15 = load i32, i32* @stdout
%16 = trunc i64 %14 to i32
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %16)
%18 = load i32, i32* @stdout
%19 = tail call i32 @fflush(i32 %18)
%20 = tail call i32 @sleep(i32 1)
%21 = tail call i64 @time(i32* null)
%22 = tail call i32 @difftime(i64 %21, i64 %14)
%23 = icmp sgt i32 %22, 2
br i1 %23, label %24, label %27
24: ; preds = %12
%25 = load i32, i32* @stdout
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %24, %12
%28 = add nsw i32 %13, -1
%29 = icmp sgt i32 %13, 1
br i1 %29, label %12, label %30
30: ; preds = %27, %5
%31 = load i32, i32* @stdout
%32 = tail call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}