#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 */
typedef struct TYPE_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ __lock;
};
struct TYPE_5__ {
  TYPE_1__ __data;
};
typedef TYPE_2__ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ __ESBMC_assert(scalar_t__, char *);
int /*<<< orphan*/ __ESBMC_atomic_begin();
int /*<<< orphan*/ __ESBMC_atomic_end();
int pthread_mutex_unlock_nocheck(pthread_mutex_t *mutex) {
__ESBMC_HIDE:
  __ESBMC_atomic_begin();
  __ESBMC_assert(((*mutex).__data.__lock), "must hold lock upon unlock");
  ((*mutex).__data.__lock) = 0;
  __ESBMC_atomic_end();
  return 0;
}


x86 assembly (clang, -O0):
<pthread_mutex_unlock_nocheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <__ESBMC_atomic_begin@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <__ESBMC_assert@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
mov    $0x0,%al
call   1040 <__ESBMC_atomic_end@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_mutex_unlock_nocheck>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <__ESBMC_atomic_begin@plt>
mov    (%rbx),%rdi
lea    0xebb(%rip),%rsi
call   1030 <__ESBMC_assert@plt>
movq   $0x0,(%rbx)
xor    %eax,%eax
call   1040 <__ESBMC_atomic_end@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@.str = [27 x i8] c"must hold lock upon unlock\00"
define i32 @pthread_mutex_unlock_nocheck(%struct.TYPE_5__* %0) {
%2 = alloca %struct.TYPE_5__*
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %2
br label %3
3: ; preds = %1
%4 = call i32 (...) @__ESBMC_atomic_begin()
%5 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%6 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %5, i32 0, i32 0
%7 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = call i32 @__ESBMC_assert(i64 %8, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%10 = load %struct.TYPE_5__*, %struct.TYPE_5__** %2
%11 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %10, i32 0, i32 0
%12 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %11, i32 0, i32 0
store i64 0, i64* %12
%13 = call i32 (...) @__ESBMC_atomic_end()
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i64 }
@.str = [27 x i8] c"must hold lock upon unlock\00"
define i32 @pthread_mutex_unlock_nocheck(%struct.TYPE_5__* nocapture %0) {
%2 = tail call i32 (...) @__ESBMC_atomic_begin()
%3 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0, i32 0
%4 = load i64, i64* %3
%5 = tail call i32 @__ESBMC_assert(i64 %4, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %3
%6 = tail call i32 (...) @__ESBMC_atomic_end()
ret i32 0
}