#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*/ GL_ALWAYS;
int /*<<< orphan*/ GL_DEPTH_TEST;
int /*<<< orphan*/ GL_FALSE;
int /*<<< orphan*/ GL_LESS;
int /*<<< orphan*/ GL_STENCIL_TEST;
int /*<<< orphan*/ glColorMask(int /*<<< orphan*/, int /*<<< orphan*/,
                               int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glDepthFunc(int /*<<< orphan*/);
int /*<<< orphan*/ glDisable(int /*<<< orphan*/);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
void fixDepth(void (*a)(void)) {
  glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
  glEnable(GL_DEPTH_TEST);
  glDisable(GL_STENCIL_TEST);
  glDepthFunc(GL_ALWAYS);
  a();
  glDepthFunc(GL_LESS);
}


x86 assembly (clang, -O0):
<fixDepth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
mov    0x2e8c(%rip),%rax
mov    (%rax),%esi
mov    0x2e83(%rip),%rax
mov    (%rax),%edx
mov    0x2e7a(%rip),%rax
mov    (%rax),%ecx
call   1050 <glColorMask@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1030 <glEnable@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
call   1060 <glDisable@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1040 <glDepthFunc@plt>
call   *-0x8(%rbp)
mov    0x2e0f(%rip),%rax
mov    (%rax),%edi
call   1040 <glDepthFunc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixDepth>:
push   %rbx
mov    %rdi,%rbx
mov    0x2e9d(%rip),%rax
mov    (%rax),%ecx
mov    %ecx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1050 <glColorMask@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
call   1030 <glEnable@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1060 <glDisable@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1040 <glDepthFunc@plt>
call   *%rbx
mov    0x2e2d(%rip),%rax
mov    (%rax),%edi
pop    %rbx
jmp    1040 <glDepthFunc@plt>

LLVM IR (-O0):
@GL_FALSE = global i32 0
@GL_DEPTH_TEST = global i32 0
@GL_STENCIL_TEST = global i32 0
@GL_ALWAYS = global i32 0
@GL_LESS = global i32 0
define void @fixDepth(void ()* %0) {
%2 = alloca void ()*
store void ()* %0, void ()** %2
%3 = load i32, i32* @GL_FALSE
%4 = load i32, i32* @GL_FALSE
%5 = load i32, i32* @GL_FALSE
%6 = load i32, i32* @GL_FALSE
%7 = call i32 @glColorMask(i32 %3, i32 %4, i32 %5, i32 %6)
%8 = load i32, i32* @GL_DEPTH_TEST
%9 = call i32 @glEnable(i32 %8)
%10 = load i32, i32* @GL_STENCIL_TEST
%11 = call i32 @glDisable(i32 %10)
%12 = load i32, i32* @GL_ALWAYS
%13 = call i32 @glDepthFunc(i32 %12)
%14 = load void ()*, void ()** %2
%15 = load i32, i32* @GL_LESS
%16 = call i32 @glDepthFunc(i32 %15)
ret void
}

LLVM IR (-O2):
@GL_FALSE = global i32 0
@GL_DEPTH_TEST = global i32 0
@GL_STENCIL_TEST = global i32 0
@GL_ALWAYS = global i32 0
@GL_LESS = global i32 0
define void @fixDepth(void ()* nocapture %0) {
%2 = load i32, i32* @GL_FALSE
%3 = tail call i32 @glColorMask(i32 %2, i32 %2, i32 %2, i32 %2)
%4 = load i32, i32* @GL_DEPTH_TEST
%5 = tail call i32 @glEnable(i32 %4)
%6 = load i32, i32* @GL_STENCIL_TEST
%7 = tail call i32 @glDisable(i32 %6)
%8 = load i32, i32* @GL_ALWAYS
%9 = tail call i32 @glDepthFunc(i32 %8)
tail call void %0()
%10 = load i32, i32* @GL_LESS
%11 = tail call i32 @glDepthFunc(i32 %10)
ret void
}