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

/* Variables and functions */
int EINVAL;
scalar_t__ SIGRTMAX;
int /*<<< orphan*/ exit(int);
int pthread_kill(int /*<<< orphan*/, scalar_t__);
int /*<<< orphan*/ pthread_self();
int /*<<< orphan*/ puts(char *);
int do_test(void) {
  int e = pthread_kill(pthread_self(), SIGRTMAX + 10);
  if (e == 0) {
    puts("kill didn't failed");
    exit(1);
  }
  if (e != EINVAL) {
    puts("error not EINVAL");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<do_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %eax,%edi
mov    0x2e88(%rip),%rax
mov    (%rax),%rsi
add    $0xa,%rsi
call   1040 <pthread_kill@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1187 <do_test+0x47>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x4(%rbp),%eax
mov    0x2e47(%rip),%rcx
cmp    (%rcx),%eax
je     11af <do_test+0x6f>
lea    0xe73(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test>:
push   %rax
xor    %eax,%eax
call   1050 <pthread_self@plt>
mov    0x2e91(%rip),%rcx
mov    (%rcx),%rsi
add    $0xa,%rsi
mov    %eax,%edi
call   1040 <pthread_kill@plt>
test   %eax,%eax
je     1170 <do_test+0x30>
mov    0x2e70(%rip),%rcx
cmp    (%rcx),%eax
jne    1179 <do_test+0x39>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe89(%rip),%rdi
jmp    1180 <do_test+0x40>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@SIGRTMAX = global i64 0
@.str = [19 x i8] c"kill didn't failed\00"
@EINVAL = global i32 0
@.str.1 = [17 x i8] c"error not EINVAL\00"
define i32 @do_test() {
%1 = alloca i32
%2 = call i32 (...) @pthread_self()
%3 = load i64, i64* @SIGRTMAX
%4 = add nsw i64 %3, 10
%5 = call i32 @pthread_kill(i32 %2, i64 %4)
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %0
%12 = load i32, i32* %1
%13 = load i32, i32* @EINVAL
%14 = icmp ne i32 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = call i32 @puts(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@SIGRTMAX = global i64 0
@.str = [19 x i8] c"kill didn't failed\00"
@EINVAL = global i32 0
@.str.1 = [17 x i8] c"error not EINVAL\00"
define i32 @do_test() {
%1 = tail call i32 (...) @pthread_self()
%2 = load i64, i64* @SIGRTMAX
%3 = add nsw i64 %2, 10
%4 = tail call i32 @pthread_kill(i32 %1, i64 %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %0
%10 = load i32, i32* @EINVAL
%11 = icmp eq i32 %4, %10
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %9
ret i32 0
}