#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 IXON;
unsigned char Termios2TncomOutFlow(struct termios *ti) {
  if (ti->c_iflag & IXON)
    return ((unsigned char)2);
  if (ti->c_cflag & CRTSCTS)
    return ((unsigned char)3);
  return ((unsigned char)1);
}


x86 assembly (clang, -O0):
<Termios2TncomOutFlow>:
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 <Termios2TncomOutFlow+0x29>
movb   $0x2,-0x1(%rbp)
jmp    114f <Termios2TncomOutFlow+0x4f>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    0x2e99(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     114b <Termios2TncomOutFlow+0x4b>
movb   $0x3,-0x1(%rbp)
jmp    114f <Termios2TncomOutFlow+0x4f>
movb   $0x1,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.termios = type { i32, i32 }
@IXON = global i32 0
@CRTSCTS = global i32 0
define zeroext i8 @Termios2TncomOutFlow(%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* @IXON
%8 = and i32 %6, %7
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i8 2, 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 3, i8* %2
br label %20
19: ; preds = %11
store i8 1, 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 }
@IXON = global i32 0
@CRTSCTS = global i32 0
define zeroext i8 @Termios2TncomOutFlow(%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* @IXON
%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 1, i8 3
br label %14
14: ; preds = %7, %1
%15 = phi i8 [ 2, %1 ], [ %13, %7 ]
ret i8 %15
}