#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 */
int /*<<< orphan*/ atol(char const *);
int /*<<< orphan*/ display_row(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ time_at_start_of_day();
int main(int argc, const char **argv) {
  display_row("now", time(NULL));
  display_row("start of day", time_at_start_of_day());
  int i;
  for (i = 1; i < argc; ++i) {
    display_row(argv[i], atol(argv[i]));
  }
  if (argc == 1) {
    printf("(you can provide time_t args on the command line)\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,%esi
lea    0xe88(%rip),%rdi
call   1030 <display_row@plt>
mov    $0x0,%al
call   1070 <time_at_start_of_day@plt>
mov    %eax,%esi
lea    0xe77(%rip),%rdi
call   1030 <display_row@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11df <main+0x8f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <atol@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1030 <display_row@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1199 <main+0x49>
cmpl   $0x1,-0x8(%rbp)
jne    11f5 <main+0xa5>
lea    0xe21(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r15
mov    %edi,%r14d
xor    %edi,%edi
call   1050 <time@plt>
lea    0xe94(%rip),%rdi
mov    %eax,%esi
call   1040 <display_row@plt>
xor    %eax,%eax
call   1070 <time_at_start_of_day@plt>
lea    0xe83(%rip),%rdi
mov    %eax,%esi
call   1040 <display_row@plt>
cmp    $0x2,%r14d
jl     11bf <main+0x6f>
mov    %r14d,%r12d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rbp
mov    %rbp,%rdi
call   1060 <atol@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1040 <display_row@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    11a0 <main+0x50>
cmp    $0x1,%r14d
jne    11d1 <main+0x81>
lea    0xe45(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"now\00"
@.str.1 = [13 x i8] c"start of day\00"
@.str.2 = [51 x i8] c"(you can provide time_t args on the command line)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @time(i32* null)
%8 = call i32 @display_row(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 (...) @time_at_start_of_day()
%10 = call i32 @display_row(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %9)
store i32 1, i32* %6
br label %11
11: ; preds = %28, %2
%12 = load i32, i32* %6
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %31
15: ; preds = %11
%16 = load i8**, i8*** %5
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8*, i8** %16, i64 %18
%20 = load i8*, i8** %19
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @atol(i8* %25)
%27 = call i32 @display_row(i8* %20, i32 %26)
br label %28
28: ; preds = %15
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %11
31: ; preds = %11
%32 = load i32, i32* %4
%33 = icmp eq i32 %32, 1
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
br label %36
36: ; preds = %34, %31
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"now\00"
@.str.1 = [13 x i8] c"start of day\00"
@str = [50 x i8] c"(you can provide time_t args on the command line)\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @display_row(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (...) @time_at_start_of_day()
%6 = tail call i32 @display_row(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = icmp sgt i32 %0, 1
br i1 %7, label %8, label %18
8: ; preds = %2
%9 = zext i32 %0 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 1, %8 ], [ %16, %10 ]
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = tail call i32 @atol(i8* %13)
%15 = tail call i32 @display_row(i8* %13, i32 %14)
%16 = add nuw nsw i64 %11, 1
%17 = icmp eq i64 %16, %9
br i1 %17, label %18, label %10
18: ; preds = %10, %2
%19 = icmp eq i32 %0, 1
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
br label %22
22: ; preds = %20, %18
ret i32 0
}