#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 /*<<< orphan*/ GLenum;
typedef int /*<<< orphan*/ GLdouble;

/* Variables and functions */
int /*<<< orphan*/ drawtriangle(int, int, int, int /*<<< orphan*/ *,
                                int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/);
void tetrahedron(GLdouble p0[3], GLdouble radius, GLenum shadeType) {
  int i;
  for (i = 0; i < 4; i++)
    drawtriangle(i, 2, 1, p0, radius, shadeType, 0);
}


x86 assembly (clang, -O0):
<tetrahedron>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jge    1168 <tetrahedron+0x58>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    $0x2,%esi
mov    $0x1,%edx
xor    %eax,%eax
movl   $0x0,(%rsp)
call   1030 <drawtriangle@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <tetrahedron+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tetrahedron>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
movl   $0x0,(%rsp)
xor    %edi,%edi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
mov    %ebp,%r8d
mov    %r14d,%r9d
call   1030 <drawtriangle@plt>
movl   $0x0,(%rsp)
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
mov    %ebp,%r8d
mov    %r14d,%r9d
call   1030 <drawtriangle@plt>
movl   $0x0,(%rsp)
mov    $0x2,%edi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
mov    %ebp,%r8d
mov    %r14d,%r9d
call   1030 <drawtriangle@plt>
movl   $0x0,(%rsp)
mov    $0x3,%edi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
mov    %ebp,%r8d
mov    %r14d,%r9d
call   1030 <drawtriangle@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @tetrahedron(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %17, %3
%9 = load i32, i32* %7
%10 = icmp slt i32 %9, 4
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = load i32, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = call i32 @drawtriangle(i32 %12, i32 2, i32 1, i32* %13, i32 %14, i32 %15, i32 0)
br label %17
17: ; preds = %11
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 1
store i32 %19, i32* %7
br label %8
20: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @tetrahedron(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @drawtriangle(i32 0, i32 2, i32 1, i32* %0, i32 %1, i32 %2, i32 0)
%5 = tail call i32 @drawtriangle(i32 1, i32 2, i32 1, i32* %0, i32 %1, i32 %2, i32 0)
%6 = tail call i32 @drawtriangle(i32 2, i32 2, i32 1, i32* %0, i32 %1, i32 %2, i32 0)
%7 = tail call i32 @drawtriangle(i32 3, i32 2, i32 1, i32* %0, i32 %1, i32 %2, i32 0)
ret void
}