#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 */
struct flock {
  int l_type;
  scalar_t__ l_len;
  scalar_t__ l_start;
  int /*<<< orphan*/ l_whence;
};

/* Variables and functions */
int /*<<< orphan*/ F_SETLKW;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ exit(int);
int fcntl(int, int /*<<< orphan*/, struct flock *);
int /*<<< orphan*/ perror(char *);
void bloqueodesbloqueo(int dbloqueo, int orden) {
  struct flock cerrojo;
  cerrojo.l_type = orden;
  cerrojo.l_whence = SEEK_SET;
  cerrojo.l_start = 0;
  cerrojo.l_len = 0;
  if (fcntl(dbloqueo, F_SETLKW, &cerrojo) == -1) {
    perror("Proxy: problemas al bloquear para impresion");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<bloqueodesbloqueo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e7e(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1030 <fcntl@plt>
cmp    $0xffffffff,%eax
jne    1194 <bloqueodesbloqueo+0x64>
lea    0xe7b(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bloqueodesbloqueo>:
sub    $0x28,%rsp
mov    %esi,0x8(%rsp)
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%rsp)
mov    0x2e94(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
call   1030 <fcntl@plt>
cmp    $0xffffffff,%eax
je     116a <bloqueodesbloqueo+0x3a>
add    $0x28,%rsp
ret
lea    0xe8f(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.flock = type { i32, i64, i64, i32 }
@SEEK_SET = global i32 0
@F_SETLKW = global i32 0
@.str = [44 x i8] c"Proxy: problemas al bloquear para impresion\00"
define void @bloqueodesbloqueo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.flock
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = getelementptr inbounds %struct.flock, %struct.flock* %5, i32 0, i32 0
store i32 %6, i32* %7
%8 = load i32, i32* @SEEK_SET
%9 = getelementptr inbounds %struct.flock, %struct.flock* %5, i32 0, i32 3
store i32 %8, i32* %9
%10 = getelementptr inbounds %struct.flock, %struct.flock* %5, i32 0, i32 2
store i64 0, i64* %10
%11 = getelementptr inbounds %struct.flock, %struct.flock* %5, i32 0, i32 1
store i64 0, i64* %11
%12 = load i32, i32* %3
%13 = load i32, i32* @F_SETLKW
%14 = call i32 @fcntl(i32 %12, i32 %13, %struct.flock* %5)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %19
16: ; preds = %2
%17 = call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %2
ret void
}

LLVM IR (-O2):
%struct.flock = type { i32, i64, i64, i32 }
@SEEK_SET = global i32 0
@F_SETLKW = global i32 0
@.str = [44 x i8] c"Proxy: problemas al bloquear para impresion\00"
define void @bloqueodesbloqueo(i32 %0, i32 %1) {
%3 = alloca %struct.flock
%4 = bitcast %struct.flock* %3 to i8*
%5 = getelementptr inbounds %struct.flock, %struct.flock* %3, i64 0, i32 0
store i32 %1, i32* %5
%6 = load i32, i32* @SEEK_SET
%7 = getelementptr inbounds %struct.flock, %struct.flock* %3, i64 0, i32 3
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.flock, %struct.flock* %3, i64 0, i32 1
%9 = bitcast i64* %8 to i8*
%10 = load i32, i32* @F_SETLKW
%11 = call i32 @fcntl(i32 %0, i32 %10, %struct.flock* %3)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
ret void
}