#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*/ move(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mvprintw(int, int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ refresh();
void show_uhr(int h, int m, int s) {
  int slight = s % 2, h1light = h / 5, h2light = h % 5, m1light = m / 5,
      m2light = m % 5;
  static int first_draw = 1;
  mvprintw(1, 0, "Second light: %s\n", slight == 1 ? "on " : "off");
  if ((s < 2) || (first_draw != 0)) {
    mvprintw(4, 0, "Minute row 1: %d lit", m1light);
    mvprintw(5, 0, "Minute row 2: %d lit", m2light);
    if ((m == 0) || (first_draw != 0)) {
      mvprintw(2, 0, "Hour row 1: %d lit", h1light);
      mvprintw(3, 0, "Hour row 2: %d lit", h2light);
    }
  }
  mvprintw(0, 0, "first_draw=%d", first_draw);
  move(0, 0);
  refresh();
  if (1 == first_draw)
    first_draw = 0;
}


x86 assembly (clang, -O0):
<show_uhr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x20(%rbp)
mov    -0x10(%rbp),%edx
lea    0xe85(%rip),%rcx
lea    0xe7a(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%rcx
mov    $0x1,%edi
xor    %esi,%esi
lea    0xe53(%rip),%rdx
mov    $0x0,%al
call   1040 <mvprintw@plt>
cmpl   $0x2,-0xc(%rbp)
jl     11cb <show_uhr+0x9b>
cmpl   $0x0,0x2e73(%rip)
je     1247 <show_uhr+0x117>
mov    -0x1c(%rbp),%ecx
mov    $0x4,%edi
xor    %esi,%esi
lea    0xe3e(%rip),%rdx
mov    $0x0,%al
call   1040 <mvprintw@plt>
mov    -0x20(%rbp),%ecx
mov    $0x5,%edi
xor    %esi,%esi
lea    0xe3b(%rip),%rdx
mov    $0x0,%al
call   1040 <mvprintw@plt>
cmpl   $0x0,-0x8(%rbp)
je     1212 <show_uhr+0xe2>
cmpl   $0x0,0x2e2c(%rip)
je     1242 <show_uhr+0x112>
mov    -0x14(%rbp),%ecx
mov    $0x2,%edi
xor    %esi,%esi
lea    0xe21(%rip),%rdx
mov    $0x0,%al
call   1040 <mvprintw@plt>
mov    -0x18(%rbp),%ecx
mov    $0x3,%edi
xor    %esi,%esi
lea    0xe1c(%rip),%rdx
mov    $0x0,%al
call   1040 <mvprintw@plt>
jmp    1247 <show_uhr+0x117>
mov    0x2deb(%rip),%ecx
xor    %esi,%esi
lea    0xe14(%rip),%rdx
mov    %esi,%edi
mov    $0x0,%al
call   1040 <mvprintw@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1050 <move@plt>
mov    $0x0,%al
call   1030 <refresh@plt>
mov    $0x1,%eax
cmp    0x2dbe(%rip),%eax
jne    128a <show_uhr+0x15a>
movl   $0x0,0x2dae(%rip)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_uhr>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r14d
mov    %edx,%eax
shr    $0x1f,%eax
add    %edx,%eax
and    $0xfffffffe,%eax
mov    %edx,%ecx
sub    %eax,%ecx
cmp    $0x1,%ecx
lea    0xebf(%rip),%rax
lea    0xebc(%rip),%rcx
cmove  %rax,%rcx
lea    0xe9b(%rip),%rdx
mov    $0x1,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <mvprintw@plt>
cmp    $0x2,%ebx
jl     1188 <show_uhr+0x58>
mov    0x2ebe(%rip),%al
xor    $0x1,%al
test   $0x1,%al
je     1232 <show_uhr+0x102>
movslq %ebp,%rbp
imul   $0x66666667,%rbp,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x21,%rcx
add    %eax,%ecx
lea    (%rcx,%rcx,4),%eax
mov    %ebp,%ebx
sub    %eax,%ebx
lea    0xe6d(%rip),%rdx
mov    $0x4,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <mvprintw@plt>
lea    0xe6d(%rip),%rdx
mov    $0x5,%edi
xor    %esi,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <mvprintw@plt>
test   %ebp,%ebp
je     11e2 <show_uhr+0xb2>
mov    0x2e60(%rip),%al
xor    $0x1,%al
test   $0x1,%al
je     1232 <show_uhr+0x102>
movslq %r14d,%rbx
imul   $0x66666667,%rbx,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x21,%rcx
add    %eax,%ecx
lea    (%rcx,%rcx,4),%eax
sub    %eax,%ebx
lea    0xe3f(%rip),%rdx
mov    $0x2,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <mvprintw@plt>
lea    0xe3d(%rip),%rdx
mov    $0x3,%edi
xor    %esi,%esi
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <mvprintw@plt>
mov    0x2e0c(%rip),%al
xor    $0x1,%al
movzbl %al,%ecx
and    $0x1,%ecx
lea    0xe2b(%rip),%rdx
xor    %edi,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <mvprintw@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <move@plt>
xor    %eax,%eax
call   1030 <refresh@plt>
cmpb   $0x0,0x2ddb(%rip)
jne    126a <show_uhr+0x13a>
movb   $0x1,0x2dd2(%rip)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@show_uhr.first_draw = internal global i32 1
@.str = [18 x i8] c"Second light: %s\0A\00"
@.str.1 = [4 x i8] c"on \00"
@.str.2 = [4 x i8] c"off\00"
@.str.3 = [21 x i8] c"Minute row 1: %d lit\00"
@.str.4 = [21 x i8] c"Minute row 2: %d lit\00"
@.str.5 = [19 x i8] c"Hour row 1: %d lit\00"
@.str.6 = [19 x i8] c"Hour row 2: %d lit\00"
@.str.7 = [14 x i8] c"first_draw=%d\00"
define void @show_uhr(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%12 = load i32, i32* %6
%13 = srem i32 %12, 2
store i32 %13, i32* %7
%14 = load i32, i32* %4
%15 = sdiv i32 %14, 5
store i32 %15, i32* %8
%16 = load i32, i32* %4
%17 = srem i32 %16, 5
store i32 %17, i32* %9
%18 = load i32, i32* %5
%19 = sdiv i32 %18, 5
store i32 %19, i32* %10
%20 = load i32, i32* %5
%21 = srem i32 %20, 5
store i32 %21, i32* %11
%22 = load i32, i32* %7
%23 = icmp eq i32 %22, 1
%24 = zext i1 %23 to i64
%25 = select i1 %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%26 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 1, i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = load i32, i32* %6
%28 = icmp slt i32 %27, 2
br i1 %28, label %32, label %29
29: ; preds = %3
%30 = load i32, i32* @show_uhr.first_draw
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %48
32: ; preds = %29, %3
%33 = load i32, i32* %10
%34 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 4, i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %11
%36 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 5, i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %32
%40 = load i32, i32* @show_uhr.first_draw
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %39, %32
%43 = load i32, i32* %8
%44 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 2, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %9
%46 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 3, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %45)
br label %47
47: ; preds = %42, %39
br label %48
48: ; preds = %47, %29
%49 = load i32, i32* @show_uhr.first_draw
%50 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %49)
%51 = call i32 @move(i32 0, i32 0)
%52 = call i32 (...) @refresh()
%53 = load i32, i32* @show_uhr.first_draw
%54 = icmp eq i32 1, %53
br i1 %54, label %55, label %56
55: ; preds = %48
store i32 0, i32* @show_uhr.first_draw
br label %56
56: ; preds = %55, %48
ret void
}

LLVM IR (-O2):
@show_uhr.first_draw = internal unnamed_addr global i1 false
@.str = [18 x i8] c"Second light: %s\0A\00"
@.str.1 = [4 x i8] c"on \00"
@.str.2 = [4 x i8] c"off\00"
@.str.3 = [21 x i8] c"Minute row 1: %d lit\00"
@.str.4 = [21 x i8] c"Minute row 2: %d lit\00"
@.str.5 = [19 x i8] c"Hour row 1: %d lit\00"
@.str.6 = [19 x i8] c"Hour row 2: %d lit\00"
@.str.7 = [14 x i8] c"first_draw=%d\00"
define void @show_uhr(i32 %0, i32 %1, i32 %2) {
%4 = srem i32 %2, 2
%5 = sdiv i32 %0, 5
%6 = srem i32 %0, 5
%7 = icmp eq i32 %4, 1
%8 = select i1 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%9 = tail call i32 (i32, i32, i8*, ...) @mvprintw(i32 1, i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = icmp slt i32 %2, 2
%11 = load i1, i1* @show_uhr.first_draw
%12 = xor i1 %11, true
%13 = select i1 %10, i1 true, i1 %12
br i1 %13, label %14, label %28
14: ; preds = %3
%15 = srem i32 %1, 5
%16 = sdiv i32 %1, 5
%17 = tail call i32 (i32, i32, i8*, ...) @mvprintw(i32 4, i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = tail call i32 (i32, i32, i8*, ...) @mvprintw(i32 5, i32 0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %15)
%19 = icmp eq i32 %1, 0
%20 = load i1, i1* @show_uhr.first_draw
%21 = xor i1 %20, true
%22 = select i1 %19, i1 true, i1 %21
br i1 %22, label %23, label %28
23: ; preds = %14
%24 = tail call i32 (i32, i32, i8*, ...) @mvprintw(i32 2, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i32 %5)
%25 = tail call i32 (i32, i32, i8*, ...) @mvprintw(i32 3, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %6)
%26 = load i1, i1* @show_uhr.first_draw
%27 = xor i1 %26, true
br label %28
28: ; preds = %23, %14, %3
%29 = phi i1 [ %27, %23 ], [ %21, %14 ], [ %12, %3 ]
%30 = zext i1 %29 to i32
%31 = tail call i32 (i32, i32, i8*, ...) @mvprintw(i32 0, i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %30)
%32 = tail call i32 @move(i32 0, i32 0)
%33 = tail call i32 (...) @refresh()
%34 = load i1, i1* @show_uhr.first_draw
br i1 %34, label %36, label %35
35: ; preds = %28
store i1 true, i1* @show_uhr.first_draw
br label %36
36: ; preds = %35, %28
ret void
}