void MaskCombineEvent(int efnum) {
  int indx;
  int num;
  unsigned long tmp;
  if (efnum < 4) {
    printf("bad efnum, you cannot combine 0-3 itself\n");
    return;
  }
  indx = efnum % 32;
  num = efnum / 32;
  tmp = ({
    unsigned long __v =
        (*(volatile unsigned long *)(((0x01800000 + 0x80) + (num * 4))));
    __v;
  });
  tmp |= (1 << indx);
  ({
    unsigned long __v = tmp;
    (*(volatile unsigned long *)(((0x01800000 + 0x80) + (num * 4))) = (__v));
    __v;
  });
}


x86 assembly (clang, -O0):
<MaskCombineEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jge    1138 <MaskCombineEvent+0x28>
lea    0xed4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b0 <MaskCombineEvent+0xa0>
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
add    $0x1800080,%eax
cltq
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
add    $0x1800080,%eax
cltq
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MaskCombineEvent>:
cmp    $0x3,%edi
jg     1121 <MaskCombineEvent+0x11>
lea    0xee4(%rip),%rdi
jmp    1030 <puts@plt>
mov    %edi,%eax
shr    $0x3,%eax
and    $0xfffffffc,%eax
mov    $0x1,%edx
mov    %edi,%ecx
shl    %cl,%edx
movslq %edx,%rcx
or     %rcx,0x1800080(%rax)
ret

LLVM IR (-O0):
@.str = [42 x i8] c"bad efnum, you cannot combine 0-3 itself\0A\00"
define void @MaskCombineEvent(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i32 %0, i32* %2
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
br label %41
14: ; preds = %1
%15 = load i32, i32* %2
%16 = srem i32 %15, 32
store i32 %16, i32* %3
%17 = load i32, i32* %2
%18 = sdiv i32 %17, 32
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = mul nsw i32 %19, 4
%21 = add nsw i32 25165952, %20
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i64*
%24 = load volatile i64, i64* %23
store i64 %24, i64* %6
%25 = load i64, i64* %6
store i64 %25, i64* %7
%26 = load i64, i64* %7
store i64 %26, i64* %5
%27 = load i32, i32* %3
%28 = shl i32 1, %27
%29 = sext i32 %28 to i64
%30 = load i64, i64* %5
%31 = or i64 %30, %29
store i64 %31, i64* %5
%32 = load i64, i64* %5
store i64 %32, i64* %8
%33 = load i64, i64* %8
%34 = load i32, i32* %4
%35 = mul nsw i32 %34, 4
%36 = add nsw i32 25165952, %35
%37 = sext i32 %36 to i64
%38 = inttoptr i64 %37 to i64*
store volatile i64 %33, i64* %38
%39 = load i64, i64* %8
store i64 %39, i64* %9
%40 = load i64, i64* %9
br label %41
41: ; preds = %14, %12
ret void
}

LLVM IR (-O2):
@str = [41 x i8] c"bad efnum, you cannot combine 0-3 itself\00"
define void @MaskCombineEvent(i32 %0) {
%2 = icmp slt i32 %0, 4
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %16
5: ; preds = %1
%6 = lshr i32 %0, 3
%7 = and i32 %6, 536870908
%8 = add nuw nsw i32 %7, 25165952
%9 = zext i32 %8 to i64
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
%12 = and i32 %0, 31
%13 = shl nuw i32 1, %12
%14 = sext i32 %13 to i64
%15 = or i64 %11, %14
store volatile i64 %15, i64* %10
br label %16
16: ; preds = %5, %3
ret void
}