#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 */
union sigval {
  int sival_int;
};
struct sigaction {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ LOG_DEBUG;
int /*<<< orphan*/ SIGRTMIN;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ sigqueue(int, int /*<<< orphan*/, union sigval);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, int, int /*<<< orphan*/);
void send_shm(int spid, int shmid) {
  union sigval val;
  struct sigaction act;
  syslog(LOG_DEBUG, "daemon: send shmid %d %d", shmid, getpid());
  val.sival_int = shmid;
  sigqueue(spid, SIGRTMIN, val);
}


x86 assembly (clang, -O0):
<send_shm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0x20(%rbp),%edi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
lea    0xe9a(%rip),%rsi
call   1040 <syslog@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%edx
call   1050 <sigqueue@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_shm>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
mov    0x2e98(%rip),%rax
mov    (%rax),%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xeb0(%rip),%rsi
mov    %ebp,%edi
mov    %ebx,%edx
mov    %eax,%ecx
call   1040 <syslog@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%esi
mov    %r14d,%edi
mov    %ebx,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <sigqueue@plt>

LLVM IR (-O0):
%union.sigval = type { i32 }
%struct.sigaction = type { i32 }
@LOG_DEBUG = global i32 0
@.str = [25 x i8] c"daemon: send shmid %d %d\00"
@SIGRTMIN = global i32 0
define void @send_shm(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %union.sigval
%6 = alloca %struct.sigaction
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* @LOG_DEBUG
%8 = load i32, i32* %4
%9 = call i32 (...) @getpid()
%10 = call i32 @syslog(i32 %7, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* %4
%12 = bitcast %union.sigval* %5 to i32*
store i32 %11, i32* %12
%13 = load i32, i32* %3
%14 = load i32, i32* @SIGRTMIN
%15 = getelementptr inbounds %union.sigval, %union.sigval* %5, i32 0, i32 0
%16 = load i32, i32* %15
%17 = call i32 @sigqueue(i32 %13, i32 %14, i32 %16)
ret void
}

LLVM IR (-O2):
@LOG_DEBUG = global i32 0
@.str = [25 x i8] c"daemon: send shmid %d %d\00"
@SIGRTMIN = global i32 0
define void @send_shm(i32 %0, i32 %1) {
%3 = load i32, i32* @LOG_DEBUG
%4 = tail call i32 (...) @getpid()
%5 = tail call i32 @syslog(i32 %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %4)
%6 = load i32, i32* @SIGRTMIN
%7 = tail call i32 @sigqueue(i32 %0, i32 %6, i32 %1)
ret void
}