#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 /*<<< orphan*/ c_cc;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ cfgetospeed(struct termios *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ print_baud(int /*<<< orphan*/);
int /*<<< orphan*/ print_characters(int /*<<< orphan*/);
int /*<<< orphan*/ print_flags(struct termios *);
int /*<<< orphan*/ putchar(char);
void print_settings(struct termios *ttyp) {
  print_baud(cfgetospeed(ttyp));
  putchar('\n');
  print_characters(ttyp->c_cc);
  putchar('\n');
  print_flags(ttyp);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<print_settings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <cfgetospeed@plt>
mov    %eax,%edi
call   1040 <print_baud@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1050 <print_characters@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rdi
call   1060 <print_flags@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<print_settings>:
push   %rbx
mov    %rdi,%rbx
call   1070 <cfgetospeed@plt>
mov    %eax,%edi
call   1040 <print_baud@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    (%rbx),%edi
call   1050 <print_characters@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <print_flags@plt>
mov    0x2e46(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
%struct.termios = type { i32 }
@EXIT_SUCCESS = global i32 0
define void @print_settings(%struct.termios* %0) {
%2 = alloca %struct.termios*
store %struct.termios* %0, %struct.termios** %2
%3 = load %struct.termios*, %struct.termios** %2
%4 = call i32 @cfgetospeed(%struct.termios* %3)
%5 = call i32 @print_baud(i32 %4)
%6 = call i32 @putchar(i8 signext 10)
%7 = load %struct.termios*, %struct.termios** %2
%8 = getelementptr inbounds %struct.termios, %struct.termios* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @print_characters(i32 %9)
%11 = call i32 @putchar(i8 signext 10)
%12 = load %struct.termios*, %struct.termios** %2
%13 = call i32 @print_flags(%struct.termios* %12)
%14 = load i32, i32* @EXIT_SUCCESS
%15 = call i32 @exit(i32 %14)
unreachable
}

LLVM IR (-O2):
%struct.termios = type { i32 }
@EXIT_SUCCESS = global i32 0
define void @print_settings(%struct.termios* %0) {
%2 = tail call i32 @cfgetospeed(%struct.termios* %0)
%3 = tail call i32 @print_baud(i32 %2)
%4 = tail call i32 @putchar(i8 signext 10)
%5 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
%6 = load i32, i32* %5
%7 = tail call i32 @print_characters(i32 %6)
%8 = tail call i32 @putchar(i8 signext 10)
%9 = tail call i32 @print_flags(%struct.termios* %0)
%10 = load i32, i32* @EXIT_SUCCESS
%11 = tail call i32 @exit(i32 %10)
unreachable
}