#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int, int, char *);
scalar_t__ scanf(char *, int *, ...);
int main(void) {
  int N, H, M, O;
  while (scanf("%d", &N) != EOF) {
    while (N--) {
      scanf("%d %d %d", &H, &M, &O);
      printf("%02d:%02d - A porta %s!\n", H, M, (O ? "abriu" : "fechou"));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed0(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    0x2ea0(%rip),%rcx
cmp    (%rcx),%rax
je     11b8 <main+0x98>
jmp    1156 <main+0x36>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11b3 <main+0x93>
lea    0xe8f(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x14(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%edi
lea    0xe94(%rip),%rcx
lea    0xe87(%rip),%rax
cmp    $0x0,%edi
cmovne %rax,%rcx
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
jmp    1156 <main+0x36>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xchg   %ax,%ax
lea    0xecf(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%rax
je     11ce <main+0xae>
subl   $0x1,0x8(%rsp)
lea    0xea5(%rip),%rax
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%r12
lea    0xeb1(%rip),%r14
lea    0xe91(%rip),%r13
jb     1130 <main+0x10>
nopw   0x0(%rax,%rax,1)
mov    %rax,%rbx
mov    %rax,%rdi
mov    %rsi,%rbp
mov    %rdx,%r15
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
cmpl   $0x0,0xc(%rsp)
mov    %r14,%rcx
lea    0xe7b(%rip),%rax
cmove  %rax,%rcx
mov    %r13,%rdi
call   1030 <printf@plt>
mov    %r15,%rdx
mov    %rbp,%rsi
mov    %rbx,%rax
subl   $0x1,0x8(%rsp)
jae    1180 <main+0x60>
jmp    1130 <main+0x10>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [25 x i8] c"%02d:%02d - A porta %s!\0A\00"
@.str.3 = [6 x i8] c"abriu\00"
@.str.4 = [7 x i8] c"fechou\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %24, %0
%7 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %25
10: ; preds = %6
br label %11
11: ; preds = %15, %10
%12 = load i32, i32* %2
%13 = add nsw i32 %12, -1
store i32 %13, i32* %2
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = icmp ne i32 %19, 0
%21 = zext i1 %20 to i64
%22 = select i1 %20, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0)
%23 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %17, i32 %18, i8* %22)
br label %11
24: ; preds = %11
br label %6
25: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [25 x i8] c"%02d:%02d - A porta %s!\0A\00"
@.str.3 = [6 x i8] c"abriu\00"
@.str.4 = [7 x i8] c"fechou\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %31, label %16
12: ; preds = %20, %16
%13 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%14 = load i64, i64* @EOF
%15 = icmp eq i64 %13, %14
br i1 %15, label %31, label %16
16: ; preds = %0, %12
%17 = load i32, i32* %1
%18 = add nsw i32 %17, -1
store i32 %18, i32* %1
%19 = icmp eq i32 %17, 0
br i1 %19, label %12, label %20
20: ; preds = %16, %20
%21 = call i64 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0)
%27 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %22, i32 %23, i8* %26)
%28 = load i32, i32* %1
%29 = add nsw i32 %28, -1
store i32 %29, i32* %1
%30 = icmp eq i32 %28, 0
br i1 %30, label %12, label %20
31: ; preds = %12, %0
ret i32 0
}