#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*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_UNBLOCK;
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
scalar_t__ pthread_sigmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/);
scalar_t__ sigfillset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stderr;
void *slavethread(void *arg) {
  sigset_t sigmask;
  if (sigfillset(&sigmask)) {
    fprintf(stderr, "Error line %u\n", 16);
    _exit(255);
  }
  if (pthread_sigmask(SIG_UNBLOCK, &sigmask, 0)) {
    fprintf(stderr, "Error line %u\n", 22);
    _exit(255);
  }
  while (1)
    sleep(1);
}


x86 assembly (clang, -O0):
<slavethread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <sigfillset@plt>
cmp    $0x0,%rax
je     1193 <slavethread+0x43>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
lea    0xe81(%rip),%rsi
mov    $0x10,%edx
call   1040 <fprintf@plt>
mov    $0xff,%edi
call   1030 <_exit@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
lea    -0xc(%rbp),%rsi
xor    %edx,%edx
call   1060 <pthread_sigmask@plt>
cmp    $0x0,%rax
je     11d5 <slavethread+0x85>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe3f(%rip),%rsi
mov    $0x16,%edx
call   1040 <fprintf@plt>
mov    $0xff,%edi
call   1030 <_exit@plt>
jmp    11da <slavethread+0x8a>
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    11da <slavethread+0x8a>

x86 assembly (clang, -O2):
<slavethread>:
push   %rax
lea    0x4(%rsp),%rdi
call   1050 <sigfillset@plt>
test   %rax,%rax
jne    118c <slavethread+0x3c>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
lea    0x4(%rsp),%rsi
xor    %edx,%edx
call   1060 <pthread_sigmask@plt>
test   %rax,%rax
jne    11a3 <slavethread+0x53>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1070 <sleep@plt>
jmp    1180 <slavethread+0x30>
mov    0x2e45(%rip),%rax
mov    (%rax),%edi
lea    0xe64(%rip),%rsi
mov    $0x10,%edx
jmp    11b8 <slavethread+0x68>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
mov    $0x16,%edx
call   1040 <fprintf@plt>
mov    $0xff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"Error line %u\0A\00"
@SIG_UNBLOCK = global i32 0
define i8* @slavethread(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i64 @sigfillset(i32* %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 16)
%9 = call i32 @_exit(i32 255)
unreachable
10: ; preds = %1
%11 = load i32, i32* @SIG_UNBLOCK
%12 = call i64 @pthread_sigmask(i32 %11, i32* %3, i32 0)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 22)
%17 = call i32 @_exit(i32 255)
unreachable
18: ; preds = %10
br label %19
19: ; preds = %18, %19
%20 = call i32 @sleep(i32 1)
br label %19
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"Error line %u\0A\00"
@SIG_UNBLOCK = global i32 0
define noalias i8* @slavethread(i8* nocapture readnone %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i64 @sigfillset(i32* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 16)
%9 = call i32 @_exit(i32 255)
unreachable
10: ; preds = %1
%11 = load i32, i32* @SIG_UNBLOCK
%12 = call i64 @pthread_sigmask(i32 %11, i32* %2, i32 0)
%13 = icmp eq i64 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 22)
%17 = call i32 @_exit(i32 255)
unreachable
18: ; preds = %10, %18
%19 = call i32 @sleep(i32 1)
br label %18
}