#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
char *malloc(int);
void print_rows(FILE *file, char a, char b) {
  static char *linea = 0;
  static char *lineb = 0;
  static int i = 0;
  if (!linea)
    linea = malloc(80 + 1);
  if (!lineb)
    lineb = malloc(80 + 1);
  linea[i] = a;
  lineb[i] = b;
  i++;
  if (i == 80 || (a == 0 && b == 0)) {
    linea[i] = lineb[i] = 0;
    fprintf(file, "%s\n%s\n\n", linea, lineb);
    i = 0;
  }
}


x86 assembly (clang, -O0):
<print_rows>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
cmpq   $0x0,0x2ef9(%rip)
jne    1156 <print_rows+0x36>
mov    $0x51,%edi
call   1040 <malloc@plt>
mov    %rax,0x2ee2(%rip)
cmpq   $0x0,0x2ee2(%rip)
jne    1175 <print_rows+0x55>
mov    $0x51,%edi
call   1040 <malloc@plt>
mov    %rax,0x2ecb(%rip)
mov    -0x9(%rbp),%dl
mov    0x2eb9(%rip),%rax
movslq 0x2ec2(%rip),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xa(%rbp),%dl
mov    0x2ead(%rip),%rax
movslq 0x2eae(%rip),%rcx
mov    %dl,(%rax,%rcx,1)
mov    0x2ea5(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e9c(%rip)
cmpl   $0x50,0x2e95(%rip)
je     11d3 <print_rows+0xb3>
movsbl -0x9(%rbp),%eax
cmp    $0x0,%eax
jne    121f <print_rows+0xff>
movsbl -0xa(%rbp),%eax
cmp    $0x0,%eax
jne    121f <print_rows+0xff>
mov    0x2e66(%rip),%rax
movslq 0x2e67(%rip),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    0x2e4c(%rip),%rax
movslq 0x2e55(%rip),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    0x2e36(%rip),%rdx
mov    0x2e37(%rip),%rcx
lea    0xdf0(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,0x2e29(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_rows>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%r15d
mov    %rdi,%r14
mov    0x2f02(%rip),%rbx
test   %rbx,%rbx
jne    114f <print_rows+0x2f>
mov    $0x51,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,0x2ee9(%rip)
mov    0x2eea(%rip),%rcx
test   %rcx,%rcx
jne    116f <print_rows+0x4f>
mov    $0x51,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    %rax,0x2ed1(%rip)
movslq 0x2ed2(%rip),%rax
mov    %r15b,(%rbx,%rax,1)
mov    %bpl,(%rcx,%rax,1)
add    $0x1,%rax
mov    %eax,0x2ec0(%rip)
or     %r15b,%bpl
je     1192 <print_rows+0x72>
cmp    $0x50,%eax
jne    11b6 <print_rows+0x96>
movb   $0x0,(%rcx,%rax,1)
movb   $0x0,(%rbx,%rax,1)
lea    0xe5f(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
movl   $0x0,0x2e92(%rip)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@print_rows.linea = internal global i8* null
@print_rows.lineb = internal global i8* null
@print_rows.i = internal global i32 0
@.str = [8 x i8] c"%s\0A%s\0A\0A\00"
define void @print_rows(i32* %0, i8 signext %1, i8 signext %2) {
%4 = alloca i32*
%5 = alloca i8
%6 = alloca i8
store i32* %0, i32** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%7 = load i8*, i8** @print_rows.linea
%8 = icmp ne i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = call i8* @malloc(i32 81)
store i8* %10, i8** @print_rows.linea
br label %11
11: ; preds = %9, %3
%12 = load i8*, i8** @print_rows.lineb
%13 = icmp ne i8* %12, null
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i8* @malloc(i32 81)
store i8* %15, i8** @print_rows.lineb
br label %16
16: ; preds = %14, %11
%17 = load i8, i8* %5
%18 = load i8*, i8** @print_rows.linea
%19 = load i32, i32* @print_rows.i
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
%22 = load i8, i8* %6
%23 = load i8*, i8** @print_rows.lineb
%24 = load i32, i32* @print_rows.i
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 %22, i8* %26
%27 = load i32, i32* @print_rows.i
%28 = add nsw i32 %27, 1
store i32 %28, i32* @print_rows.i
%29 = load i32, i32* @print_rows.i
%30 = icmp eq i32 %29, 80
br i1 %30, label %39, label %31
31: ; preds = %16
%32 = load i8, i8* %5
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %52
35: ; preds = %31
%36 = load i8, i8* %6
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %52
39: ; preds = %35, %16
%40 = load i8*, i8** @print_rows.lineb
%41 = load i32, i32* @print_rows.i
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %40, i64 %42
store i8 0, i8* %43
%44 = load i8*, i8** @print_rows.linea
%45 = load i32, i32* @print_rows.i
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %44, i64 %46
store i8 0, i8* %47
%48 = load i32*, i32** %4
%49 = load i8*, i8** @print_rows.linea
%50 = load i8*, i8** @print_rows.lineb
%51 = call i32 @fprintf(i32* %48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %49, i8* %50)
store i32 0, i32* @print_rows.i
br label %52
52: ; preds = %39, %35, %31
ret void
}

LLVM IR (-O2):
@print_rows.linea = internal unnamed_addr global i8* null
@print_rows.lineb = internal unnamed_addr global i8* null
@print_rows.i = internal unnamed_addr global i32 0
@.str = [8 x i8] c"%s\0A%s\0A\0A\00"
define void @print_rows(i32* nocapture %0, i8 signext %1, i8 signext %2) {
%4 = load i8*, i8** @print_rows.linea
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call dereferenceable_or_null(81) i8* @malloc(i32 81)
store i8* %7, i8** @print_rows.linea
br label %8
8: ; preds = %6, %3
%9 = phi i8* [ %7, %6 ], [ %4, %3 ]
%10 = load i8*, i8** @print_rows.lineb
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call dereferenceable_or_null(81) i8* @malloc(i32 81)
store i8* %13, i8** @print_rows.lineb
br label %14
14: ; preds = %12, %8
%15 = phi i8* [ %13, %12 ], [ %10, %8 ]
%16 = load i32, i32* @print_rows.i
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %9, i64 %17
store i8 %1, i8* %18
%19 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 %2, i8* %19
%20 = add nsw i32 %16, 1
store i32 %20, i32* @print_rows.i
%21 = icmp eq i32 %20, 80
%22 = or i8 %2, %1
%23 = icmp eq i8 %22, 0
%24 = or i1 %23, %21
br i1 %24, label %25, label %30
25: ; preds = %14
%26 = sext i32 %20 to i64
%27 = getelementptr inbounds i8, i8* %15, i64 %26
store i8 0, i8* %27
%28 = getelementptr inbounds i8, i8* %9, i64 %26
store i8 0, i8* %28
%29 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %15)
store i32 0, i32* @print_rows.i
br label %30
30: ; preds = %14, %25
ret void
}