#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 scalar_t__ cl_int;
typedef int /*<<< orphan*/ cl_device_id;
typedef int /*<<< orphan*/ cl_context;
typedef int cl_command_queue;

/* Variables and functions */
int /*<<< orphan*/ CL_QUEUE_PROFILING_ENABLE;
scalar_t__ CL_SUCCESS;
int /*<<< orphan*/ assert(int);
int clCreateCommandQueue(int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/, scalar_t__ *);
int CreateCommandQueue(cl_command_queue *cmd_q, cl_context ctx,
                       cl_device_id dev) {
  cl_int status = 0;
  *cmd_q = clCreateCommandQueue(ctx, dev, CL_QUEUE_PROFILING_ENABLE, &status);
  assert(status == CL_SUCCESS);
  assert(*cmd_q);
  return 0;
}


x86 assembly (clang, -O0):
<CreateCommandQueue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
lea    -0x18(%rbp),%rcx
call   1030 <clCreateCommandQueue@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    0x2e73(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CreateCommandQueue>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movq   $0x0,0x8(%rsp)
mov    0x2ec0(%rip),%rax
mov    (%rax),%eax
lea    0x8(%rsp),%rcx
mov    %esi,%edi
mov    %edx,%esi
mov    %eax,%edx
call   1030 <clCreateCommandQueue@plt>
mov    %eax,(%rbx)
mov    0x8(%rsp),%rax
mov    0x2e80(%rip),%rcx
xor    %edi,%edi
cmp    (%rcx),%rax
sete   %dil
call   1040 <assert@plt>
mov    (%rbx),%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@CL_QUEUE_PROFILING_ENABLE = global i32 0
@CL_SUCCESS = global i64 0
define i32 @CreateCommandQueue(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i64 0, i64* %7
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = load i32, i32* @CL_QUEUE_PROFILING_ENABLE
%11 = call i32 @clCreateCommandQueue(i32 %8, i32 %9, i32 %10, i64* %7)
%12 = load i32*, i32** %4
store i32 %11, i32* %12
%13 = load i64, i64* %7
%14 = load i64, i64* @CL_SUCCESS
%15 = icmp eq i64 %13, %14
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load i32*, i32** %4
%19 = load i32, i32* %18
%20 = call i32 @assert(i32 %19)
ret i32 0
}

LLVM IR (-O2):
@CL_QUEUE_PROFILING_ENABLE = global i32 0
@CL_SUCCESS = global i64 0
define i32 @CreateCommandQueue(i32* nocapture %0, i32 %1, i32 %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%6 = load i32, i32* @CL_QUEUE_PROFILING_ENABLE
%7 = call i32 @clCreateCommandQueue(i32 %1, i32 %2, i32 %6, i64* %4)
store i32 %7, i32* %0
%8 = load i64, i64* %4
%9 = load i64, i64* @CL_SUCCESS
%10 = icmp eq i64 %8, %9
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* %0
%14 = call i32 @assert(i32 %13)
ret i32 0
}