#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 tm_sec;
  int tm_min;
  int tm_hour;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int slide_glyph(int, int, int);
int update_time(time_t sec) {
  struct tm *tm = localtime(&sec);
  if (slide_glyph(5, tm->tm_sec % 10, 27) < 0)
    return -1;
  if (slide_glyph(4, tm->tm_sec / 10, 22) < 0)
    return -1;
  if (slide_glyph(3, tm->tm_min % 10, 16) < 0)
    return -1;
  if (slide_glyph(2, tm->tm_min / 10, 11) < 0)
    return -1;
  if (slide_glyph(1, tm->tm_hour % 10, 5) < 0)
    return -1;
  return slide_glyph(0, tm->tm_hour / 10, 0);
}


x86 assembly (clang, -O0):
<update_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x5,%edi
mov    $0x1b,%edx
call   1040 <slide_glyph@plt>
cmp    $0x0,%eax
jge    116c <update_time+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    125c <update_time+0x13c>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    $0x4,%edi
mov    $0x16,%edx
call   1040 <slide_glyph@plt>
cmp    $0x0,%eax
jge    11a0 <update_time+0x80>
movl   $0xffffffff,-0x4(%rbp)
jmp    125c <update_time+0x13c>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x3,%edi
mov    $0x10,%edx
call   1040 <slide_glyph@plt>
cmp    $0x0,%eax
jge    11d5 <update_time+0xb5>
movl   $0xffffffff,-0x4(%rbp)
jmp    125c <update_time+0x13c>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    $0x2,%edi
mov    $0xb,%edx
call   1040 <slide_glyph@plt>
cmp    $0x0,%eax
jge    120a <update_time+0xea>
movl   $0xffffffff,-0x4(%rbp)
jmp    125c <update_time+0x13c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x1,%edi
mov    $0x5,%edx
call   1040 <slide_glyph@plt>
cmp    $0x0,%eax
jge    123f <update_time+0x11f>
movl   $0xffffffff,-0x4(%rbp)
jmp    125c <update_time+0x13c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
xor    %edx,%edx
mov    %edx,%edi
call   1040 <slide_glyph@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_time>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
movslq (%rax),%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    $0x5,%edi
mov    $0x1b,%edx
call   1040 <slide_glyph@plt>
mov    $0xffffffff,%ebp
test   %eax,%eax
js     1252 <update_time+0x132>
movslq (%rbx),%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
mov    $0x4,%edi
mov    $0x16,%edx
call   1040 <slide_glyph@plt>
test   %eax,%eax
js     1252 <update_time+0x132>
movslq 0x4(%rbx),%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    $0x3,%edi
mov    $0x10,%edx
call   1040 <slide_glyph@plt>
test   %eax,%eax
js     1252 <update_time+0x132>
movslq 0x4(%rbx),%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
mov    $0x2,%edi
mov    $0xb,%edx
call   1040 <slide_glyph@plt>
test   %eax,%eax
js     1252 <update_time+0x132>
movslq 0x8(%rbx),%rsi
imul   $0x66666667,%rsi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    $0x1,%edi
mov    $0x5,%edx
call   1040 <slide_glyph@plt>
test   %eax,%eax
js     1252 <update_time+0x132>
movslq 0x8(%rbx),%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
xor    %edi,%edi
xor    %edx,%edx
call   1040 <slide_glyph@plt>
mov    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
define i32 @update_time(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.tm*
store i32 %0, i32* %3
%5 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %5, %struct.tm** %4
%6 = load %struct.tm*, %struct.tm** %4
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = srem i32 %8, 10
%10 = call i32 @slide_glyph(i32 5, i32 %9, i32 27)
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 -1, i32* %2
br label %51
13: ; preds = %1
%14 = load %struct.tm*, %struct.tm** %4
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = sdiv i32 %16, 10
%18 = call i32 @slide_glyph(i32 4, i32 %17, i32 22)
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %13
store i32 -1, i32* %2
br label %51
21: ; preds = %13
%22 = load %struct.tm*, %struct.tm** %4
%23 = getelementptr inbounds %struct.tm, %struct.tm* %22, i32 0, i32 1
%24 = load i32, i32* %23
%25 = srem i32 %24, 10
%26 = call i32 @slide_glyph(i32 3, i32 %25, i32 16)
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %21
store i32 -1, i32* %2
br label %51
29: ; preds = %21
%30 = load %struct.tm*, %struct.tm** %4
%31 = getelementptr inbounds %struct.tm, %struct.tm* %30, i32 0, i32 1
%32 = load i32, i32* %31
%33 = sdiv i32 %32, 10
%34 = call i32 @slide_glyph(i32 2, i32 %33, i32 11)
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %29
store i32 -1, i32* %2
br label %51
37: ; preds = %29
%38 = load %struct.tm*, %struct.tm** %4
%39 = getelementptr inbounds %struct.tm, %struct.tm* %38, i32 0, i32 2
%40 = load i32, i32* %39
%41 = srem i32 %40, 10
%42 = call i32 @slide_glyph(i32 1, i32 %41, i32 5)
%43 = icmp slt i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %37
store i32 -1, i32* %2
br label %51
45: ; preds = %37
%46 = load %struct.tm*, %struct.tm** %4
%47 = getelementptr inbounds %struct.tm, %struct.tm* %46, i32 0, i32 2
%48 = load i32, i32* %47
%49 = sdiv i32 %48, 10
%50 = call i32 @slide_glyph(i32 0, i32 %49, i32 0)
store i32 %50, i32* %2
br label %51
51: ; preds = %45, %44, %36, %28, %20, %12
%52 = load i32, i32* %2
ret i32 %52
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
define i32 @update_time(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call %struct.tm* @localtime(i32* %2)
%4 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 0
%5 = load i32, i32* %4
%6 = srem i32 %5, 10
%7 = call i32 @slide_glyph(i32 5, i32 %6, i32 27)
%8 = icmp slt i32 %7, 0
br i1 %8, label %35, label %9
9: ; preds = %1
%10 = load i32, i32* %4
%11 = sdiv i32 %10, 10
%12 = call i32 @slide_glyph(i32 4, i32 %11, i32 22)
%13 = icmp slt i32 %12, 0
br i1 %13, label %35, label %14
14: ; preds = %9
%15 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 1
%16 = load i32, i32* %15
%17 = srem i32 %16, 10
%18 = call i32 @slide_glyph(i32 3, i32 %17, i32 16)
%19 = icmp slt i32 %18, 0
br i1 %19, label %35, label %20
20: ; preds = %14
%21 = load i32, i32* %15
%22 = sdiv i32 %21, 10
%23 = call i32 @slide_glyph(i32 2, i32 %22, i32 11)
%24 = icmp slt i32 %23, 0
br i1 %24, label %35, label %25
25: ; preds = %20
%26 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 2
%27 = load i32, i32* %26
%28 = srem i32 %27, 10
%29 = call i32 @slide_glyph(i32 1, i32 %28, i32 5)
%30 = icmp slt i32 %29, 0
br i1 %30, label %35, label %31
31: ; preds = %25
%32 = load i32, i32* %26
%33 = sdiv i32 %32, 10
%34 = call i32 @slide_glyph(i32 0, i32 %33, i32 0)
br label %35
35: ; preds = %25, %20, %14, %9, %1, %31
%36 = phi i32 [ %34, %31 ], [ -1, %1 ], [ -1, %9 ], [ -1, %14 ], [ -1, %20 ], [ -1, %25 ]
ret i32 %36
}