#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__ offloading_disabled();
int omp_is_initial_device();
int /*<<< orphan*/ printf(char *);
int check_offloading() {
  int A[1] = {-1};
  if (offloading_disabled())
    A[0] = 0;
  else {
#pragma omp target
    { A[0] = omp_is_initial_device(); }
  }
  if (!A[0]) {
    printf("Able to use offloading!\n");
    return 0;
  } else
    printf("### Unable to use offloading!  8^( ###\n");
  return 1;
}


x86 assembly (clang, -O0):
<check_offloading>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec2(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <offloading_disabled@plt>
cmp    $0x0,%rax
je     115e <check_offloading+0x2e>
movl   $0x0,-0x8(%rbp)
jmp    1168 <check_offloading+0x38>
mov    $0x0,%al
call   1050 <omp_is_initial_device@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    118a <check_offloading+0x5a>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    119d <check_offloading+0x6d>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_offloading>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <offloading_disabled@plt>
test   %rax,%rax
je     1148 <check_offloading+0x18>
lea    0xeba(%rip),%rdi
jmp    1168 <check_offloading+0x38>
xor    %eax,%eax
call   1050 <omp_is_initial_device@plt>
xor    %ebx,%ebx
test   %eax,%eax
setne  %bl
lea    0xea3(%rip),%rax
lea    0xeb4(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.check_offloading.A = [1 x i32] [i32 -1]
@.str = [25 x i8] c"Able to use offloading!\0A\00"
@.str.1 = [40 x i8] c"### Unable to use offloading! 8^( ###\0A\00"
define i32 @check_offloading() {
%1 = alloca i32
%2 = alloca [1 x i32]
%3 = bitcast [1 x i32]* %2 to i8*
%4 = call i64 (...) @offloading_disabled()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
store i32 0, i32* %7
br label %11
8: ; preds = %0
%9 = call i32 (...) @omp_is_initial_device()
%10 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
store i32 %9, i32* %10
br label %11
11: ; preds = %8, %6
%12 = getelementptr inbounds [1 x i32], [1 x i32]* %2, i64 0, i64 0
%13 = load i32, i32* %12
%14 = icmp ne i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %20
17: ; preds = %11
%18 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17
store i32 1, i32* %1
br label %20
20: ; preds = %19, %15
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
@str = [24 x i8] c"Able to use offloading!\00"
@str.2 = [39 x i8] c"### Unable to use offloading! 8^( ###\00"
define i32 @check_offloading() {
%1 = tail call i64 (...) @offloading_disabled()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %9
3: ; preds = %0
%4 = tail call i32 (...) @omp_is_initial_device()
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @str.2, i64 0, i64 0)
%7 = xor i1 %5, true
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %3, %0
%10 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0), %0 ], [ %6, %3 ]
%11 = phi i32 [ 0, %0 ], [ %8, %3 ]
%12 = tail call i32 @puts(i8* dereferenceable(1) %10)
ret i32 %11
}