#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*/ GLUT_HAS_OVERLAY;
int /*<<< orphan*/ GLUT_NORMAL;
int /*<<< orphan*/ GLUT_OVERLAY;
scalar_t__ glutLayerGet(int /*<<< orphan*/);
int /*<<< orphan*/ glutUseLayer(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ render_normal();
int /*<<< orphan*/ render_overlay();
void render_sub(void) {
  printf("render_sub\n");
  glutUseLayer(GLUT_NORMAL);
  render_normal();
  if (glutLayerGet(GLUT_HAS_OVERLAY)) {
    glutUseLayer(GLUT_OVERLAY);
    render_overlay();
  }
}


x86 assembly (clang, -O0):
<render_sub>:
push   %rbp
mov    %rsp,%rbp
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
call   1070 <glutUseLayer@plt>
mov    $0x0,%al
call   1030 <render_normal@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1060 <glutLayerGet@plt>
cmp    $0x0,%rax
je     11a2 <render_sub+0x52>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1070 <glutUseLayer@plt>
mov    $0x0,%al
call   1050 <render_overlay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<render_sub>:
push   %rax
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1070 <glutUseLayer@plt>
xor    %eax,%eax
call   1040 <render_normal@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1060 <glutLayerGet@plt>
test   %rax,%rax
je     119b <render_sub+0x4b>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
call   1070 <glutUseLayer@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <render_overlay@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"render_sub\0A\00"
@GLUT_NORMAL = global i32 0
@GLUT_HAS_OVERLAY = global i32 0
@GLUT_OVERLAY = global i32 0
define void @render_sub() {
%1 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @GLUT_NORMAL
%3 = call i32 @glutUseLayer(i32 %2)
%4 = call i32 (...) @render_normal()
%5 = load i32, i32* @GLUT_HAS_OVERLAY
%6 = call i64 @glutLayerGet(i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* @GLUT_OVERLAY
%10 = call i32 @glutUseLayer(i32 %9)
%11 = call i32 (...) @render_overlay()
br label %12
12: ; preds = %8, %0
ret void
}

LLVM IR (-O2):
@GLUT_NORMAL = global i32 0
@GLUT_HAS_OVERLAY = global i32 0
@GLUT_OVERLAY = global i32 0
@str = [11 x i8] c"render_sub\00"
define void @render_sub() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @GLUT_NORMAL
%3 = tail call i32 @glutUseLayer(i32 %2)
%4 = tail call i32 (...) @render_normal()
%5 = load i32, i32* @GLUT_HAS_OVERLAY
%6 = tail call i64 @glutLayerGet(i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %0
%9 = load i32, i32* @GLUT_OVERLAY
%10 = tail call i32 @glutUseLayer(i32 %9)
%11 = tail call i32 (...) @render_overlay()
br label %12
12: ; preds = %8, %0
ret void
}