#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;
struct tm {
  int dummy;
};

/* Variables and functions */
int execcmd(char **, int, struct tm);
int isBG(char *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ prompt();
int /*<<< orphan*/ readline(char *, int);
int /*<<< orphan*/ splitcommand(char *, char **);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  char line[2048];
  char *cmd[1024];
  time_t t = time(NULL);
  struct tm start = *localtime(&t);
  int execstat;
  int bg = 0;
  do {
    prompt();
    readline(line, 2048);
    bg = isBG(line);
    splitcommand(line, cmd);
    execstat = execcmd(cmd, bg, start);
  } while (execstat == 1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2820,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1080 <time@plt>
mov    %eax,-0x2814(%rbp)
lea    -0x2814(%rbp),%rdi
call   1040 <localtime@plt>
mov    (%rax),%eax
mov    %eax,-0x2818(%rbp)
movl   $0x0,-0x2820(%rbp)
mov    $0x0,%al
call   1060 <prompt@plt>
lea    -0x810(%rbp),%rdi
mov    $0x800,%esi
call   1070 <readline@plt>
lea    -0x810(%rbp),%rdi
call   1030 <isBG@plt>
mov    %eax,-0x2820(%rbp)
lea    -0x810(%rbp),%rdi
lea    -0x2810(%rbp),%rsi
call   1090 <splitcommand@plt>
lea    -0x2810(%rbp),%rdi
mov    -0x2820(%rbp),%esi
mov    -0x2818(%rbp),%edx
call   1050 <execcmd@plt>
mov    %eax,-0x281c(%rbp)
cmpl   $0x1,-0x281c(%rbp)
je     11b6 <main+0x46>
mov    -0x4(%rbp),%eax
add    $0x2820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x2818,%rsp
xor    %edi,%edi
call   1080 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1040 <localtime@plt>
mov    (%rax),%r14d
lea    0x10(%rsp),%rbx
lea    0x810(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <prompt@plt>
mov    %rbx,%rdi
mov    $0x800,%esi
call   1070 <readline@plt>
mov    %rbx,%rdi
call   1030 <isBG@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <splitcommand@plt>
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1050 <execcmd@plt>
cmp    $0x1,%eax
je     11b0 <main+0x40>
xor    %eax,%eax
add    $0x2818,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2048 x i8]
%7 = alloca [1024 x i8*]
%8 = alloca i32
%9 = alloca %struct.tm
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 @time(i32* null)
store i32 %12, i32* %8
%13 = call %struct.tm* @localtime(i32* %8)
%14 = bitcast %struct.tm* %9 to i8*
%15 = bitcast %struct.tm* %13 to i8*
store i32 0, i32* %11
br label %16
16: ; preds = %30, %2
%17 = call i32 (...) @prompt()
%18 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%19 = call i32 @readline(i8* %18, i32 2048)
%20 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%21 = call i32 @isBG(i8* %20)
store i32 %21, i32* %11
%22 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%23 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %7, i64 0, i64 0
%24 = call i32 @splitcommand(i8* %22, i8** %23)
%25 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %7, i64 0, i64 0
%26 = load i32, i32* %11
%27 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
%28 = load i32, i32* %27
%29 = call i32 @execcmd(i8** %25, i32 %26, i32 %28)
store i32 %29, i32* %10
br label %30
30: ; preds = %16
%31 = load i32, i32* %10
%32 = icmp eq i32 %31, 1
br i1 %32, label %16, label %33
33: ; preds = %30
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2048 x i8]
%4 = alloca [1024 x i8*]
%5 = alloca i32
%6 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%7 = bitcast [1024 x i8*]* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = tail call i32 @time(i32* null)
store i32 %9, i32* %5
%10 = call %struct.tm* @localtime(i32* %5)
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i64 0, i32 0
%12 = load i32, i32* %11
%13 = getelementptr inbounds [1024 x i8*], [1024 x i8*]* %4, i64 0, i64 0
br label %14
14: ; preds = %14, %2
%15 = call i32 (...) @prompt()
%16 = call i32 @readline(i8* %6, i32 2048)
%17 = call i32 @isBG(i8* %6)
%18 = call i32 @splitcommand(i8* %6, i8** %13)
%19 = call i32 @execcmd(i8** %13, i32 %17, i32 %12)
%20 = icmp eq i32 %19, 1
br i1 %20, label %14, label %21
21: ; preds = %14
ret i32 0
}