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

/* Variables and functions */
int /*<<< orphan*/ err_quit(char *);
int /*<<< orphan*/ errno;
scalar_t__ pthread_cond_wait(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void Pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) {
  if (pthread_cond_wait(cond, mutex) != 0)
    do {
      strerror(errno);
      puts("\n");
      err_quit("pthread cond wait error");
    } while (1);
}


x86 assembly (clang, -O0):
<Pthread_cond_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <pthread_cond_wait@plt>
cmp    $0x0,%rax
je     11a6 <Pthread_cond_wait+0x66>
jmp    116c <Pthread_cond_wait+0x2c>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe75(%rip),%rdi
call   1050 <err_quit@plt>
mov    $0x1,%al
test   $0x1,%al
jne    116c <Pthread_cond_wait+0x2c>
jmp    11a1 <Pthread_cond_wait+0x61>
jmp    11a6 <Pthread_cond_wait+0x66>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pthread_cond_wait>:
push   %r15
push   %r14
push   %rbx
call   1040 <pthread_cond_wait@plt>
test   %rax,%rax
je     118a <Pthread_cond_wait+0x4a>
mov    0x2e8a(%rip),%r15
lea    0xea3(%rip),%r14
lea    0xe9e(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r15),%edi
call   1060 <strerror@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1050 <err_quit@plt>
jmp    1170 <Pthread_cond_wait+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@errno = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [24 x i8] c"pthread cond wait error\00"
define void @Pthread_cond_wait(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32*, i32** %4
%7 = call i64 @pthread_cond_wait(i32* %5, i32* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %2
br label %10
10: ; preds = %15, %9
%11 = load i32, i32* @errno
%12 = call i32 @strerror(i32 %11)
%13 = call i32 @puts(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @err_quit(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %10
br i1 true, label %10, label %16
16: ; preds = %15
br label %17
17: ; preds = %16, %2
ret void
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [24 x i8] c"pthread cond wait error\00"
define void @Pthread_cond_wait(i32* %0, i32* %1) {
%3 = tail call i64 @pthread_cond_wait(i32* %0, i32* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2, %5
%6 = load i32, i32* @errno
%7 = tail call i32 @strerror(i32 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @err_quit(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %5
10: ; preds = %2
ret void
}