#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 int tcflag_t;
struct termios {
  int c_cflag;
};

/* Variables and functions */
#define CS5 131
#define CS6 130
#define CS7 129
#define CS8 128
int CSIZE;
unsigned char Termios2TncomDataSize(struct termios *ti) {
  tcflag_t DataSize;
  DataSize = ti->c_cflag & CSIZE;
  switch (DataSize) {
  case CS5:
    return ((unsigned char)5);
  case CS6:
    return ((unsigned char)6);
  case CS7:
    return ((unsigned char)7);
  case CS8:
    return ((unsigned char)8);
  default:
    return ((unsigned char)0);
  }
}


x86 assembly (clang, -O0):
<Termios2TncomDataSize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2ed3(%rip),%rcx
mov    (%rcx),%ecx
and    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     1169 <Termios2TncomDataSize+0x69>
mov    -0x20(%rbp),%rax
lea    0xec4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x5,-0x1(%rbp)
jmp    116d <Termios2TncomDataSize+0x6d>
movb   $0x6,-0x1(%rbp)
jmp    116d <Termios2TncomDataSize+0x6d>
movb   $0x7,-0x1(%rbp)
jmp    116d <Termios2TncomDataSize+0x6d>
movb   $0x8,-0x1(%rbp)
jmp    116d <Termios2TncomDataSize+0x6d>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Termios2TncomDataSize>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
and    (%rdi),%eax
add    $0xffffff80,%eax
mov    $0x8,%cl
sub    %al,%cl
xor    %edx,%edx
cmp    $0x4,%eax
movzbl %cl,%eax
cmovae %edx,%eax
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@CSIZE = global i32 0
define zeroext i8 @Termios2TncomDataSize(%struct.termios* %0) {
%2 = alloca i8
%3 = alloca %struct.termios*
%4 = alloca i32
store %struct.termios* %0, %struct.termios** %3
%5 = load %struct.termios*, %struct.termios** %3
%6 = getelementptr inbounds %struct.termios, %struct.termios* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = load i32, i32* @CSIZE
%9 = and i32 %7, %8
store i32 %9, i32* %4
%10 = load i32, i32* %4
switch i32 %10, label %15 [
i32 131, label %11
i32 130, label %12
i32 129, label %13
i32 128, label %14
]
11: ; preds = %1
store i8 5, i8* %2
br label %16
12: ; preds = %1
store i8 6, i8* %2
br label %16
13: ; preds = %1
store i8 7, i8* %2
br label %16
14: ; preds = %1
store i8 8, i8* %2
br label %16
15: ; preds = %1
store i8 0, i8* %2
br label %16
16: ; preds = %15, %14, %13, %12, %11
%17 = load i8, i8* %2
ret i8 %17
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@CSIZE = global i32 0
define zeroext i8 @Termios2TncomDataSize(%struct.termios* nocapture %0) {
%2 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = load i32, i32* @CSIZE
%5 = and i32 %4, %3
%6 = add i32 %5, -128
%7 = icmp ult i32 %6, 4
%8 = trunc i32 %6 to i8
%9 = sub i8 8, %8
%10 = select i1 %7, i8 %9, i8 0
ret i8 %10
}