int syndrome(int c) {
  int x;
  for (x = 11; x >= 0; x--) {
    if (c & ((1 << 11) << x)) {
      c ^= 0xC75 << x;
    }
  }
  return c;
}


x86 assembly (clang, -O0):
<syndrome>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xb,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1155 <syndrome+0x55>
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x800,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1142 <syndrome+0x42>
mov    -0x8(%rbp),%ecx
mov    $0xc75,%eax
shl    %cl,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <syndrome+0x47>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <syndrome+0xe>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<syndrome>:
mov    %edi,%eax
shl    $0x9,%eax
sar    $0x1f,%eax
and    $0x63a800,%eax
xor    %edi,%eax
mov    %eax,%ecx
shl    $0xa,%ecx
sar    $0x1f,%ecx
and    $0x31d400,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shl    $0xb,%eax
sar    $0x1f,%eax
and    $0x18ea00,%eax
xor    %ecx,%eax
mov    %eax,%ecx
shl    $0xc,%ecx
sar    $0x1f,%ecx
and    $0xc7500,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shl    $0xd,%eax
sar    $0x1f,%eax
and    $0x63a80,%eax
xor    %ecx,%eax
mov    %eax,%ecx
shl    $0xe,%ecx
sar    $0x1f,%ecx
and    $0x31d40,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shl    $0xf,%eax
sar    $0x1f,%eax
and    $0x18ea0,%eax
xor    %ecx,%eax
movswl %ax,%ecx
shr    $0xf,%ecx
and    $0xc750,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shl    $0x11,%eax
sar    $0x1f,%eax
and    $0x63a8,%eax
xor    %ecx,%eax
mov    %eax,%ecx
shl    $0x12,%ecx
sar    $0x1f,%ecx
and    $0x31d4,%ecx
xor    %eax,%ecx
mov    %ecx,%edx
shl    $0x13,%edx
sar    $0x1f,%edx
and    $0x18ea,%edx
xor    %ecx,%edx
mov    %edx,%eax
shl    $0x14,%eax
sar    $0x1f,%eax
and    $0xc75,%eax
xor    %edx,%eax
ret

LLVM IR (-O0):
define i32 @syndrome(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 11, i32* %3
br label %4
4: ; preds = %19, %1
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %22
7: ; preds = %4
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = shl i32 2048, %9
%11 = and i32 %8, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = load i32, i32* %3
%15 = shl i32 3189, %14
%16 = load i32, i32* %2
%17 = xor i32 %16, %15
store i32 %17, i32* %2
br label %18
18: ; preds = %13, %7
br label %19
19: ; preds = %18
%20 = load i32, i32* %3
%21 = add nsw i32 %20, -1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @syndrome(i32 %0) {
%2 = and i32 %0, 4194304
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 0, i32 6531072
%5 = xor i32 %4, %0
%6 = and i32 %5, 2097152
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i32 0, i32 3265536
%9 = xor i32 %8, %5
%10 = and i32 %9, 1048576
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 0, i32 1632768
%13 = xor i32 %12, %9
%14 = and i32 %13, 524288
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i32 0, i32 816384
%17 = xor i32 %16, %13
%18 = and i32 %17, 262144
%19 = icmp eq i32 %18, 0
%20 = select i1 %19, i32 0, i32 408192
%21 = xor i32 %20, %17
%22 = and i32 %21, 131072
%23 = icmp eq i32 %22, 0
%24 = select i1 %23, i32 0, i32 204096
%25 = xor i32 %24, %21
%26 = and i32 %25, 65536
%27 = icmp eq i32 %26, 0
%28 = select i1 %27, i32 0, i32 102048
%29 = xor i32 %28, %25
%30 = and i32 %29, 32768
%31 = icmp eq i32 %30, 0
%32 = select i1 %31, i32 0, i32 51024
%33 = xor i32 %32, %29
%34 = and i32 %33, 16384
%35 = icmp eq i32 %34, 0
%36 = select i1 %35, i32 0, i32 25512
%37 = xor i32 %36, %33
%38 = and i32 %37, 8192
%39 = icmp eq i32 %38, 0
%40 = select i1 %39, i32 0, i32 12756
%41 = xor i32 %40, %37
%42 = and i32 %41, 4096
%43 = icmp eq i32 %42, 0
%44 = select i1 %43, i32 0, i32 6378
%45 = xor i32 %44, %41
%46 = and i32 %45, 2048
%47 = icmp eq i32 %46, 0
%48 = select i1 %47, i32 0, i32 3189
%49 = xor i32 %48, %45
ret i32 %49
}