#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 */
scalar_t__ CNFGGetExtension(char *);
void CNFGSetVSync(int vson) {
  void (*glfn)(int);
  glfn = (void (*)(int))CNFGGetExtension("glXSwapIntervalMESA");
  if (glfn)
    glfn(vson);
  glfn = (void (*)(int))CNFGGetExtension("glXSwapIntervalSGI");
  if (glfn)
    glfn(vson);
  glfn = (void (*)(int))CNFGGetExtension("glXSwapIntervalEXT");
  if (glfn)
    glfn(vson);
}


x86 assembly (clang, -O0):
<CNFGSetVSync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <CNFGGetExtension@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113f <CNFGSetVSync+0x2f>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
call   *%rax
lea    0xece(%rip),%rdi
call   1030 <CNFGGetExtension@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1163 <CNFGSetVSync+0x53>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
call   *%rax
lea    0xebd(%rip),%rdi
call   1030 <CNFGGetExtension@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1187 <CNFGSetVSync+0x77>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CNFGSetVSync>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
call   1030 <CNFGGetExtension@plt>
test   %rax,%rax
je     1128 <CNFGSetVSync+0x18>
mov    %ebx,%edi
call   *%rax
lea    0xee5(%rip),%rdi
call   1030 <CNFGGetExtension@plt>
test   %rax,%rax
je     113d <CNFGSetVSync+0x2d>
mov    %ebx,%edi
call   *%rax
lea    0xee3(%rip),%rdi
call   1030 <CNFGGetExtension@plt>
test   %rax,%rax
je     1153 <CNFGSetVSync+0x43>
mov    %ebx,%edi
pop    %rbx
jmp    *%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"glXSwapIntervalMESA\00"
@.str.1 = [19 x i8] c"glXSwapIntervalSGI\00"
@.str.2 = [19 x i8] c"glXSwapIntervalEXT\00"
define void @CNFGSetVSync(i32 %0) {
%2 = alloca i32
%3 = alloca void (i32)*
store i32 %0, i32* %2
%4 = call i64 @CNFGGetExtension(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%5 = inttoptr i64 %4 to void (i32)*
store void (i32)* %5, void (i32)** %3
%6 = load void (i32)*, void (i32)** %3
%7 = icmp ne void (i32)* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load void (i32)*, void (i32)** %3
%10 = load i32, i32* %2
br label %11
11: ; preds = %8, %1
%12 = call i64 @CNFGGetExtension(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%13 = inttoptr i64 %12 to void (i32)*
store void (i32)* %13, void (i32)** %3
%14 = load void (i32)*, void (i32)** %3
%15 = icmp ne void (i32)* %14, null
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load void (i32)*, void (i32)** %3
%18 = load i32, i32* %2
br label %19
19: ; preds = %16, %11
%20 = call i64 @CNFGGetExtension(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%21 = inttoptr i64 %20 to void (i32)*
store void (i32)* %21, void (i32)** %3
%22 = load void (i32)*, void (i32)** %3
%23 = icmp ne void (i32)* %22, null
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load void (i32)*, void (i32)** %3
%26 = load i32, i32* %2
br label %27
27: ; preds = %24, %19
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"glXSwapIntervalMESA\00"
@.str.1 = [19 x i8] c"glXSwapIntervalSGI\00"
@.str.2 = [19 x i8] c"glXSwapIntervalEXT\00"
define void @CNFGSetVSync(i32 %0) {
%2 = tail call i64 @CNFGGetExtension(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = inttoptr i64 %2 to void (i32)*
tail call void %5(i32 %0)
br label %6
6: ; preds = %4, %1
%7 = tail call i64 @CNFGGetExtension(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = inttoptr i64 %7 to void (i32)*
tail call void %10(i32 %0)
br label %11
11: ; preds = %9, %6
%12 = tail call i64 @CNFGGetExtension(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = inttoptr i64 %12 to void (i32)*
tail call void %15(i32 %0)
br label %16
16: ; preds = %14, %11
ret void
}