#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 GLint;
typedef double GLfloat;

/* Variables and functions */
int /*<<< orphan*/ subDivide(double *, double *, double *, int);
void drawGround(void) {
  GLint maxdepth = 2;
  GLfloat u1[] = {-1.0, -1.0, 0.0};
  GLfloat u2[] = {1.0, -1.0, 0.0};
  GLfloat u3[] = {1.0, 1.0, 0.0};
  GLfloat v1[] = {-1.0, -1.0, 0.0};
  GLfloat v2[] = {1.0, 1.0, 0.0};
  GLfloat v3[] = {-1.0, 1.0, 0.0};
  subDivide(u1, u2, u3, maxdepth);
  subDivide(v1, v2, v3, maxdepth);
}


x86 assembly (clang, -O0):
<drawGround>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x2,-0x4(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed6(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed5(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xed2(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0xecf(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x80(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x78(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0xa0(%rbp)
mov    0xecd(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x90(%rbp)
mov    0xec9(%rip),%rax
mov    %rax,-0xc0(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0xb8(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0xb0(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x60(%rbp),%rdx
mov    -0x4(%rbp),%ecx
call   1030 <subDivide@plt>
lea    -0x80(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
mov    -0x4(%rbp),%ecx
call   1030 <subDivide@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawGround>:
sub    $0xb8,%rsp
mov    0xf12(%rip),%rax
mov    %rax,0xb0(%rsp)
movaps 0xef3(%rip),%xmm0
movaps %xmm0,0xa0(%rsp)
mov    0xed4(%rip),%rcx
mov    %rcx,0x90(%rsp)
movaps 0xeb5(%rip),%xmm1
movaps %xmm1,0x80(%rsp)
mov    0xef6(%rip),%rcx
mov    %rcx,0x70(%rsp)
movaps 0xeda(%rip),%xmm1
movaps %xmm1,0x60(%rsp)
mov    %rax,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
mov    %rcx,0x30(%rsp)
movaps %xmm1,0x20(%rsp)
mov    0xeea(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xa0(%rsp),%rdi
lea    0x80(%rsp),%rsi
lea    0x60(%rsp),%rdx
mov    $0x2,%ecx
call   1030 <subDivide@plt>
lea    0x40(%rsp),%rdi
lea    0x20(%rsp),%rsi
mov    %rsp,%rdx
mov    $0x2,%ecx
call   1030 <subDivide@plt>
add    $0xb8,%rsp
ret

LLVM IR (-O0):
@__const.drawGround.u1 = [3 x double] [double -1.000000e+00, double -1.000000e+00, double 0.000000e+00]
@__const.drawGround.u2 = [3 x double] [double 1.000000e+00, double -1.000000e+00, double 0.000000e+00]
@__const.drawGround.u3 = [3 x double] [double 1.000000e+00, double 1.000000e+00, double 0.000000e+00]
@__const.drawGround.v1 = [3 x double] [double -1.000000e+00, double -1.000000e+00, double 0.000000e+00]
@__const.drawGround.v2 = [3 x double] [double 1.000000e+00, double 1.000000e+00, double 0.000000e+00]
@__const.drawGround.v3 = [3 x double] [double -1.000000e+00, double 1.000000e+00, double 0.000000e+00]
define void @drawGround() {
%1 = alloca i32
%2 = alloca [3 x double]
%3 = alloca [3 x double]
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = alloca [3 x double]
store i32 2, i32* %1
%8 = bitcast [3 x double]* %2 to i8*
%9 = bitcast [3 x double]* %3 to i8*
%10 = bitcast [3 x double]* %4 to i8*
%11 = bitcast [3 x double]* %5 to i8*
%12 = bitcast [3 x double]* %6 to i8*
%13 = bitcast [3 x double]* %7 to i8*
%14 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%15 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%16 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%17 = load i32, i32* %1
%18 = call i32 @subDivide(double* %14, double* %15, double* %16, i32 %17)
%19 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%20 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%21 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%22 = load i32, i32* %1
%23 = call i32 @subDivide(double* %19, double* %20, double* %21, i32 %22)
ret void
}

LLVM IR (-O2):
@__const.drawGround.u2 = [3 x double] [double 1.000000e+00, double -1.000000e+00, double 0.000000e+00]
@__const.drawGround.v1 = [3 x double] [double -1.000000e+00, double -1.000000e+00, double 0.000000e+00]
@__const.drawGround.v2 = [3 x double] [double 1.000000e+00, double 1.000000e+00, double 0.000000e+00]
@__const.drawGround.v3 = [3 x double] [double -1.000000e+00, double 1.000000e+00, double 0.000000e+00]
define void @drawGround() {
%1 = alloca [3 x double]
%2 = alloca [3 x double]
%3 = alloca [3 x double]
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %1 to i8*
%8 = bitcast [3 x double]* %2 to i8*
%9 = bitcast [3 x double]* %3 to i8*
%10 = bitcast [3 x double]* %4 to i8*
%11 = bitcast [3 x double]* %5 to i8*
%12 = bitcast [3 x double]* %6 to i8*
%13 = getelementptr inbounds [3 x double], [3 x double]* %1, i64 0, i64 0
%14 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%15 = getelementptr inbounds [3 x double], [3 x double]* %3, i64 0, i64 0
%16 = call i32 @subDivide(double* %13, double* %14, double* %15, i32 2)
%17 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%18 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%19 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
%20 = call i32 @subDivide(double* %17, double* %18, double* %19, i32 2)
ret void
}