#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 */
typedef int /*<<< orphan*/ CRYPTO_RWLOCK;

/* Variables and functions */
int /*<<< orphan*/ ossl_assert_int(int, char *, char *, int);
int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock) {
  if (!ossl_assert_int(
          (*(unsigned int *)lock == 1) != 0,
          "Assertion failed: "
          "*(unsigned int *)lock == 1",
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/FriendSoftwareLabs/friendup/refs/heads/"
          "master/libs-ext/openssl/crypto/threads_none.c",
          36))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<CRYPTO_THREAD_read_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x1,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
lea    0xec3(%rip),%rsi
lea    0xee9(%rip),%rdx
mov    $0x24,%ecx
call   1030 <ossl_assert_int@plt>
cmp    $0x0,%eax
jne    1163 <CRYPTO_THREAD_read_lock+0x53>
movl   $0x0,-0x4(%rbp)
jmp    116a <CRYPTO_THREAD_read_lock+0x5a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRYPTO_THREAD_read_lock>:
push   %rax
xor    %eax,%eax
cmpl   $0x1,(%rdi)
sete   %al
lea    0xee0(%rip),%rsi
lea    0xf06(%rip),%rdx
mov    %eax,%edi
mov    $0x24,%ecx
call   1030 <ossl_assert_int@plt>
xor    %ecx,%ecx
test   %eax,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"Assertion failed: *(unsigned int *)lock == 1\00"
@.str.1 = [175 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FriendSoftwareLabs/friendup/refs/heads/master/libs-ext/openssl/crypto/threads_none.c\00"
define i32 @CRYPTO_THREAD_read_lock(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
%10 = call i32 @ossl_assert_int(i32 %9, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str.1, i64 0, i64 0), i32 36)
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %1
store i32 0, i32* %2
br label %14
13: ; preds = %1
store i32 1, i32* %2
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [45 x i8] c"Assertion failed: *(unsigned int *)lock == 1\00"
@.str.1 = [175 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FriendSoftwareLabs/friendup/refs/heads/master/libs-ext/openssl/crypto/threads_none.c\00"
define i32 @CRYPTO_THREAD_read_lock(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 1
%4 = zext i1 %3 to i32
%5 = tail call i32 @ossl_assert_int(i32 %4, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str.1, i64 0, i64 0), i32 36)
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}