#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int si_int;
};
typedef TYPE_1__ siginfo_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ system(char *);
void receiveData(int n, siginfo_t *info, void *unused) {
  printf("received value %i %i\n", info->si_int & 0xFF, info->si_int >> 8);
  int code = info->si_int & 0xFF;
  int type = info->si_int >> 8;
  char cmd[100];
  if (type == 0)
    sprintf(
        cmd,
        "DISPLAY=:0 XAUTHORITY=~/.Xauthority xclip -o > /dev/multiclip/board%d",
        code);
  else
    sprintf(cmd,
            "DISPLAY=:0 XAUTHORITY=~/.Xauthority xclip -selection c -i "
            "/dev/multiclip/board%d",
            code);
  system(cmd);
}


x86 assembly (clang, -O0):
<receiveData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
and    $0xff,%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
sar    $0x8,%edx
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sar    $0x8,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    11a6 <receiveData+0x76>
lea    -0x90(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe7a(%rip),%rsi
call   1050 <sprintf@plt>
jmp    11bc <receiveData+0x8c>
lea    -0x90(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xea5(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x90(%rbp),%rdi
call   1030 <system@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<receiveData>:
push   %rbx
sub    $0x70,%rsp
mov    %rsi,%rbx
mov    (%rsi),%edx
movzbl %dl,%esi
sar    $0x8,%edx
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
mov    (%rbx),%eax
movzbl %al,%edx
cmp    $0x100,%eax
lea    0xeb9(%rip),%rax
lea    0xef8(%rip),%rsi
cmovb  %rax,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
@.str = [22 x i8] c"received value %i %i\0A\00"
@.str.1 = [70 x i8] c"DISPLAY=:0 XAUTHORITY=~/.Xauthority xclip -o > /dev/multiclip/board%d\00"
@.str.2 = [81 x i8] c"DISPLAY=:0 XAUTHORITY=~/.Xauthority xclip -selection c -i /dev/multiclip/board%d\00"
define void @receiveData(i32 %0, %struct.TYPE_3__* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.TYPE_3__*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [100 x i8]
store i32 %0, i32* %4
store %struct.TYPE_3__* %1, %struct.TYPE_3__** %5
store i8* %2, i8** %6
%10 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = and i32 %12, 255
%14 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i32 0, i32 0
%16 = load i32, i32* %15
%17 = ashr i32 %16, 8
%18 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %17)
%19 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = and i32 %21, 255
store i32 %22, i32* %7
%23 = load %struct.TYPE_3__*, %struct.TYPE_3__** %5
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %23, i32 0, i32 0
%25 = load i32, i32* %24
%26 = ashr i32 %25, 8
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %33
29: ; preds = %3
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%31 = load i32, i32* %7
%32 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0), i32 %31)
br label %37
33: ; preds = %3
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%35 = load i32, i32* %7
%36 = call i32 @sprintf(i8* %34, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.2, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %33, %29
%38 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%39 = call i32 @system(i8* %38)
ret void
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32 }
@.str = [22 x i8] c"received value %i %i\0A\00"
@.str.1 = [70 x i8] c"DISPLAY=:0 XAUTHORITY=~/.Xauthority xclip -o > /dev/multiclip/board%d\00"
@.str.2 = [81 x i8] c"DISPLAY=:0 XAUTHORITY=~/.Xauthority xclip -selection c -i /dev/multiclip/board%d\00"
define void @receiveData(i32 %0, %struct.TYPE_3__* nocapture %1, i8* nocapture readnone %2) {
%4 = alloca [100 x i8]
%5 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = and i32 %6, 255
%8 = ashr i32 %6, 8
%9 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32, i32* %5
%11 = and i32 %10, 255
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%13 = icmp ult i32 %10, 256
%14 = select i1 %13, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.2, i64 0, i64 0)
%15 = call i32 @sprintf(i8* %12, i8* dereferenceable(1) %14, i32 %11)
%16 = call i32 @system(i8* %12)
ret void
}