#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__ EXIT_SUCCESS;
scalar_t__ legalChar(int);
int /*<<< orphan*/ putchar(char);
void printForDebug(int letter, int *stateEnter, int counter) {
  if (counter <= 80) {
    if (legalChar(letter) == EXIT_SUCCESS) {
      putchar(letter);
      *stateEnter = 0;
    } else {
      if (*stateEnter == 0) {
        putchar('\n');
      }
      *stateEnter = 1;
    }
  }
  if (counter == 80 + 1) {
    putchar('\n');
  }
}


x86 assembly (clang, -O0):
<printForDebug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x50,-0x14(%rbp)
jg     1194 <printForDebug+0x74>
mov    -0x4(%rbp),%edi
call   1040 <legalChar@plt>
mov    0x2e95(%rip),%rcx
cmp    (%rcx),%rax
jne    116e <printForDebug+0x4e>
mov    -0x4(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
jmp    118f <printForDebug+0x6f>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1185 <printForDebug+0x65>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
jmp    1194 <printForDebug+0x74>
cmpl   $0x51,-0x14(%rbp)
jne    11a8 <printForDebug+0x88>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printForDebug>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x50,%edx
jg     114f <printForDebug+0x2f>
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <legalChar@plt>
mov    0x2ea7(%rip),%rcx
cmp    (%rcx),%rax
jne    1164 <printForDebug+0x44>
movsbl %bpl,%edi
call   1030 <putchar@plt>
movl   $0x0,(%rbx)
jmp    1179 <printForDebug+0x59>
cmp    $0x51,%edx
jne    1179 <printForDebug+0x59>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <putchar@plt>
cmpl   $0x0,(%rbx)
jne    1173 <printForDebug+0x53>
mov    $0xa,%edi
call   1030 <putchar@plt>
movl   $0x1,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i64 0
define void @printForDebug(i32 %0, i32* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp sle i32 %7, 80
br i1 %8, label %9, label %28
9: ; preds = %3
%10 = load i32, i32* %4
%11 = call i64 @legalChar(i32 %10)
%12 = load i64, i64* @EXIT_SUCCESS
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = load i32, i32* %4
%16 = trunc i32 %15 to i8
%17 = call i32 @putchar(i8 signext %16)
%18 = load i32*, i32** %5
store i32 0, i32* %18
br label %27
19: ; preds = %9
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 @putchar(i8 signext 10)
br label %25
25: ; preds = %23, %19
%26 = load i32*, i32** %5
store i32 1, i32* %26
br label %27
27: ; preds = %25, %14
br label %28
28: ; preds = %27, %3
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 81
br i1 %30, label %31, label %33
31: ; preds = %28
%32 = call i32 @putchar(i8 signext 10)
br label %33
33: ; preds = %31, %28
ret void
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i64 0
define void @printForDebug(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp slt i32 %2, 81
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = tail call i64 @legalChar(i32 %0)
%7 = load i64, i64* @EXIT_SUCCESS
%8 = icmp eq i64 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = trunc i32 %0 to i8
%11 = tail call i32 @putchar(i8 signext %10)
store i32 0, i32* %1
br label %22
12: ; preds = %5
%13 = load i32, i32* %1
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = tail call i32 @putchar(i8 signext 10)
br label %17
17: ; preds = %15, %12
store i32 1, i32* %1
br label %22
18: ; preds = %3
%19 = icmp eq i32 %2, 81
br i1 %19, label %20, label %22
20: ; preds = %18
%21 = tail call i32 @putchar(i8 signext 10)
br label %22
22: ; preds = %17, %9, %20, %18
ret void
}