#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*/ GLuint;

/* Variables and functions */
int /*<<< orphan*/ gl_AttachShader(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ gl_CreateProgram();
int /*<<< orphan*/ linkAndCheck(int /*<<< orphan*/);
GLuint createProgram(GLuint vertexShader, GLuint fragmentShader) {
  GLuint program = gl_CreateProgram();
  if (vertexShader != 0) {
    gl_AttachShader(program, vertexShader);
  }
  if (fragmentShader != 0) {
    gl_AttachShader(program, fragmentShader);
  }
  linkAndCheck(program);
  return program;
}


x86 assembly (clang, -O0):
<createProgram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <gl_CreateProgram@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     115d <createProgram+0x2d>
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <gl_AttachShader@plt>
cmpl   $0x0,-0x8(%rbp)
je     1172 <createProgram+0x42>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <gl_AttachShader@plt>
mov    -0xc(%rbp),%edi
call   1050 <linkAndCheck@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createProgram>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <gl_CreateProgram@plt>
mov    %eax,%ebx
test   %ebp,%ebp
je     114f <createProgram+0x1f>
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <gl_AttachShader@plt>
test   %r14d,%r14d
je     115e <createProgram+0x2e>
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <gl_AttachShader@plt>
mov    %ebx,%edi
call   1050 <linkAndCheck@plt>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @createProgram(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i32 (...) @gl_CreateProgram()
store i32 %6, i32* %5
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = call i32 @gl_AttachShader(i32 %10, i32 %11)
br label %13
13: ; preds = %9, %2
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %5
%18 = load i32, i32* %4
%19 = call i32 @gl_AttachShader(i32 %17, i32 %18)
br label %20
20: ; preds = %16, %13
%21 = load i32, i32* %5
%22 = call i32 @linkAndCheck(i32 %21)
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
define i32 @createProgram(i32 %0, i32 %1) {
%3 = tail call i32 (...) @gl_CreateProgram()
%4 = icmp eq i32 %0, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @gl_AttachShader(i32 %3, i32 %0)
br label %7
7: ; preds = %5, %2
%8 = icmp eq i32 %1, 0
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 @gl_AttachShader(i32 %3, i32 %1)
br label %11
11: ; preds = %9, %7
%12 = tail call i32 @linkAndCheck(i32 %3)
ret i32 %3
}