#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__ mbox_property(int, unsigned int *);
unsigned qpu_enable(int file_desc, unsigned enable) {
  int i = 0;
  unsigned p[32];
  p[i++] = 0;
  p[i++] = 0x00000000;
  p[i++] = 0x30012;
  p[i++] = 4;
  p[i++] = 4;
  p[i++] = enable;
  p[i++] = 0x00000000;
  p[0] = i * sizeof *p;
  if (mbox_property(file_desc, p) < 0)
    return 0;
  return p[5];
}


x86 assembly (clang, -O0):
<qpu_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cltq
movl   $0x30012,-0x90(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cltq
movl   $0x4,-0x90(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cltq
movl   $0x4,-0x90(%rbp,%rax,4)
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x10(%rbp)
cltq
mov    %ecx,-0x90(%rbp,%rax,4)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,-0x90(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x90(%rbp),%rsi
call   1030 <mbox_property@plt>
cmp    $0x0,%rax
jge    1202 <qpu_enable+0xf2>
movl   $0x0,-0x4(%rbp)
jmp    1208 <qpu_enable+0xf8>
mov    -0x7c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qpu_enable>:
sub    $0x88,%rsp
movl   $0x4,0x10(%rsp)
mov    %esi,0x14(%rsp)
movl   $0x0,0x18(%rsp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
call   1030 <mbox_property@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
js     114c <qpu_enable+0x3c>
mov    0x14(%rsp),%eax
add    $0x88,%rsp
ret

LLVM IR (-O0):
define i32 @qpu_enable(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [32 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 0, i32* %6
%8 = load i32, i32* %6
%9 = add nsw i32 %8, 1
store i32 %9, i32* %6
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 %10
store i32 0, i32* %11
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 1
store i32 %13, i32* %6
%14 = sext i32 %12 to i64
%15 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 %14
store i32 0, i32* %15
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
%18 = sext i32 %16 to i64
%19 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 %18
store i32 196626, i32* %19
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
%22 = sext i32 %20 to i64
%23 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 %22
store i32 4, i32* %23
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
%26 = sext i32 %24 to i64
%27 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 %26
store i32 4, i32* %27
%28 = load i32, i32* %5
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
%31 = sext i32 %29 to i64
%32 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 %31
store i32 %28, i32* %32
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 %35
store i32 0, i32* %36
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = mul i64 %38, 4
%40 = trunc i64 %39 to i32
%41 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 0
store i32 %40, i32* %41
%42 = load i32, i32* %4
%43 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 0
%44 = call i64 @mbox_property(i32 %42, i32* %43)
%45 = icmp slt i64 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %2
store i32 0, i32* %3
br label %50
47: ; preds = %2
%48 = getelementptr inbounds [32 x i32], [32 x i32]* %7, i64 0, i64 5
%49 = load i32, i32* %48
store i32 %49, i32* %3
br label %50
50: ; preds = %47, %46
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
define i32 @qpu_enable(i32 %0, i32 %1) {
%3 = alloca [32 x i32]
%4 = bitcast [32 x i32]* %3 to i8*
%5 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 0
%6 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 4
store i32 4, i32* %6
%7 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 5
store i32 %1, i32* %7
%8 = getelementptr inbounds [32 x i32], [32 x i32]* %3, i64 0, i64 6
store i32 0, i32* %8
%9 = bitcast [32 x i32]* %3 to <4 x i32>*
store <4 x i32> <i32 28, i32 0, i32 196626, i32 4>, <4 x i32>* %9
%10 = call i64 @mbox_property(i32 %0, i32* %5)
%11 = icmp slt i64 %10, 0
%12 = load i32, i32* %7
%13 = select i1 %11, i32 0, i32 %12
ret i32 %13
}