#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 */
int /*<<< orphan*/ mbox_property(int, unsigned int *);
unsigned mem_unlock(int file_desc, unsigned handle) {
  int i = 0;
  unsigned p[32];
  p[i++] = 0;
  p[i++] = 0x00000000;
  p[i++] = 0x3000e;
  p[i++] = 4;
  p[i++] = 4;
  p[i++] = handle;
  p[i++] = 0x00000000;
  p[0] = i * sizeof *p;
  mbox_property(file_desc, p);
  return p[5];
}


x86 assembly (clang, -O0):
<mem_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cltq
movl   $0x3000e,-0x90(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cltq
movl   $0x4,-0x90(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cltq
movl   $0x4,-0x90(%rbp,%rax,4)
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
cltq
mov    %ecx,-0x90(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
cltq
movl   $0x0,-0x90(%rbp,%rax,4)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,-0x90(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x90(%rbp),%rsi
call   1030 <mbox_property@plt>
mov    -0x7c(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_unlock>:
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    0x14(%rsp),%eax
add    $0x88,%rsp
ret

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

LLVM IR (-O2):
define i32 @mem_unlock(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 196622, i32 4>, <4 x i32>* %9
%10 = call i32 @mbox_property(i32 %0, i32* %5)
%11 = load i32, i32* %7
ret i32 %11
}