#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*/ add_lines(int);
int /*<<< orphan*/ clear_line(int);
int /*<<< orphan*/ draw_board();
scalar_t__ line_is_full(int);
int number_of_full_lines();
void clear_full_lines() {
  int n = number_of_full_lines();
  int y;
  for (y = 20 + 4 + 1 - 1; y >= 0; y--)
    if (line_is_full(y))
      clear_line(y);
  add_lines(n);
  if (n > 0)
    draw_board();
}


x86 assembly (clang, -O0):
<clear_full_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <number_of_full_lines@plt>
mov    %eax,-0x4(%rbp)
movl   $0x18,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     11a0 <clear_full_lines+0x50>
mov    -0x8(%rbp),%edi
call   1050 <line_is_full@plt>
cmp    $0x0,%rax
je     118d <clear_full_lines+0x3d>
mov    -0x8(%rbp),%edi
call   1040 <clear_line@plt>
jmp    1192 <clear_full_lines+0x42>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1169 <clear_full_lines+0x19>
mov    -0x4(%rbp),%edi
call   1070 <add_lines@plt>
cmpl   $0x0,-0x4(%rbp)
jle    11b9 <clear_full_lines+0x69>
mov    $0x0,%al
call   1030 <draw_board@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_full_lines>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <number_of_full_lines@plt>
mov    %eax,%ebx
mov    $0x18,%ebp
jmp    1175 <clear_full_lines+0x25>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%ebp
jae    118a <clear_full_lines+0x3a>
mov    %ebp,%edi
call   1050 <line_is_full@plt>
test   %rax,%rax
je     1170 <clear_full_lines+0x20>
mov    %ebp,%edi
call   1040 <clear_line@plt>
jmp    1170 <clear_full_lines+0x20>
mov    %ebx,%edi
call   1070 <add_lines@plt>
test   %ebx,%ebx
jle    11a2 <clear_full_lines+0x52>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <draw_board@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @clear_full_lines() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @number_of_full_lines()
store i32 %3, i32* %1
store i32 24, i32* %2
br label %4
4: ; preds = %15, %0
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i64 @line_is_full(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32, i32* %2
%13 = call i32 @clear_line(i32 %12)
br label %14
14: ; preds = %11, %7
br label %15
15: ; preds = %14
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
store i32 %17, i32* %2
br label %4
18: ; preds = %4
%19 = load i32, i32* %1
%20 = call i32 @add_lines(i32 %19)
%21 = load i32, i32* %1
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = call i32 (...) @draw_board()
br label %25
25: ; preds = %23, %18
ret void
}

LLVM IR (-O2):
define void @clear_full_lines() {
%1 = tail call i32 (...) @number_of_full_lines()
br label %2
2: ; preds = %0, %8
%3 = phi i32 [ 24, %0 ], [ %9, %8 ]
%4 = tail call i64 @line_is_full(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @clear_line(i32 %3)
br label %8
8: ; preds = %2, %6
%9 = add nsw i32 %3, -1
%10 = icmp eq i32 %3, 0
br i1 %10, label %11, label %2
11: ; preds = %8
%12 = tail call i32 @add_lines(i32 %1)
%13 = icmp sgt i32 %1, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 (...) @draw_board()
br label %16
16: ; preds = %14, %11
ret void
}