#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 dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ TCSANOW;
int /*<<< orphan*/ _main(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fileOpenOrDie(char *, char *);
int /*<<< orphan*/ fileSetBlocking(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fileno(int /*<<< orphan*/ *);
int /*<<< orphan*/ tcsetattr(int /*<<< orphan*/, int /*<<< orphan*/,
                             struct termios *);
int /*<<< orphan*/ termConfigRaw(int /*<<< orphan*/, struct termios *);
int main(int argc, char *argv[]) {
  FILE *f;
  struct termios saved;
  f = fileOpenOrDie("/dev/ttyT3S0", "r+");
  fileSetBlocking(fileno(f), 0);
  termConfigRaw(fileno(f), &saved);
  _main(f);
  tcsetattr(fileno(f), TCSANOW, &saved);
  fclose(f);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe80(%rip),%rsi
call   1090 <fileOpenOrDie@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <fileno@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1040 <fileSetBlocking@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fileno@plt>
mov    %eax,%edi
lea    -0x20(%rbp),%rsi
call   1050 <termConfigRaw@plt>
mov    -0x18(%rbp),%rdi
call   1080 <_main@plt>
mov    -0x18(%rbp),%rdi
call   1060 <fileno@plt>
mov    %eax,%edi
mov    0x2e11(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1070 <tcsetattr@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xe85(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1090 <fileOpenOrDie@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <fileno@plt>
mov    %eax,%edi
xor    %esi,%esi
call   1040 <fileSetBlocking@plt>
mov    %rbx,%rdi
call   1060 <fileno@plt>
mov    %rsp,%r14
mov    %eax,%edi
mov    %r14,%rsi
call   1050 <termConfigRaw@plt>
mov    %rbx,%rdi
call   1080 <_main@plt>
mov    %rbx,%rdi
call   1060 <fileno@plt>
mov    0x2e21(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
mov    %r14,%rdx
call   1070 <tcsetattr@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
@.str = [13 x i8] c"/dev/ttyT3S0\00"
@.str.1 = [3 x i8] c"r+\00"
@TCSANOW = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca %struct.termios
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = call i32* @fileOpenOrDie(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = call i32 @fileno(i32* %8)
%10 = call i32 @fileSetBlocking(i32 %9, i32 0)
%11 = load i32*, i32** %5
%12 = call i32 @fileno(i32* %11)
%13 = call i32 @termConfigRaw(i32 %12, %struct.termios* %6)
%14 = load i32*, i32** %5
%15 = call i32 @_main(i32* %14)
%16 = load i32*, i32** %5
%17 = call i32 @fileno(i32* %16)
%18 = load i32, i32* @TCSANOW
%19 = call i32 @tcsetattr(i32 %17, i32 %18, %struct.termios* %6)
%20 = load i32*, i32** %5
%21 = call i32 @fclose(i32* %20)
ret i32 0
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@.str = [13 x i8] c"/dev/ttyT3S0\00"
@.str.1 = [3 x i8] c"r+\00"
@TCSANOW = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.termios
%4 = bitcast %struct.termios* %3 to i8*
%5 = tail call i32* @fileOpenOrDie(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @fileno(i32* %5)
%7 = tail call i32 @fileSetBlocking(i32 %6, i32 0)
%8 = tail call i32 @fileno(i32* %5)
%9 = call i32 @termConfigRaw(i32 %8, %struct.termios* %3)
%10 = call i32 @_main(i32* %5)
%11 = call i32 @fileno(i32* %5)
%12 = load i32, i32* @TCSANOW
%13 = call i32 @tcsetattr(i32 %11, i32 %12, %struct.termios* %3)
%14 = call i32 @fclose(i32* %5)
ret i32 0
}