#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*/ glGetProgramInfoLog(int /*<<< orphan*/, int, int *, char *);
int /*<<< orphan*/ glGetShaderInfoLog(int /*<<< orphan*/, int, int *, char *);
scalar_t__ glIsShader(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void printLog(GLuint obj) {
  int infologLength = 0;
  char infoLog[1024];
  if (glIsShader(obj))
    glGetShaderInfoLog(obj, 1024, &infologLength, infoLog);
  else
    glGetProgramInfoLog(obj, 1024, &infologLength, infoLog);
  if (infologLength > 0)
    printf("%s\n", infoLog);
}


x86 assembly (clang, -O0):
<printLog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <glIsShader@plt>
cmp    $0x0,%rax
je     1184 <printLog+0x44>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rcx
mov    $0x400,%esi
lea    -0x8(%rbp),%rdx
call   1060 <glGetShaderInfoLog@plt>
jmp    119c <printLog+0x5c>
mov    -0x4(%rbp),%edi
lea    -0x410(%rbp),%rcx
mov    $0x400,%esi
lea    -0x8(%rbp),%rdx
call   1030 <glGetProgramInfoLog@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11b9 <printLog+0x79>
lea    -0x410(%rbp),%rsi
lea    0xe4c(%rip),%rdi
call   1040 <printf@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printLog>:
push   %rbx
sub    $0x410,%rsp
mov    %edi,%ebx
movl   $0x0,0xc(%rsp)
call   1050 <glIsShader@plt>
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %ebx,%edi
mov    $0x400,%esi
test   %rax,%rax
je     1193 <printLog+0x53>
call   1060 <glGetShaderInfoLog@plt>
cmpl   $0x0,0xc(%rsp)
jle    118a <printLog+0x4a>
lea    0xe80(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <printf@plt>
add    $0x410,%rsp
pop    %rbx
ret
call   1030 <glGetProgramInfoLog@plt>
cmpl   $0x0,0xc(%rsp)
jg     1179 <printLog+0x39>
jmp    118a <printLog+0x4a>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @printLog(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1024 x i8]
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = load i32, i32* %2
%6 = call i64 @glIsShader(i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* %2
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = call i32 @glGetShaderInfoLog(i32 %9, i32 1024, i32* %3, i8* %10)
br label %16
12: ; preds = %1
%13 = load i32, i32* %2
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%15 = call i32 @glGetProgramInfoLog(i32 %13, i32 1024, i32* %3, i8* %14)
br label %16
16: ; preds = %12, %8
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %20)
br label %22
22: ; preds = %19, %16
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @printLog(i32 %0) {
%2 = alloca i32
%3 = alloca [1024 x i8]
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = tail call i64 @glIsShader(i32 %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @glGetShaderInfoLog(i32 %0, i32 1024, i32* %2, i8* %5)
br label %12
10: ; preds = %1
%11 = call i32 @glGetProgramInfoLog(i32 %0, i32 1024, i32* %2, i8* %5)
br label %12
12: ; preds = %10, %8
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %17
17: ; preds = %15, %12
ret void
}