#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 uint;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
int /*<<< orphan*/ putchar(char);
void OutHips(char *Screen, int xmax, int ymax) {
  register uint k;
  printf("HIPS\n\n\n1\n\n%d\n%d\n%d\n%d\n0\n0\n0\n1\n0\n1\n\n0\n  0\n", ymax,
         xmax, ymax, xmax);
  for (k = 0; k < xmax * ymax; k++)
    putchar(Screen[k]);
}


x86 assembly (clang, -O0):
<OutHips>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    1183 <OutHips+0x63>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <OutHips+0x32>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OutHips>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%r15
lea    0xeca(%rip),%rdi
mov    %edx,%esi
mov    %r14d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
call   1040 <printf@plt>
imul   %r14d,%ebp
test   %ebp,%ebp
jle    1173 <OutHips+0x53>
mov    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <OutHips+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"HIPS\0A\0A\0A1\0A\0A%d\0A%d\0A%d\0A%d\0A0\0A0\0A0\0A1\0A0\0A1\0A\0A0\0A 0\0A\00"
define void @OutHips(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %5
%12 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %10, i32 %11)
store i32 0, i32* %7
br label %13
13: ; preds = %26, %3
%14 = load i32, i32* %7
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = mul nsw i32 %15, %16
%18 = icmp slt i32 %14, %17
br i1 %18, label %19, label %29
19: ; preds = %13
%20 = load i8*, i8** %4
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = call i32 @putchar(i8 signext %24)
br label %26
26: ; preds = %19
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %13
29: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"HIPS\0A\0A\0A1\0A\0A%d\0A%d\0A%d\0A%d\0A0\0A0\0A0\0A1\0A0\0A1\0A\0A0\0A 0\0A\00"
define void @OutHips(i8* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %1, i32 %2, i32 %1)
%5 = mul i32 %2, %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %3
%8 = zext i32 %5 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %14, %9 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = tail call i32 @putchar(i8 signext %12)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %8
br i1 %15, label %16, label %9
16: ; preds = %9, %3
ret void
}