#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 /*<<< orphan*/ ctime(int /*<<< orphan*/ *);
int lcd_put_str(char *);
int lcd_reset_pos();
int /*<<< orphan*/ msleep(int);
int /*<<< orphan*/ printf(char *, char *);
size_t strlen(char *);
int /*<<< orphan*/ strncpy(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int ret;
  size_t len;
  char buf[33];
  time_t t;
  while (1) {
    t = time(NULL);
    strncpy(buf, ctime(&t), 33);
    len = strlen(buf);
    if (len > 0)
      buf[len - 1] = '\0';
    printf("Time is: %s\n", buf);
    ret = lcd_reset_pos();
    if (ret)
      return ret;
    ret = lcd_put_str(buf);
    if (ret)
      return ret;
    msleep(1000);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,-0x54(%rbp)
lea    -0x50(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x54(%rbp),%rdi
call   1040 <ctime@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%esi
mov    $0x21,%edx
call   1030 <strncpy@plt>
lea    -0x50(%rbp),%rdi
call   1060 <strlen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jbe    11e8 <main+0x68>
mov    -0x20(%rbp),%rax
sub    $0x1,%rax
movb   $0x0,-0x50(%rbp,%rax,1)
lea    -0x50(%rbp),%rsi
lea    0xe0d(%rip),%rdi
call   1080 <printf@plt>
mov    $0x0,%al
call   1050 <lcd_reset_pos@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1217 <main+0x97>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1247 <main+0xc7>
lea    -0x50(%rbp),%rdi
call   10a0 <lcd_put_str@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1238 <main+0xb8>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1247 <main+0xc7>
mov    $0x3e8,%edi
call   1070 <msleep@plt>
jmp    1196 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xc(%rsp),%r14
lea    0x10(%rsp),%rbx
lea    0xe66(%rip),%r15
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,0xc(%rsp)
mov    %r14,%rdi
call   1040 <ctime@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x21,%edx
call   1030 <strncpy@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
test   %rax,%rax
je     11d4 <main+0x54>
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <printf@plt>
xor    %eax,%eax
call   1050 <lcd_reset_pos@plt>
test   %eax,%eax
jne    1202 <main+0x82>
mov    %rbx,%rdi
call   10a0 <lcd_put_str@plt>
test   %eax,%eax
jne    1202 <main+0x82>
mov    $0x3e8,%edi
call   1070 <msleep@plt>
jmp    11a0 <main+0x20>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Time is: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca [33 x i8]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %2, %38
%11 = call i32 @time(i32* null)
store i32 %11, i32* %9
%12 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%13 = call i32 @ctime(i32* %9)
%14 = call i32 @strncpy(i8* %12, i32 %13, i32 33)
%15 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%16 = call i64 @strlen(i8* %15)
store i64 %16, i64* %7
%17 = load i64, i64* %7
%18 = icmp ugt i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %10
%20 = load i64, i64* %7
%21 = sub i64 %20, 1
%22 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 %21
store i8 0, i8* %22
br label %23
23: ; preds = %19, %10
%24 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = call i32 (...) @lcd_reset_pos()
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %23
%30 = load i32, i32* %6
store i32 %30, i32* %3
br label %40
31: ; preds = %23
%32 = getelementptr inbounds [33 x i8], [33 x i8]* %8, i64 0, i64 0
%33 = call i32 @lcd_put_str(i8* %32)
store i32 %33, i32* %6
%34 = load i32, i32* %6
%35 = icmp ne i32 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = load i32, i32* %6
store i32 %37, i32* %3
br label %40
38: ; preds = %31
%39 = call i32 @msleep(i32 1000)
br label %10
40: ; preds = %36, %29
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str = [13 x i8] c"Time is: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [33 x i8]
%4 = alloca i32
%5 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 0
%6 = bitcast i32* %4 to i8*
br label %7
7: ; preds = %23, %2
%8 = call i32 @time(i32* null)
store i32 %8, i32* %4
%9 = call i32 @ctime(i32* %4)
%10 = call i32 @strncpy(i8* %5, i32 %9, i32 33)
%11 = call i64 @strlen(i8* %5)
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = add i64 %11, -1
%15 = getelementptr inbounds [33 x i8], [33 x i8]* %3, i64 0, i64 %14
store i8 0, i8* %15
br label %16
16: ; preds = %13, %7
%17 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %5)
%18 = call i32 (...) @lcd_reset_pos()
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = call i32 @lcd_put_str(i8* %5)
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 @msleep(i32 1000)
br label %7
25: ; preds = %20, %16
%26 = phi i32 [ %18, %16 ], [ %21, %20 ]
ret i32 %26
}