#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*/ drawSquare(int, int, int);
void fractal_square(int x, int y, int s) {
  if (s < 2)
    return;
  drawSquare(x, y, s);
  fractal_square(x - (s / 5), y - (s / 5), (2 * s / 5));
  fractal_square(x + (4 * s / 5), y - (s / 5), (2 * s / 5));
  fractal_square(x - (s / 5), y + (4 * s / 5), (2 * s / 5));
  fractal_square(x + (4 * s / 5), y + (4 * s / 5), (2 * s / 5));
  return;
}


x86 assembly (clang, -O0):
<fractal_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1140 <fractal_square+0x20>
jmp    122e <fractal_square+0x10e>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <drawSquare@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
sub    %eax,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
sub    %eax,%esi
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1030 <fractal_square@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
add    %eax,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
sub    %eax,%esi
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1030 <fractal_square@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
sub    %eax,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
add    %eax,%esi
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1030 <fractal_square@plt>
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
add    %eax,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
add    %eax,%esi
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
call   1030 <fractal_square@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fractal_square>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edx
jl     11e1 <fractal_square+0xc1>
mov    %edx,%r15d
mov    %edi,%ebp
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %esi,%r13d
mov    %esi,0x4(%rsp)
mov    %r15d,%edx
call   1040 <drawSquare@plt>
mov    %r15d,%eax
mov    $0xcccccccd,%ecx
imul   %rcx,%rax
shr    $0x22,%rax
mov    %ebp,%r12d
sub    %eax,%r12d
sub    %eax,%r13d
lea    (%r15,%r15,1),%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x21,%rbx
add    %eax,%ebx
mov    %r12d,%edi
mov    %r13d,%esi
mov    %ebx,%edx
call   1030 <fractal_square@plt>
lea    0x0(,%r15,4),%eax
cltq
imul   $0x66666667,%rax,%r14
mov    %r14,%rax
shr    $0x3f,%rax
sar    $0x21,%r14
add    %eax,%r14d
add    %r14d,%ebp
mov    %ebp,%edi
mov    %r13d,%esi
mov    %ebx,%edx
call   1030 <fractal_square@plt>
add    0x4(%rsp),%r14d
mov    %r12d,%edi
mov    %r14d,%esi
mov    %ebx,%edx
call   1030 <fractal_square@plt>
mov    %r14d,%esi
cmp    $0x4,%r15d
mov    %ebx,%r15d
jg     1140 <fractal_square+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @fractal_square(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 slt i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %3
br label %63
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @drawSquare(i32 %11, i32 %12, i32 %13)
%15 = load i32, i32* %4
%16 = load i32, i32* %6
%17 = sdiv i32 %16, 5
%18 = sub nsw i32 %15, %17
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = sdiv i32 %20, 5
%22 = sub nsw i32 %19, %21
%23 = load i32, i32* %6
%24 = mul nsw i32 2, %23
%25 = sdiv i32 %24, 5
%26 = load i32, i32* %4
%27 = load i32, i32* %6
%28 = mul nsw i32 4, %27
%29 = sdiv i32 %28, 5
%30 = add nsw i32 %26, %29
%31 = load i32, i32* %5
%32 = load i32, i32* %6
%33 = sdiv i32 %32, 5
%34 = sub nsw i32 %31, %33
%35 = load i32, i32* %6
%36 = mul nsw i32 2, %35
%37 = sdiv i32 %36, 5
%38 = load i32, i32* %4
%39 = load i32, i32* %6
%40 = sdiv i32 %39, 5
%41 = sub nsw i32 %38, %40
%42 = load i32, i32* %5
%43 = load i32, i32* %6
%44 = mul nsw i32 4, %43
%45 = sdiv i32 %44, 5
%46 = add nsw i32 %42, %45
%47 = load i32, i32* %6
%48 = mul nsw i32 2, %47
%49 = sdiv i32 %48, 5
%50 = load i32, i32* %4
%51 = load i32, i32* %6
%52 = mul nsw i32 4, %51
%53 = sdiv i32 %52, 5
%54 = add nsw i32 %50, %53
%55 = load i32, i32* %5
%56 = load i32, i32* %6
%57 = mul nsw i32 4, %56
%58 = sdiv i32 %57, 5
%59 = add nsw i32 %55, %58
%60 = load i32, i32* %6
%61 = mul nsw i32 2, %60
%62 = sdiv i32 %61, 5
br label %63
63: ; preds = %10, %9
ret void
}

LLVM IR (-O2):
define void @fractal_square(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %2, 2
br i1 %4, label %20, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %14, %5 ], [ %2, %3 ]
%7 = phi i32 [ %18, %5 ], [ %1, %3 ]
%8 = phi i32 [ %17, %5 ], [ %0, %3 ]
%9 = tail call i32 @drawSquare(i32 %8, i32 %7, i32 %6)
%10 = udiv i32 %6, 5
%11 = sub nsw i32 %8, %10
%12 = sub nsw i32 %7, %10
%13 = shl nuw nsw i32 %6, 1
%14 = sdiv i32 %13, 5
tail call void @fractal_square(i32 %11, i32 %12, i32 %14)
%15 = shl nsw i32 %6, 2
%16 = sdiv i32 %15, 5
%17 = add nsw i32 %16, %8
tail call void @fractal_square(i32 %17, i32 %12, i32 %14)
%18 = add nsw i32 %16, %7
tail call void @fractal_square(i32 %11, i32 %18, i32 %14)
%19 = icmp slt i32 %6, 5
br i1 %19, label %20, label %5
20: ; preds = %5, %3
ret void
}