#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 size_t uint32_t;
typedef int /*<<< orphan*/ sockets;
typedef int int32_t;
typedef int /*<<< orphan*/ groups;
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int socket_ctrl(char const *const, char const *const, char const *const,
                size_t const);
int32_t rev_008345_send(uint32_t igroup, uint32_t isocket, uint32_t idata) {
  const char *const groups[] = {"1FFF", "F1FF", "FF1F", "FFF1"};
  const char *const sockets[] = {"1FF0", "F1F0", "FF10"};
  const char *const data[] = {"0001", "0010"};
  const uint32_t pulse_len = 350;
  size_t ngroups = (sizeof(groups) / sizeof((groups)[0]));
  size_t nsockets = (sizeof(sockets) / sizeof((sockets)[0]));
  size_t ndata = (sizeof(data) / sizeof((data)[0]));
  int32_t ret;
  if (igroup > (ngroups - 1)) {
    return -1;
  }
  if (isocket > (nsockets - 1)) {
    return -1;
  }
  if (idata > (ndata - 1)) {
    return -1;
  }
  ret = socket_ctrl(groups[igroup], sockets[isocket], data[idata], pulse_len);
  return ret;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0x2ca2(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0x2c9f(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0x2c9c(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2c99(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c96(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0x2c93(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    0x2c90(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0x2c95(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0x2c92(%rip),%rax
mov    %rax,-0x68(%rbp)
movq   $0x15e,-0x78(%rbp)
movq   $0x4,-0x80(%rbp)
movq   $0x3,-0x88(%rbp)
movq   $0x2,-0x90(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x80(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jbe    11d1 <rev_008345_send+0xc1>
movl   $0xffffffff,-0x4(%rbp)
jmp    124d <rev_008345_send+0x13d>
mov    -0x18(%rbp),%rax
mov    -0x88(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jbe    11f5 <rev_008345_send+0xe5>
movl   $0xffffffff,-0x4(%rbp)
jmp    124d <rev_008345_send+0x13d>
mov    -0x20(%rbp),%rax
mov    -0x90(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jbe    1219 <rev_008345_send+0x109>
movl   $0xffffffff,-0x4(%rbp)
jmp    124d <rev_008345_send+0x13d>
mov    -0x10(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rdi
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%rsi
mov    -0x20(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rdx
mov    $0x15e,%ecx
call   1030 <socket_ctrl@plt>
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
cmp    $0x3,%rdi
ja     1156 <rev_008345_send+0x46>
cmp    $0x2,%rsi
ja     1156 <rev_008345_send+0x46>
cmp    $0x1,%rdx
ja     1156 <rev_008345_send+0x46>
lea    0xf07(%rip),%rax
movslq (%rax,%rdi,4),%rdi
add    %rax,%rdi
lea    0xf09(%rip),%rax
movslq (%rax,%rsi,4),%rsi
add    %rax,%rsi
lea    0xf07(%rip),%rax
movslq (%rax,%rdx,4),%rdx
add    %rax,%rdx
mov    $0x15e,%ecx
jmp    1030 <socket_ctrl@plt>
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"1FFF\00"
@.str.1 = [5 x i8] c"F1FF\00"
@.str.2 = [5 x i8] c"FF1F\00"
@.str.3 = [5 x i8] c"FFF1\00"
@__const.rev_008345_send.groups = [4 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0)]
@.str.4 = [5 x i8] c"1FF0\00"
@.str.5 = [5 x i8] c"F1F0\00"
@.str.6 = [5 x i8] c"FF10\00"
@__const.rev_008345_send.sockets = [3 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [5 x i8] c"0001\00"
@.str.8 = [5 x i8] c"0010\00"
@__const.rev_008345_send.data = [2 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0)]
define i32 @rev_008345_send(i64 %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca [4 x i8*]
%9 = alloca [3 x i8*]
%10 = alloca [2 x i8*]
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
%16 = bitcast [4 x i8*]* %8 to i8*
%17 = bitcast [3 x i8*]* %9 to i8*
%18 = bitcast [2 x i8*]* %10 to i8*
store i64 350, i64* %11
store i64 4, i64* %12
store i64 3, i64* %13
store i64 2, i64* %14
%19 = load i64, i64* %5
%20 = load i64, i64* %12
%21 = sub i64 %20, 1
%22 = icmp ugt i64 %19, %21
br i1 %22, label %23, label %24
23: ; preds = %3
store i32 -1, i32* %4
br label %48
24: ; preds = %3
%25 = load i64, i64* %6
%26 = load i64, i64* %13
%27 = sub i64 %26, 1
%28 = icmp ugt i64 %25, %27
br i1 %28, label %29, label %30
29: ; preds = %24
store i32 -1, i32* %4
br label %48
30: ; preds = %24
%31 = load i64, i64* %7
%32 = load i64, i64* %14
%33 = sub i64 %32, 1
%34 = icmp ugt i64 %31, %33
br i1 %34, label %35, label %36
35: ; preds = %30
store i32 -1, i32* %4
br label %48
36: ; preds = %30
%37 = load i64, i64* %5
%38 = getelementptr inbounds [4 x i8*], [4 x i8*]* %8, i64 0, i64 %37
%39 = load i8*, i8** %38
%40 = load i64, i64* %6
%41 = getelementptr inbounds [3 x i8*], [3 x i8*]* %9, i64 0, i64 %40
%42 = load i8*, i8** %41
%43 = load i64, i64* %7
%44 = getelementptr inbounds [2 x i8*], [2 x i8*]* %10, i64 0, i64 %43
%45 = load i8*, i8** %44
%46 = call i32 @socket_ctrl(i8* %39, i8* %42, i8* %45, i64 350)
store i32 %46, i32* %15
%47 = load i32, i32* %15
store i32 %47, i32* %4
br label %48
48: ; preds = %36, %35, %29, %23
%49 = load i32, i32* %4
ret i32 %49
}

LLVM IR (-O2):
@.str = [5 x i8] c"1FFF\00"
@.str.1 = [5 x i8] c"F1FF\00"
@.str.2 = [5 x i8] c"FF1F\00"
@.str.3 = [5 x i8] c"FFF1\00"
@reltable.rev_008345_send = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.rev_008345_send to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.rev_008345_send to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.rev_008345_send to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.rev_008345_send to i64)) to i32)]
@.str.4 = [5 x i8] c"1FF0\00"
@.str.5 = [5 x i8] c"F1F0\00"
@.str.6 = [5 x i8] c"FF10\00"
@reltable.rev_008345_send.9 = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([3 x i32]* @reltable.rev_008345_send.9 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([3 x i32]* @reltable.rev_008345_send.9 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.6 to i64), i64 ptrtoint ([3 x i32]* @reltable.rev_008345_send.9 to i64)) to i32)]
@.str.7 = [5 x i8] c"0001\00"
@.str.8 = [5 x i8] c"0010\00"
@reltable.rev_008345_send.10 = [2 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.7 to i64), i64 ptrtoint ([2 x i32]* @reltable.rev_008345_send.10 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.8 to i64), i64 ptrtoint ([2 x i32]* @reltable.rev_008345_send.10 to i64)) to i32)]
define i32 @rev_008345_send(i64 %0, i64 %1, i64 %2) {
%4 = icmp ugt i64 %0, 3
%5 = icmp ugt i64 %1, 2
%6 = or i1 %4, %5
%7 = icmp ugt i64 %2, 1
%8 = or i1 %6, %7
br i1 %8, label %17, label %9
9: ; preds = %3
%10 = shl i64 %0, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.rev_008345_send to i8*), i64 %10)
%12 = shl i64 %1, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.rev_008345_send.9 to i8*), i64 %12)
%14 = shl i64 %2, 2
%15 = call i8* @llvm.load.relative.i64(i8* bitcast ([2 x i32]* @reltable.rev_008345_send.10 to i8*), i64 %14)
%16 = tail call i32 @socket_ctrl(i8* %11, i8* %13, i8* %15, i64 350)
br label %17
17: ; preds = %3, %9
%18 = phi i32 [ %16, %9 ], [ -1, %3 ]
ret i32 %18
}