#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 {
  scalar_t__ *c_cc;
  scalar_t__ c_lflag;
  scalar_t__ c_cflag;
  scalar_t__ c_oflag;
  scalar_t__ c_iflag;
};

/* Variables and functions */
int NCCS;
int /*<<< orphan*/ printf(char *, unsigned int, ...);
int /*<<< orphan*/ putchar(char);
void display_recoverable(struct termios *mode) {
  int i;
  printf("%lx:%lx:%lx:%lx", (unsigned long)mode->c_iflag,
         (unsigned long)mode->c_oflag, (unsigned long)mode->c_cflag,
         (unsigned long)mode->c_lflag);
  for (i = 0; i < NCCS; ++i)
    printf(":%x", (unsigned int)mode->c_cc[i]);
  putchar('\n');
}


x86 assembly (clang, -O0):
<display_recoverable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%rax
mov    %eax,%esi
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdx
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rcx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%r8
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%eax
jge    11a2 <display_recoverable+0x82>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %eax,%esi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <display_recoverable+0x43>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_recoverable>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
mov    0x20(%rdi),%esi
mov    0x18(%rdi),%rdx
mov    0x8(%rdi),%r8
mov    0x10(%rdi),%rcx
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2ea1(%rip),%r15
cmpl   $0x0,(%r15)
jle    117d <display_recoverable+0x5d>
lea    0xeb4(%rip),%r14
xor    %ebx,%ebx
xchg   %ax,%ax
mov    (%r12),%rax
mov    (%rax,%rbx,8),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq (%r15),%rax
cmp    %rax,%rbx
jl     1160 <display_recoverable+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%struct.termios = type { i64*, i64, i64, i64, i64 }
@.str = [16 x i8] c"%lx:%lx:%lx:%lx\00"
@NCCS = global i32 0
@.str.1 = [4 x i8] c":%x\00"
define void @display_recoverable(%struct.termios* %0) {
%2 = alloca %struct.termios*
%3 = alloca i32
store %struct.termios* %0, %struct.termios** %2
%4 = load %struct.termios*, %struct.termios** %2
%5 = getelementptr inbounds %struct.termios, %struct.termios* %4, i32 0, i32 4
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = load %struct.termios*, %struct.termios** %2
%9 = getelementptr inbounds %struct.termios, %struct.termios* %8, i32 0, i32 3
%10 = load i64, i64* %9
%11 = load %struct.termios*, %struct.termios** %2
%12 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 2
%13 = load i64, i64* %12
%14 = load %struct.termios*, %struct.termios** %2
%15 = getelementptr inbounds %struct.termios, %struct.termios* %14, i32 0, i32 1
%16 = load i64, i64* %15
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7, i64 %10, i64 %13, i64 %16)
store i32 0, i32* %3
br label %18
18: ; preds = %32, %1
%19 = load i32, i32* %3
%20 = load i32, i32* @NCCS
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %35
22: ; preds = %18
%23 = load %struct.termios*, %struct.termios** %2
%24 = getelementptr inbounds %struct.termios, %struct.termios* %23, i32 0, i32 0
%25 = load i64*, i64** %24
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i64, i64* %25, i64 %27
%29 = load i64, i64* %28
%30 = trunc i64 %29 to i32
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %22
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %18
35: ; preds = %18
%36 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
%struct.termios = type { i64*, i64, i64, i64, i64 }
@.str = [16 x i8] c"%lx:%lx:%lx:%lx\00"
@NCCS = global i32 0
@.str.1 = [4 x i8] c":%x\00"
define void @display_recoverable(%struct.termios* nocapture %0) {
%2 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 4
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 3
%6 = load i64, i64* %5
%7 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 2
%8 = load i64, i64* %7
%9 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 1
%10 = load i64, i64* %9
%11 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %4, i64 %6, i64 %8, i64 %10)
%12 = load i32, i32* @NCCS
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %27
14: ; preds = %1
%15 = getelementptr inbounds %struct.termios, %struct.termios* %0, i64 0, i32 0
br label %16
16: ; preds = %14, %16
%17 = phi i64 [ 0, %14 ], [ %23, %16 ]
%18 = load i64*, i64** %15
%19 = getelementptr inbounds i64, i64* %18, i64 %17
%20 = load i64, i64* %19
%21 = trunc i64 %20 to i32
%22 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = add nuw nsw i64 %17, 1
%24 = load i32, i32* @NCCS
%25 = sext i32 %24 to i64
%26 = icmp slt i64 %23, %25
br i1 %26, label %16, label %27
27: ; preds = %16, %1
%28 = tail call i32 @putchar(i8 signext 10)
ret void
}