#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 */

/* Variables and functions */
int __builtin_s390_lcbb(void const *, int);
int __lcbb(const void *ptr, int bndry) {
  int code;
  switch (bndry) {
  case 64:
    code = 0;
    break;
  case 128:
    code = 1;
    break;
  case 256:
    code = 2;
    break;
  case 512:
    code = 3;
    break;
  case 1024:
    code = 4;
    break;
  case 2048:
    code = 5;
    break;
  case 4096:
    code = 6;
    break;
  default:
    return 0;
  }
  return __builtin_s390_lcbb(ptr, code);
}


x86 assembly (clang, -O0):
<__lcbb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x40,%eax
je     11a5 <__lcbb+0x95>
jmp    1133 <__lcbb+0x23>
mov    -0x1c(%rbp),%eax
sub    $0x80,%eax
je     11b1 <__lcbb+0xa1>
jmp    1146 <__lcbb+0x36>
mov    -0x1c(%rbp),%eax
sub    $0x100,%eax
je     11bd <__lcbb+0xad>
jmp    1159 <__lcbb+0x49>
mov    -0x1c(%rbp),%eax
sub    $0x200,%eax
je     11c9 <__lcbb+0xb9>
jmp    116c <__lcbb+0x5c>
mov    -0x1c(%rbp),%eax
sub    $0x400,%eax
je     11d5 <__lcbb+0xc5>
jmp    117f <__lcbb+0x6f>
mov    -0x1c(%rbp),%eax
sub    $0x800,%eax
je     11e1 <__lcbb+0xd1>
jmp    1192 <__lcbb+0x82>
mov    -0x1c(%rbp),%eax
sub    $0x1000,%eax
je     11ed <__lcbb+0xdd>
jmp    11f9 <__lcbb+0xe9>
movl   $0x0,-0x18(%rbp)
jmp    1205 <__lcbb+0xf5>
movl   $0x1,-0x18(%rbp)
jmp    1205 <__lcbb+0xf5>
movl   $0x2,-0x18(%rbp)
jmp    1205 <__lcbb+0xf5>
movl   $0x3,-0x18(%rbp)
jmp    1205 <__lcbb+0xf5>
movl   $0x4,-0x18(%rbp)
jmp    1205 <__lcbb+0xf5>
movl   $0x5,-0x18(%rbp)
jmp    1205 <__lcbb+0xf5>
movl   $0x6,-0x18(%rbp)
jmp    1205 <__lcbb+0xf5>
movl   $0x0,-0x4(%rbp)
jmp    1214 <__lcbb+0x104>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <__builtin_s390_lcbb@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__lcbb>:
cmp    $0x1ff,%esi
jle    113a <__lcbb+0x2a>
cmp    $0x7ff,%esi
jg     1159 <__lcbb+0x49>
cmp    $0x200,%esi
je     1173 <__lcbb+0x63>
cmp    $0x400,%esi
jne    118e <__lcbb+0x7e>
mov    $0x4,%esi
jmp    1030 <__builtin_s390_lcbb@plt>
cmp    $0x40,%esi
je     117d <__lcbb+0x6d>
cmp    $0x80,%esi
je     1191 <__lcbb+0x81>
cmp    $0x100,%esi
jne    118e <__lcbb+0x7e>
mov    $0x2,%esi
jmp    1030 <__builtin_s390_lcbb@plt>
cmp    $0x800,%esi
je     1184 <__lcbb+0x74>
cmp    $0x1000,%esi
jne    118e <__lcbb+0x7e>
mov    $0x6,%esi
jmp    1030 <__builtin_s390_lcbb@plt>
mov    $0x3,%esi
jmp    1030 <__builtin_s390_lcbb@plt>
xor    %esi,%esi
jmp    1030 <__builtin_s390_lcbb@plt>
mov    $0x5,%esi
jmp    1030 <__builtin_s390_lcbb@plt>
xor    %eax,%eax
ret
mov    $0x1,%esi
jmp    1030 <__builtin_s390_lcbb@plt>

LLVM IR (-O0):
define i32 @__lcbb(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
switch i32 %7, label %15 [
i32 64, label %8
i32 128, label %9
i32 256, label %10
i32 512, label %11
i32 1024, label %12
i32 2048, label %13
i32 4096, label %14
]
8: ; preds = %2
store i32 0, i32* %6
br label %16
9: ; preds = %2
store i32 1, i32* %6
br label %16
10: ; preds = %2
store i32 2, i32* %6
br label %16
11: ; preds = %2
store i32 3, i32* %6
br label %16
12: ; preds = %2
store i32 4, i32* %6
br label %16
13: ; preds = %2
store i32 5, i32* %6
br label %16
14: ; preds = %2
store i32 6, i32* %6
br label %16
15: ; preds = %2
store i32 0, i32* %3
br label %20
16: ; preds = %14, %13, %12, %11, %10, %9, %8
%17 = load i8*, i8** %4
%18 = load i32, i32* %6
%19 = call i32 @__builtin_s390_lcbb(i8* %17, i32 %18)
store i32 %19, i32* %3
br label %20
20: ; preds = %16, %15
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @__lcbb(i8* %0, i32 %1) {
switch i32 %1, label %12 [
i32 64, label %9
i32 128, label %3
i32 256, label %4
i32 512, label %5
i32 1024, label %6
i32 2048, label %7
i32 4096, label %8
]
3: ; preds = %2
br label %9
4: ; preds = %2
br label %9
5: ; preds = %2
br label %9
6: ; preds = %2
br label %9
7: ; preds = %2
br label %9
8: ; preds = %2
br label %9
9: ; preds = %2, %8, %7, %6, %5, %4, %3
%10 = phi i32 [ 6, %8 ], [ 5, %7 ], [ 4, %6 ], [ 3, %5 ], [ 2, %4 ], [ 1, %3 ], [ 0, %2 ]
%11 = tail call i32 @__builtin_s390_lcbb(i8* %0, i32 %10)
br label %12
12: ; preds = %2, %9
%13 = phi i32 [ %11, %9 ], [ 0, %2 ]
ret i32 %13
}