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

/* Variables and functions */
int CRTSCTS;
int IXOFF;
unsigned char Termios2TncomInFlow(struct termios *ti) {
  if (ti->c_iflag & IXOFF)
    return ((unsigned char)15);
  if (ti->c_cflag & CRTSCTS)
    return ((unsigned char)16);
  return ((unsigned char)14);
}


x86 assembly (clang, -O0):
<Termios2TncomInFlow>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    0x2ed3(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1129 <Termios2TncomInFlow+0x29>
movb   $0xf,-0x1(%rbp)
jmp    114f <Termios2TncomInFlow+0x4f>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    0x2e99(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     114b <Termios2TncomInFlow+0x4b>
movb   $0x10,-0x1(%rbp)
jmp    114f <Termios2TncomInFlow+0x4f>
movb   $0xe,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Termios2TncomInFlow>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%ecx
mov    $0xf,%al
test   %ecx,(%rdi)
je     1110 <Termios2TncomInFlow+0x10>
ret
mov    0x2eb9(%rip),%rax
mov    (%rax),%eax
test   %eax,0x4(%rdi)
setne  %al
add    %al,%al
add    $0xe,%al
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32 }
@IXOFF = global i32 0
@CRTSCTS = global i32 0
define zeroext i8 @Termios2TncomInFlow(%struct.termios* %0) {
%2 = alloca i8
%3 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %3
%4 = load %struct.termios*, %struct.termios** %3
%5 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 0
%6 = load i32, i32* %5
%7 = load i32, i32* @IXOFF
%8 = and i32 %6, %7
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i8 15, i8* %2
br label %20
11: ; preds = %1
%12 = load %struct.termios*, %struct.termios** %3
%13 = getelementptr inbounds %struct.termios, %struct.termios* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = load i32, i32* @CRTSCTS
%16 = and i32 %14, %15
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %11
store i8 16, i8* %2
br label %20
19: ; preds = %11
store i8 14, i8* %2
br label %20
20: ; preds = %19, %18, %10
%21 = load i8, i8* %2
ret i8 %21
}

LLVM IR (-O2):
%struct.termios = type { i32, i32 }
@IXOFF = global i32 0
@CRTSCTS = global i32 0
define zeroext i8 @Termios2TncomInFlow(%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* @IXOFF
%5 = and i32 %4, %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 1
%9 = load i32, i32* %8
%10 = load i32, i32* @CRTSCTS
%11 = and i32 %10, %9
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i8 14, i8 16
br label %14
14: ; preds = %7, %1
%15 = phi i8 [ 15, %1 ], [ %13, %7 ]
ret i8 %15
}