#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*/ brc(int, char);
int /*<<< orphan*/ chrprint(char *);
int chrprint2(char *, int, int);
char *instr();
int /*<<< orphan*/ println(char *);
int /*<<< orphan*/ restore_ttymodes();
int /*<<< orphan*/ set_tty_echo(int /*<<< orphan*/);
int /*<<< orphan*/ set_tty_raw(int);
int /*<<< orphan*/ vt_move(int, int);
int test_report_ops(const char *the_title) {
  char *report;
  int row = 3;
  int col = 10;
  vt_move(1, 1);
  println("Test of Window reporting.");
  set_tty_raw((1));
  set_tty_echo((0));
  vt_move(row++, 1);
  println("Report icon label:");
  vt_move(row, col);
  brc(20, 't');
  report = instr();
  row = chrprint2(report, row, col);
  vt_move(row++, 1);
  println("Report window label:");
  vt_move(row, col);
  brc(21, 't');
  report = instr();
  row = chrprint2(report, row, col);
  vt_move(row++, 1);
  println("Report size of window (chars):");
  vt_move(row++, col);
  brc(18, 't');
  report = instr();
  chrprint(report);
  vt_move(row++, 1);
  println("Report size of window (pixels):");
  vt_move(row++, col);
  brc(14, 't');
  report = instr();
  chrprint(report);
  vt_move(row++, 1);
  println("Report position of window (pixels):");
  vt_move(row++, col);
  brc(13, 't');
  report = instr();
  chrprint(report);
  vt_move(row++, 1);
  println("Report state of window (normal/iconified):");
  vt_move(row, col);
  brc(11, 't');
  report = instr();
  chrprint(report);
  vt_move(20, 1);
  restore_ttymodes();
  return 1;
}


x86 assembly (clang, -O0):
<test_report_ops>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0xa,-0x18(%rbp)
mov    $0x1,%esi
mov    %esi,%edi
call   1050 <vt_move@plt>
lea    0xe43(%rip),%rdi
call   1060 <println@plt>
mov    $0x1,%edi
call   1070 <set_tty_raw@plt>
xor    %edi,%edi
call   1080 <set_tty_echo@plt>
mov    -0x14(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xe2b(%rip),%rdi
call   1060 <println@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <vt_move@plt>
mov    $0x14,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
mov    $0x0,%al
call   1040 <instr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   10b0 <chrprint2@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xde6(%rip),%rdi
call   1060 <println@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <vt_move@plt>
mov    $0x15,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
mov    $0x0,%al
call   1040 <instr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   10b0 <chrprint2@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xda3(%rip),%rdi
call   1060 <println@plt>
mov    -0x14(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
call   1050 <vt_move@plt>
mov    $0x12,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
mov    $0x0,%al
call   1040 <instr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <chrprint@plt>
mov    -0x14(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xd6b(%rip),%rdi
call   1060 <println@plt>
mov    -0x14(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
call   1050 <vt_move@plt>
mov    $0xe,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
mov    $0x0,%al
call   1040 <instr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <chrprint@plt>
mov    -0x14(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xd34(%rip),%rdi
call   1060 <println@plt>
mov    -0x14(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%esi
call   1050 <vt_move@plt>
mov    $0xd,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
mov    $0x0,%al
call   1040 <instr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <chrprint@plt>
mov    -0x14(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xd01(%rip),%rdi
call   1060 <println@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <vt_move@plt>
mov    $0xb,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
mov    $0x0,%al
call   1040 <instr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1090 <chrprint@plt>
mov    $0x14,%edi
mov    $0x1,%esi
call   1050 <vt_move@plt>
mov    $0x0,%al
call   1030 <restore_ttymodes@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_report_ops>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%edi
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xe56(%rip),%rdi
call   1060 <println@plt>
mov    $0x1,%edi
call   1070 <set_tty_raw@plt>
xor    %edi,%edi
call   1080 <set_tty_echo@plt>
mov    $0x3,%edi
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xe44(%rip),%rdi
call   1060 <println@plt>
mov    $0x4,%edi
mov    $0xa,%esi
call   1050 <vt_move@plt>
mov    $0x14,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
xor    %eax,%eax
call   1040 <instr@plt>
mov    %rax,%rdi
mov    $0x4,%esi
mov    $0xa,%edx
call   10b0 <chrprint2@plt>
lea    0x1(%rax),%ebx
mov    %eax,%edi
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xe05(%rip),%rdi
call   1060 <println@plt>
mov    %ebx,%edi
mov    $0xa,%esi
call   1050 <vt_move@plt>
mov    $0x15,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
xor    %eax,%eax
call   1040 <instr@plt>
mov    %rax,%rdi
mov    %ebx,%esi
mov    $0xa,%edx
call   10b0 <chrprint2@plt>
mov    %eax,%ebx
lea    0x1(%rbx),%ebp
mov    %eax,%edi
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xdcc(%rip),%rdi
call   1060 <println@plt>
lea    0x2(%rbx),%r14d
mov    %ebp,%edi
mov    $0xa,%esi
call   1050 <vt_move@plt>
mov    $0x12,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
xor    %eax,%eax
call   1040 <instr@plt>
mov    %rax,%rdi
call   1090 <chrprint@plt>
lea    0x3(%rbx),%ebp
mov    %r14d,%edi
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xda1(%rip),%rdi
call   1060 <println@plt>
lea    0x4(%rbx),%r14d
mov    %ebp,%edi
mov    $0xa,%esi
call   1050 <vt_move@plt>
mov    $0xe,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
xor    %eax,%eax
call   1040 <instr@plt>
mov    %rax,%rdi
call   1090 <chrprint@plt>
lea    0x5(%rbx),%ebp
mov    %r14d,%edi
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xd77(%rip),%rdi
call   1060 <println@plt>
lea    0x6(%rbx),%r14d
mov    %ebp,%edi
mov    $0xa,%esi
call   1050 <vt_move@plt>
mov    $0xd,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
xor    %eax,%eax
call   1040 <instr@plt>
mov    %rax,%rdi
call   1090 <chrprint@plt>
add    $0x7,%ebx
mov    %r14d,%edi
mov    $0x1,%esi
call   1050 <vt_move@plt>
lea    0xd51(%rip),%rdi
call   1060 <println@plt>
mov    %ebx,%edi
mov    $0xa,%esi
call   1050 <vt_move@plt>
mov    $0xb,%edi
mov    $0x74,%esi
call   10a0 <brc@plt>
xor    %eax,%eax
call   1040 <instr@plt>
mov    %rax,%rdi
call   1090 <chrprint@plt>
mov    $0x14,%edi
mov    $0x1,%esi
call   1050 <vt_move@plt>
xor    %eax,%eax
call   1030 <restore_ttymodes@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Test of Window reporting.\00"
@.str.1 = [19 x i8] c"Report icon label:\00"
@.str.2 = [21 x i8] c"Report window label:\00"
@.str.3 = [31 x i8] c"Report size of window (chars):\00"
@.str.4 = [32 x i8] c"Report size of window (pixels):\00"
@.str.5 = [36 x i8] c"Report position of window (pixels):\00"
@.str.6 = [43 x i8] c"Report state of window (normal/iconified):\00"
define i32 @test_report_ops(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 3, i32* %4
store i32 10, i32* %5
%6 = call i32 @vt_move(i32 1, i32 1)
%7 = call i32 @println(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @set_tty_raw(i32 1)
%9 = call i32 @set_tty_echo(i32 0)
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
%12 = call i32 @vt_move(i32 %10, i32 1)
%13 = call i32 @println(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = call i32 @vt_move(i32 %14, i32 %15)
%17 = call i32 @brc(i32 20, i8 signext 116)
%18 = call i8* (...) @instr()
store i8* %18, i8** %3
%19 = load i8*, i8** %3
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = call i32 @chrprint2(i8* %19, i32 %20, i32 %21)
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
%25 = call i32 @vt_move(i32 %23, i32 1)
%26 = call i32 @println(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = call i32 @vt_move(i32 %27, i32 %28)
%30 = call i32 @brc(i32 21, i8 signext 116)
%31 = call i8* (...) @instr()
store i8* %31, i8** %3
%32 = load i8*, i8** %3
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = call i32 @chrprint2(i8* %32, i32 %33, i32 %34)
store i32 %35, i32* %4
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
%38 = call i32 @vt_move(i32 %36, i32 1)
%39 = call i32 @println(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
%42 = load i32, i32* %5
%43 = call i32 @vt_move(i32 %40, i32 %42)
%44 = call i32 @brc(i32 18, i8 signext 116)
%45 = call i8* (...) @instr()
store i8* %45, i8** %3
%46 = load i8*, i8** %3
%47 = call i32 @chrprint(i8* %46)
%48 = load i32, i32* %4
%49 = add nsw i32 %48, 1
store i32 %49, i32* %4
%50 = call i32 @vt_move(i32 %48, i32 1)
%51 = call i32 @println(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%52 = load i32, i32* %4
%53 = add nsw i32 %52, 1
store i32 %53, i32* %4
%54 = load i32, i32* %5
%55 = call i32 @vt_move(i32 %52, i32 %54)
%56 = call i32 @brc(i32 14, i8 signext 116)
%57 = call i8* (...) @instr()
store i8* %57, i8** %3
%58 = load i8*, i8** %3
%59 = call i32 @chrprint(i8* %58)
%60 = load i32, i32* %4
%61 = add nsw i32 %60, 1
store i32 %61, i32* %4
%62 = call i32 @vt_move(i32 %60, i32 1)
%63 = call i32 @println(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%64 = load i32, i32* %4
%65 = add nsw i32 %64, 1
store i32 %65, i32* %4
%66 = load i32, i32* %5
%67 = call i32 @vt_move(i32 %64, i32 %66)
%68 = call i32 @brc(i32 13, i8 signext 116)
%69 = call i8* (...) @instr()
store i8* %69, i8** %3
%70 = load i8*, i8** %3
%71 = call i32 @chrprint(i8* %70)
%72 = load i32, i32* %4
%73 = add nsw i32 %72, 1
store i32 %73, i32* %4
%74 = call i32 @vt_move(i32 %72, i32 1)
%75 = call i32 @println(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0))
%76 = load i32, i32* %4
%77 = load i32, i32* %5
%78 = call i32 @vt_move(i32 %76, i32 %77)
%79 = call i32 @brc(i32 11, i8 signext 116)
%80 = call i8* (...) @instr()
store i8* %80, i8** %3
%81 = load i8*, i8** %3
%82 = call i32 @chrprint(i8* %81)
%83 = call i32 @vt_move(i32 20, i32 1)
%84 = call i32 (...) @restore_ttymodes()
ret i32 1
}

LLVM IR (-O2):
@.str = [26 x i8] c"Test of Window reporting.\00"
@.str.1 = [19 x i8] c"Report icon label:\00"
@.str.2 = [21 x i8] c"Report window label:\00"
@.str.3 = [31 x i8] c"Report size of window (chars):\00"
@.str.4 = [32 x i8] c"Report size of window (pixels):\00"
@.str.5 = [36 x i8] c"Report position of window (pixels):\00"
@.str.6 = [43 x i8] c"Report state of window (normal/iconified):\00"
define i32 @test_report_ops(i8* nocapture readnone %0) {
%2 = tail call i32 @vt_move(i32 1, i32 1)
%3 = tail call i32 @println(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @set_tty_raw(i32 1)
%5 = tail call i32 @set_tty_echo(i32 0)
%6 = tail call i32 @vt_move(i32 3, i32 1)
%7 = tail call i32 @println(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @vt_move(i32 4, i32 10)
%9 = tail call i32 @brc(i32 20, i8 signext 116)
%10 = tail call i8* (...) @instr()
%11 = tail call i32 @chrprint2(i8* %10, i32 4, i32 10)
%12 = add nsw i32 %11, 1
%13 = tail call i32 @vt_move(i32 %11, i32 1)
%14 = tail call i32 @println(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%15 = tail call i32 @vt_move(i32 %12, i32 10)
%16 = tail call i32 @brc(i32 21, i8 signext 116)
%17 = tail call i8* (...) @instr()
%18 = tail call i32 @chrprint2(i8* %17, i32 %12, i32 10)
%19 = add nsw i32 %18, 1
%20 = tail call i32 @vt_move(i32 %18, i32 1)
%21 = tail call i32 @println(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%22 = add nsw i32 %18, 2
%23 = tail call i32 @vt_move(i32 %19, i32 10)
%24 = tail call i32 @brc(i32 18, i8 signext 116)
%25 = tail call i8* (...) @instr()
%26 = tail call i32 @chrprint(i8* %25)
%27 = add nsw i32 %18, 3
%28 = tail call i32 @vt_move(i32 %22, i32 1)
%29 = tail call i32 @println(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%30 = add nsw i32 %18, 4
%31 = tail call i32 @vt_move(i32 %27, i32 10)
%32 = tail call i32 @brc(i32 14, i8 signext 116)
%33 = tail call i8* (...) @instr()
%34 = tail call i32 @chrprint(i8* %33)
%35 = add nsw i32 %18, 5
%36 = tail call i32 @vt_move(i32 %30, i32 1)
%37 = tail call i32 @println(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%38 = add nsw i32 %18, 6
%39 = tail call i32 @vt_move(i32 %35, i32 10)
%40 = tail call i32 @brc(i32 13, i8 signext 116)
%41 = tail call i8* (...) @instr()
%42 = tail call i32 @chrprint(i8* %41)
%43 = add nsw i32 %18, 7
%44 = tail call i32 @vt_move(i32 %38, i32 1)
%45 = tail call i32 @println(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0))
%46 = tail call i32 @vt_move(i32 %43, i32 10)
%47 = tail call i32 @brc(i32 11, i8 signext 116)
%48 = tail call i8* (...) @instr()
%49 = tail call i32 @chrprint(i8* %48)
%50 = tail call i32 @vt_move(i32 20, i32 1)
%51 = tail call i32 (...) @restore_ttymodes()
ret i32 1
}