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

/* Variables and functions */
int /*<<< orphan*/ CL_CONTEXT_DEVICES;
int /*<<< orphan*/ CL_DEVICE_TYPE_ALL;
int CL_SUCCESS;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int clBuildProgram(scalar_t__ const, int /*<<< orphan*/, int /*<<< orphan*/ *,
                   int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/ *);
scalar_t__ clCreateCommandQueue(scalar_t__ const, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/ *);
scalar_t__ clCreateContextFromType(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                   int /*<<< orphan*/ *);
scalar_t__ clCreateKernel(scalar_t__ const, char const *const,
                          int /*<<< orphan*/ *);
scalar_t__ clCreateProgramWithSource(scalar_t__ const, int, char const **,
                                     int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
int clEnqueueNDRangeKernel(scalar_t__ const, scalar_t__ const, int,
                           int /*<<< orphan*/ *, size_t *, size_t *,
                           int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/ *);
int /*<<< orphan*/ clGetContextInfo(scalar_t__ const, int /*<<< orphan*/,
                                    size_t, int /*<<< orphan*/ *, size_t *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *const);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, long const, int, int /*<<< orphan*/ *const);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *const, int /*<<< orphan*/,
                         int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *const);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char const *const);
int call_test(char const *const name) {
  char filename[1000];
  snprintf(filename, sizeof filename, "%s/%s.cl", ".", name);
  FILE *const source_file = fopen(filename, "r");
  assert(source_file != NULL && "source file not found");
  fseek(source_file, 0, SEEK_END);
  long const source_size = ftell(source_file);
  fseek(source_file, 0, SEEK_SET);
  char source[source_size + 1];
  fread(source, source_size, 1, source_file);
  source[source_size] = '\0';
  fclose(source_file);
  cl_context const context =
      clCreateContextFromType(NULL, CL_DEVICE_TYPE_ALL, NULL, NULL, NULL);
  if (context == 0)
    return -1;
  size_t ndevices;
  clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &ndevices);
  ndevices /= sizeof(cl_device_id);
  cl_device_id devices[ndevices];
  clGetContextInfo(context, CL_CONTEXT_DEVICES, ndevices * sizeof(cl_device_id),
                   devices, NULL);
  cl_command_queue const cmd_queue =
      clCreateCommandQueue(context, devices[0], 0, NULL);
  if (cmd_queue == 0)
    return -1;
  char const *sources[] = {source};
  cl_program const program =
      clCreateProgramWithSource(context, 1, sources, NULL, NULL);
  if (program == 0)
    return -1;
  int ierr;
  ierr = clBuildProgram(program, 0, NULL, NULL, NULL, NULL);
  if (ierr != CL_SUCCESS)
    return -1;
  cl_kernel const kernel = clCreateKernel(program, name, NULL);
  if (kernel == 0)
    return -1;
  size_t global_work_size[] = {1};
  size_t local_work_size[] = {1};
  ierr = clEnqueueNDRangeKernel(cmd_queue, kernel, 1, NULL, global_work_size,
                                local_work_size, 0, NULL, NULL);
  if (ierr != CL_SUCCESS)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<call_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4a0,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x400(%rbp),%rdi
mov    -0x10(%rbp),%r8
mov    $0x3e8,%esi
lea    0xdfa(%rip),%rdx
lea    0xdfc(%rip),%rcx
call   10a0 <snprintf@plt>
lea    -0x400(%rbp),%rdi
lea    0xdeb(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x408(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x408(%rbp)
mov    %al,-0x479(%rbp)
je     124f <call_test+0x6f>
mov    $0x1,%al
mov    %al,-0x479(%rbp)
jmp    124f <call_test+0x6f>
mov    -0x479(%rbp),%al
movzbl %al,%edi
and    $0x1,%edi
call   10b0 <assert@plt>
mov    -0x408(%rbp),%rdi
mov    0x2d7a(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
mov    %esi,-0x48c(%rbp)
call   10d0 <fseek@plt>
mov    -0x408(%rbp),%rdi
call   10c0 <ftell@plt>
mov    -0x48c(%rbp),%esi
mov    %rax,-0x410(%rbp)
mov    -0x408(%rbp),%rdi
mov    0x2d24(%rip),%rax
mov    (%rax),%edx
call   10d0 <fseek@plt>
mov    -0x410(%rbp),%rcx
mov    %rcx,%rax
add    $0x1,%rax
mov    %rsp,%rdx
mov    %rdx,-0x418(%rbp)
add    $0x10,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x488(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x420(%rbp)
mov    -0x410(%rbp),%rsi
mov    -0x408(%rbp),%rcx
mov    $0x1,%edx
call   1060 <fread@plt>
mov    -0x488(%rbp),%rax
mov    -0x410(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x408(%rbp),%rdi
call   1070 <fclose@plt>
mov    0x2cb9(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdi
mov    %r8,%rdx
mov    %r8,%rcx
call   10e0 <clCreateContextFromType@plt>
mov    %rax,-0x428(%rbp)
cmpq   $0x0,-0x428(%rbp)
jne    135f <call_test+0x17f>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x42c(%rbp)
jmp    15b9 <call_test+0x3d9>
mov    -0x428(%rbp),%rdi
mov    0x2c73(%rip),%rax
mov    (%rax),%esi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x438(%rbp),%r8
mov    %rcx,%rdx
call   1040 <clGetContextInfo@plt>
mov    -0x438(%rbp),%rax
shr    $0x2,%rax
mov    %rax,-0x438(%rbp)
mov    -0x438(%rbp),%rax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x498(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x440(%rbp)
mov    -0x428(%rbp),%rdi
mov    0x2c14(%rip),%rax
mov    (%rax),%esi
mov    -0x438(%rbp),%rdx
shl    $0x2,%rdx
xor    %eax,%eax
mov    %eax,%r8d
call   1040 <clGetContextInfo@plt>
mov    -0x498(%rbp),%rax
mov    -0x428(%rbp),%rdi
mov    (%rax),%esi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1090 <clCreateCommandQueue@plt>
mov    %rax,-0x448(%rbp)
cmpq   $0x0,-0x448(%rbp)
jne    1429 <call_test+0x249>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x42c(%rbp)
jmp    15b9 <call_test+0x3d9>
mov    -0x488(%rbp),%rax
mov    %rax,-0x450(%rbp)
mov    -0x428(%rbp),%rdi
lea    -0x450(%rbp),%rdx
mov    $0x1,%esi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rcx
call   1050 <clCreateProgramWithSource@plt>
mov    %rax,-0x458(%rbp)
cmpq   $0x0,-0x458(%rbp)
jne    1482 <call_test+0x2a2>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x42c(%rbp)
jmp    15b9 <call_test+0x3d9>
mov    -0x458(%rbp),%rdi
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%rdx
mov    %r9,%rcx
mov    %r9,%r8
call   1030 <clBuildProgram@plt>
mov    %eax,-0x45c(%rbp)
mov    -0x45c(%rbp),%eax
mov    0x2b0f(%rip),%rcx
cmp    (%rcx),%eax
je     14cf <call_test+0x2ef>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x42c(%rbp)
jmp    15b9 <call_test+0x3d9>
mov    -0x458(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1100 <clCreateKernel@plt>
mov    %rax,-0x468(%rbp)
cmpq   $0x0,-0x468(%rbp)
jne    150e <call_test+0x32e>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x42c(%rbp)
jmp    15b9 <call_test+0x3d9>
mov    0xb13(%rip),%rax
mov    %rax,-0x470(%rbp)
mov    0xb05(%rip),%rax
mov    %rax,-0x478(%rbp)
mov    -0x448(%rbp),%rdi
mov    -0x468(%rbp),%rsi
lea    -0x470(%rbp),%r8
lea    -0x478(%rbp),%r9
mov    $0x1,%edx
xor    %eax,%eax
mov    %eax,%ecx
xor    %eax,%eax
sub    $0x20,%rsp
movl   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1080 <clEnqueueNDRangeKernel@plt>
add    $0x20,%rsp
mov    %eax,-0x45c(%rbp)
mov    -0x45c(%rbp),%eax
mov    0x2a36(%rip),%rcx
cmp    (%rcx),%eax
je     15a8 <call_test+0x3c8>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x42c(%rbp)
jmp    15b9 <call_test+0x3d9>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x42c(%rbp)
mov    -0x418(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_test>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rdi,%r8
lea    0xe02(%rip),%rdx
lea    0xe04(%rip),%rcx
lea    -0x440(%rbp),%rbx
mov    %rbx,%rdi
mov    $0x3e8,%esi
mov    %r8,-0x40(%rbp)
call   10a0 <snprintf@plt>
lea    0xde7(%rip),%rsi
mov    %rbx,%rdi
call   10f0 <fopen@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   10b0 <assert@plt>
mov    0x2da4(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
mov    %rbx,%rdi
call   10c0 <ftell@plt>
mov    %rax,%r15
mov    0x2d66(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10d0 <fseek@plt>
mov    %rsp,%r14
lea    0x10(%r15),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%r13
sub    %rax,%r13
mov    %r13,%rsp
mov    %r13,%rdi
mov    %r15,%rsi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1060 <fread@plt>
movb   $0x0,(%r15,%r13,1)
mov    %rbx,%rdi
call   1070 <fclose@plt>
mov    0x2d2f(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10e0 <clCreateContextFromType@plt>
test   %rax,%rax
je     13ec <call_test+0x20c>
mov    %rax,%r12
mov    %r14,-0x30(%rbp)
mov    0x2d10(%rip),%r15
mov    (%r15),%esi
lea    -0x38(%rbp),%r8
mov    %rax,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <clGetContextInfo@plt>
mov    -0x38(%rbp),%rdx
mov    %rdx,%rax
shr    $0x2,%rax
mov    %rax,-0x38(%rbp)
mov    %rsp,%rbx
lea    0xf(,%rax,4),%r14
and    $0xfffffffffffffff0,%r14
mov    %rbx,%rcx
sub    %r14,%rcx
mov    %rcx,%rsp
neg    %r14
mov    (%r15),%esi
and    $0xfffffffffffffffc,%rdx
mov    %r12,%rdi
xor    %r8d,%r8d
call   1040 <clGetContextInfo@plt>
mov    (%rbx,%r14,1),%esi
mov    %r12,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1090 <clCreateCommandQueue@plt>
test   %rax,%rax
je     13f3 <call_test+0x213>
mov    %rax,%r15
mov    %r13,-0x58(%rbp)
lea    -0x58(%rbp),%rdx
mov    %r12,%rdi
mov    $0x1,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1050 <clCreateProgramWithSource@plt>
mov    $0xffffffff,%ebx
test   %rax,%rax
je     13f8 <call_test+0x218>
mov    %rax,%r12
mov    %rax,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <clBuildProgram@plt>
mov    0x2c3f(%rip),%r13
cmp    0x0(%r13),%eax
mov    -0x30(%rbp),%r14
jne    13fc <call_test+0x21c>
mov    %r12,%rdi
mov    -0x40(%rbp),%rsi
xor    %edx,%edx
call   1100 <clCreateKernel@plt>
test   %rax,%rax
je     13fc <call_test+0x21c>
movq   $0x1,-0x50(%rbp)
movq   $0x1,-0x48(%rbp)
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x8(%rsp)
movl   $0x0,(%rsp)
lea    -0x50(%rbp),%r8
lea    -0x48(%rbp),%r9
mov    %r15,%rdi
mov    %rax,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1080 <clEnqueueNDRangeKernel@plt>
add    $0x20,%rsp
xor    %ebx,%ebx
cmp    0x0(%r13),%eax
setne  %bl
neg    %ebx
jmp    13fc <call_test+0x21c>
mov    $0xffffffff,%ebx
jmp    13fc <call_test+0x21c>
mov    $0xffffffff,%ebx
mov    -0x30(%rbp),%r14
mov    %r14,%rsp
mov    %ebx,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%s/%s.cl\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [22 x i8] c"source file not found\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@CL_DEVICE_TYPE_ALL = global i32 0
@CL_CONTEXT_DEVICES = global i32 0
@CL_SUCCESS = global i32 0
@__const.call_test.global_work_size = [1 x i64] [i64 1]
@__const.call_test.local_work_size = [1 x i64] [i64 1]
define i32 @call_test(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [1000 x i8]
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca [1 x i8*]
%15 = alloca i64
%16 = alloca i32
%17 = alloca i64
%18 = alloca [1 x i64]
%19 = alloca [1 x i64]
store i8* %0, i8** %3
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%21 = load i8*, i8** %3
%22 = call i32 @snprintf(i8* %20, i32 1000, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %24, i32** %5
%25 = load i32*, i32** %5
%26 = icmp ne i32* %25, null
br i1 %26, label %27, label %28
27: ; preds = %1
br label %28
28: ; preds = %27, %1
%29 = phi i1 [ false, %1 ], [ true, %27 ]
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load i32*, i32** %5
%33 = load i32, i32* @SEEK_END
%34 = call i32 @fseek(i32* %32, i32 0, i32 %33)
%35 = load i32*, i32** %5
%36 = call i64 @ftell(i32* %35)
store i64 %36, i64* %6
%37 = load i32*, i32** %5
%38 = load i32, i32* @SEEK_SET
%39 = call i32 @fseek(i32* %37, i32 0, i32 %38)
%40 = load i64, i64* %6
%41 = add nsw i64 %40, 1
%42 = call i8* @llvm.stacksave()
store i8* %42, i8** %7
%43 = alloca i8, i64 %41
store i64 %41, i64* %8
%44 = load i64, i64* %6
%45 = load i32*, i32** %5
%46 = call i32 @fread(i8* %43, i64 %44, i32 1, i32* %45)
%47 = load i64, i64* %6
%48 = getelementptr inbounds i8, i8* %43, i64 %47
store i8 0, i8* %48
%49 = load i32*, i32** %5
%50 = call i32 @fclose(i32* %49)
%51 = load i32, i32* @CL_DEVICE_TYPE_ALL
%52 = call i64 @clCreateContextFromType(i32* null, i32 %51, i32* null, i32* null, i32* null)
store i64 %52, i64* %9
%53 = load i64, i64* %9
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %28
store i32 -1, i32* %2
store i32 1, i32* %10
br label %111
56: ; preds = %28
%57 = load i64, i64* %9
%58 = load i32, i32* @CL_CONTEXT_DEVICES
%59 = call i32 @clGetContextInfo(i64 %57, i32 %58, i64 0, i32* null, i64* %11)
%60 = load i64, i64* %11
%61 = udiv i64 %60, 4
store i64 %61, i64* %11
%62 = load i64, i64* %11
%63 = alloca i32, i64 %62
store i64 %62, i64* %12
%64 = load i64, i64* %9
%65 = load i32, i32* @CL_CONTEXT_DEVICES
%66 = load i64, i64* %11
%67 = mul i64 %66, 4
%68 = call i32 @clGetContextInfo(i64 %64, i32 %65, i64 %67, i32* %63, i64* null)
%69 = load i64, i64* %9
%70 = getelementptr inbounds i32, i32* %63, i64 0
%71 = load i32, i32* %70
%72 = call i64 @clCreateCommandQueue(i64 %69, i32 %71, i32 0, i32* null)
store i64 %72, i64* %13
%73 = load i64, i64* %13
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %76
75: ; preds = %56
store i32 -1, i32* %2
store i32 1, i32* %10
br label %111
76: ; preds = %56
%77 = getelementptr inbounds [1 x i8*], [1 x i8*]* %14, i64 0, i64 0
store i8* %43, i8** %77
%78 = load i64, i64* %9
%79 = getelementptr inbounds [1 x i8*], [1 x i8*]* %14, i64 0, i64 0
%80 = call i64 @clCreateProgramWithSource(i64 %78, i32 1, i8** %79, i32* null, i32* null)
store i64 %80, i64* %15
%81 = load i64, i64* %15
%82 = icmp eq i64 %81, 0
br i1 %82, label %83, label %84
83: ; preds = %76
store i32 -1, i32* %2
store i32 1, i32* %10
br label %111
84: ; preds = %76
%85 = load i64, i64* %15
%86 = call i32 @clBuildProgram(i64 %85, i32 0, i32* null, i32* null, i32* null, i32* null)
store i32 %86, i32* %16
%87 = load i32, i32* %16
%88 = load i32, i32* @CL_SUCCESS
%89 = icmp ne i32 %87, %88
br i1 %89, label %90, label %91
90: ; preds = %84
store i32 -1, i32* %2
store i32 1, i32* %10
br label %111
91: ; preds = %84
%92 = load i64, i64* %15
%93 = load i8*, i8** %3
%94 = call i64 @clCreateKernel(i64 %92, i8* %93, i32* null)
store i64 %94, i64* %17
%95 = load i64, i64* %17
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %98
97: ; preds = %91
store i32 -1, i32* %2
store i32 1, i32* %10
br label %111
98: ; preds = %91
%99 = bitcast [1 x i64]* %18 to i8*
%100 = bitcast [1 x i64]* %19 to i8*
%101 = load i64, i64* %13
%102 = load i64, i64* %17
%103 = getelementptr inbounds [1 x i64], [1 x i64]* %18, i64 0, i64 0
%104 = getelementptr inbounds [1 x i64], [1 x i64]* %19, i64 0, i64 0
%105 = call i32 @clEnqueueNDRangeKernel(i64 %101, i64 %102, i32 1, i32* null, i64* %103, i64* %104, i32 0, i32* null, i32* null)
store i32 %105, i32* %16
%106 = load i32, i32* %16
%107 = load i32, i32* @CL_SUCCESS
%108 = icmp ne i32 %106, %107
br i1 %108, label %109, label %110
109: ; preds = %98
store i32 -1, i32* %2
store i32 1, i32* %10
br label %111
110: ; preds = %98
store i32 0, i32* %2
store i32 1, i32* %10
br label %111
111: ; preds = %110, %109, %97, %90, %83, %75, %55
%112 = load i8*, i8** %7
%113 = load i32, i32* %2
ret i32 %113
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s/%s.cl\00"
@.str.1 = [2 x i8] c".\00"
@.str.2 = [2 x i8] c"r\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@CL_DEVICE_TYPE_ALL = global i32 0
@CL_CONTEXT_DEVICES = global i32 0
@CL_SUCCESS = global i32 0
define i32 @call_test(i8* %0) {
%2 = alloca [1000 x i8]
%3 = alloca i64
%4 = alloca [1 x i8*]
%5 = alloca [1 x i64]
%6 = alloca [1 x i64]
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%8 = call i32 @snprintf(i8* %7, i32 1000, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%9 = call i32* @fopen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = icmp ne i32* %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32, i32* @SEEK_END
%14 = call i32 @fseek(i32* %9, i32 0, i32 %13)
%15 = call i64 @ftell(i32* %9)
%16 = load i32, i32* @SEEK_SET
%17 = call i32 @fseek(i32* %9, i32 0, i32 %16)
%18 = add nsw i64 %15, 1
%19 = call i8* @llvm.stacksave()
%20 = alloca i8, i64 %18
%21 = call i32 @fread(i8* %20, i64 %15, i32 1, i32* %9)
%22 = getelementptr inbounds i8, i8* %20, i64 %15
store i8 0, i8* %22
%23 = call i32 @fclose(i32* %9)
%24 = load i32, i32* @CL_DEVICE_TYPE_ALL
%25 = call i64 @clCreateContextFromType(i32* null, i32 %24, i32* null, i32* null, i32* null)
%26 = icmp eq i64 %25, 0
br i1 %26, label %65, label %27
27: ; preds = %1
%28 = bitcast i64* %3 to i8*
%29 = load i32, i32* @CL_CONTEXT_DEVICES
%30 = call i32 @clGetContextInfo(i64 %25, i32 %29, i64 0, i32* null, i64* %3)
%31 = load i64, i64* %3
%32 = lshr i64 %31, 2
store i64 %32, i64* %3
%33 = alloca i32, i64 %32
%34 = load i32, i32* @CL_CONTEXT_DEVICES
%35 = and i64 %31, -4
%36 = call i32 @clGetContextInfo(i64 %25, i32 %34, i64 %35, i32* %33, i64* null)
%37 = load i32, i32* %33
%38 = call i64 @clCreateCommandQueue(i64 %25, i32 %37, i32 0, i32* null)
%39 = icmp eq i64 %38, 0
br i1 %39, label %63, label %40
40: ; preds = %27
%41 = bitcast [1 x i8*]* %4 to i8*
%42 = getelementptr inbounds [1 x i8*], [1 x i8*]* %4, i64 0, i64 0
store i8* %20, i8** %42
%43 = call i64 @clCreateProgramWithSource(i64 %25, i32 1, i8** %42, i32* null, i32* null)
%44 = icmp eq i64 %43, 0
br i1 %44, label %61, label %45
45: ; preds = %40
%46 = call i32 @clBuildProgram(i64 %43, i32 0, i32* null, i32* null, i32* null, i32* null)
%47 = load i32, i32* @CL_SUCCESS
%48 = icmp eq i32 %46, %47
br i1 %48, label %49, label %61
49: ; preds = %45
%50 = call i64 @clCreateKernel(i64 %43, i8* %0, i32* null)
%51 = icmp eq i64 %50, 0
br i1 %51, label %61, label %52
52: ; preds = %49
%53 = bitcast [1 x i64]* %5 to i8*
%54 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
store i64 1, i64* %54
%55 = bitcast [1 x i64]* %6 to i8*
%56 = getelementptr inbounds [1 x i64], [1 x i64]* %6, i64 0, i64 0
store i64 1, i64* %56
%57 = call i32 @clEnqueueNDRangeKernel(i64 %38, i64 %50, i32 1, i32* null, i64* %54, i64* %56, i32 0, i32* null, i32* null)
%58 = load i32, i32* @CL_SUCCESS
%59 = icmp ne i32 %57, %58
%60 = sext i1 %59 to i32
br label %61
61: ; preds = %45, %49, %52, %40
%62 = phi i32 [ -1, %40 ], [ -1, %45 ], [ %60, %52 ], [ -1, %49 ]
br label %63
63: ; preds = %27, %61
%64 = phi i32 [ %62, %61 ], [ -1, %27 ]
br label %65
65: ; preds = %1, %63
%66 = phi i32 [ %64, %63 ], [ -1, %1 ]
ret i32 %66
}