#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*/ print_board(int **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system_clear();
void redraw(int board[20][40], char *shell, int gen_count, int active_count) {
  system_clear();
  printf("\n%d generations; %d active cells (%dx%d board)\n", gen_count,
         active_count, 40, 20);
  print_board(board);
  printf("%s: ", shell);
}


x86 assembly (clang, -O0):
<redraw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    $0x0,%al
call   1050 <system_clear@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xea6(%rip),%rdi
mov    $0x28,%ecx
mov    $0x14,%r8d
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <print_board@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<redraw>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%r15
xor    %eax,%eax
call   1050 <system_clear@plt>
lea    0xeb1(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    $0x28,%ecx
mov    $0x14,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
call   1040 <print_board@plt>
lea    0xebc(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"\0A%d generations; %d active cells (%dx%d board)\0A\00"
@.str.1 = [5 x i8] c"%s: \00"
define void @redraw([40 x i32]* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca [40 x i32]*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store [40 x i32]* %0, [40 x i32]** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = call i32 (...) @system_clear()
%10 = load i32, i32* %7
%11 = load i32, i32* %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11, i32 40, i32 20)
%13 = load [40 x i32]*, [40 x i32]** %5
%14 = bitcast [40 x i32]* %13 to i32**
%15 = call i32 @print_board(i32** %14)
%16 = load i8*, i8** %6
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"\0A%d generations; %d active cells (%dx%d board)\0A\00"
@.str.1 = [5 x i8] c"%s: \00"
define void @redraw([40 x i32]* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 (...) @system_clear()
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3, i32 40, i32 20)
%7 = bitcast [40 x i32]* %0 to i32**
%8 = tail call i32 @print_board(i32** %7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret void
}