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

/* Variables and functions */
int /*<<< orphan*/ set_led_8_8_12(int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ set_row(int, int, int, int, int /*<<< orphan*/);
void fish_shape(uint8_t xi, uint8_t yi, uint8_t zi, uint16_t intensity) {
  if (xi > 0)
    set_row(xi - 1, zi + 1, yi + 1, yi + 4, intensity);
  set_led_8_8_12(xi, yi, zi, intensity);
  set_row(xi, zi, yi + 2, yi + 4, intensity);
  set_row(xi, zi + 1, yi, yi + 5, intensity);
  set_row(xi, zi + 2, yi + 2, yi + 3, intensity);
  set_led_8_8_12(xi, yi, zi + 2, intensity);
  if (xi < 8 - 1)
    set_row(xi + 1, zi + 1, yi + 1, yi + 4, intensity);
}


x86 assembly (clang, -O0):
<fish_shape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    115f <fish_shape+0x3f>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
mov    -0x8(%rbp),%ecx
add    $0x4,%ecx
mov    -0x10(%rbp),%r8d
call   1030 <set_row@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1040 <set_led_8_8_12@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0x2,%edx
mov    -0x8(%rbp),%ecx
add    $0x4,%ecx
mov    -0x10(%rbp),%r8d
call   1030 <set_row@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%edx
mov    -0x8(%rbp),%ecx
add    $0x5,%ecx
mov    -0x10(%rbp),%r8d
call   1030 <set_row@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
add    $0x2,%esi
mov    -0x8(%rbp),%edx
add    $0x2,%edx
mov    -0x8(%rbp),%ecx
add    $0x3,%ecx
mov    -0x10(%rbp),%r8d
call   1030 <set_row@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
add    $0x2,%edx
mov    -0x10(%rbp),%ecx
call   1040 <set_led_8_8_12@plt>
cmpl   $0x7,-0x4(%rbp)
jge    1203 <fish_shape+0xe3>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
mov    -0x8(%rbp),%ecx
add    $0x4,%ecx
mov    -0x10(%rbp),%r8d
call   1030 <set_row@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fish_shape>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%ebx
mov    %edi,%ebp
test   %edi,%edi
jle    1158 <fish_shape+0x38>
lea    -0x1(%rbp),%edi
lea    0x1(%r15),%esi
lea    0x1(%rbx),%edx
lea    0x4(%rbx),%r13d
mov    %esi,0x4(%rsp)
mov    %r13d,%ecx
mov    %r14d,%r8d
call   1030 <set_row@plt>
jmp    1164 <fish_shape+0x44>
lea    0x4(%rbx),%r13d
lea    0x1(%r15),%eax
mov    %eax,0x4(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1040 <set_led_8_8_12@plt>
lea    0x2(%rbx),%r12d
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %r13d,%ecx
mov    %r14d,%r8d
call   1030 <set_row@plt>
lea    0x5(%rbx),%ecx
mov    %ebp,%edi
mov    0x4(%rsp),%esi
mov    %ebx,%edx
mov    %r14d,%r8d
call   1030 <set_row@plt>
add    $0x2,%r15d
lea    0x3(%rbx),%ecx
mov    %ebp,%edi
mov    %r15d,%esi
mov    %r12d,%edx
mov    %r14d,%r8d
call   1030 <set_row@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1040 <set_led_8_8_12@plt>
cmp    $0x6,%ebp
jg     11ef <fish_shape+0xcf>
add    $0x1,%ebp
add    $0x1,%ebx
mov    %ebp,%edi
mov    0x4(%rsp),%esi
mov    %ebx,%edx
mov    %r13d,%ecx
mov    %r14d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <set_row@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fish_shape(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %4
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 1
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 4
%20 = load i32, i32* %8
%21 = call i32 @set_row(i32 %13, i32 %15, i32 %17, i32 %19, i32 %20)
br label %22
22: ; preds = %11, %4
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = load i32, i32* %7
%26 = load i32, i32* %8
%27 = call i32 @set_led_8_8_12(i32 %23, i32 %24, i32 %25, i32 %26)
%28 = load i32, i32* %5
%29 = load i32, i32* %7
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 2
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 4
%34 = load i32, i32* %8
%35 = call i32 @set_row(i32 %28, i32 %29, i32 %31, i32 %33, i32 %34)
%36 = load i32, i32* %5
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
%39 = load i32, i32* %6
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 5
%42 = load i32, i32* %8
%43 = call i32 @set_row(i32 %36, i32 %38, i32 %39, i32 %41, i32 %42)
%44 = load i32, i32* %5
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 2
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 2
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 3
%51 = load i32, i32* %8
%52 = call i32 @set_row(i32 %44, i32 %46, i32 %48, i32 %50, i32 %51)
%53 = load i32, i32* %5
%54 = load i32, i32* %6
%55 = load i32, i32* %7
%56 = add nsw i32 %55, 2
%57 = load i32, i32* %8
%58 = call i32 @set_led_8_8_12(i32 %53, i32 %54, i32 %56, i32 %57)
%59 = load i32, i32* %5
%60 = icmp slt i32 %59, 7
br i1 %60, label %61, label %72
61: ; preds = %22
%62 = load i32, i32* %5
%63 = add nsw i32 %62, 1
%64 = load i32, i32* %7
%65 = add nsw i32 %64, 1
%66 = load i32, i32* %6
%67 = add nsw i32 %66, 1
%68 = load i32, i32* %6
%69 = add nsw i32 %68, 4
%70 = load i32, i32* %8
%71 = call i32 @set_row(i32 %63, i32 %65, i32 %67, i32 %69, i32 %70)
br label %72
72: ; preds = %61, %22
ret void
}

LLVM IR (-O2):
define void @fish_shape(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = add nsw i32 %1, 4
%8 = add nsw i32 %2, 1
br label %15
9: ; preds = %4
%10 = add nsw i32 %0, -1
%11 = add nsw i32 %2, 1
%12 = add nsw i32 %1, 1
%13 = add nsw i32 %1, 4
%14 = tail call i32 @set_row(i32 %10, i32 %11, i32 %12, i32 %13, i32 %3)
br label %15
15: ; preds = %6, %9
%16 = phi i32 [ %8, %6 ], [ %11, %9 ]
%17 = phi i32 [ %7, %6 ], [ %13, %9 ]
%18 = tail call i32 @set_led_8_8_12(i32 %0, i32 %1, i32 %2, i32 %3)
%19 = add nsw i32 %1, 2
%20 = tail call i32 @set_row(i32 %0, i32 %2, i32 %19, i32 %17, i32 %3)
%21 = add nsw i32 %1, 5
%22 = tail call i32 @set_row(i32 %0, i32 %16, i32 %1, i32 %21, i32 %3)
%23 = add nsw i32 %2, 2
%24 = add nsw i32 %1, 3
%25 = tail call i32 @set_row(i32 %0, i32 %23, i32 %19, i32 %24, i32 %3)
%26 = tail call i32 @set_led_8_8_12(i32 %0, i32 %1, i32 %23, i32 %3)
%27 = icmp slt i32 %0, 7
br i1 %27, label %28, label %32
28: ; preds = %15
%29 = add nsw i32 %0, 1
%30 = add nsw i32 %1, 1
%31 = tail call i32 @set_row(i32 %29, i32 %16, i32 %30, i32 %17, i32 %3)
br label %32
32: ; preds = %28, %15
ret void
}