#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_oflag;
  int c_cflag;
  int c_lflag;
};
typedef int /*<<< orphan*/ config;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printTermistruct(struct termios config) {
  printf("size of config: %lu\n", sizeof(config));
  printf("config->c_iflag: %u\n", config.c_iflag);
  printf("config->c_oflag: %u\n", config.c_oflag);
  printf("config->c_cflag: %u\n", config.c_cflag);
  printf("config->c_lflag: %u\n", config.c_lflag);
}


x86 assembly (clang, -O0):
<printTermistruct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x8(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xeec(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTermistruct>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdi,%rbx
shr    $0x20,%rbx
mov    %rsi,%r12
shr    $0x20,%r12
lea    0xecd(%rip),%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    %r12d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.termios = type { i32, i32, i32, i32 }
@.str = [21 x i8] c"size of config: %lu\0A\00"
@.str.1 = [21 x i8] c"config->c_iflag: %u\0A\00"
@.str.2 = [21 x i8] c"config->c_oflag: %u\0A\00"
@.str.3 = [21 x i8] c"config->c_cflag: %u\0A\00"
@.str.4 = [21 x i8] c"config->c_lflag: %u\0A\00"
define void @printTermistruct(i64 %0, i64 %1) {
%3 = alloca %struct.termios
%4 = bitcast %struct.termios* %3 to { i64, i64 }*
%5 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %4, i32 0, i32 0
store i64 %0, i64* %5
%6 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %4, i32 0, i32 1
store i64 %1, i64* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 16)
%8 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 1
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 2
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds %struct.termios, %struct.termios* %3, i32 0, i32 3
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %18)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"size of config: %lu\0A\00"
@.str.1 = [21 x i8] c"config->c_iflag: %u\0A\00"
@.str.2 = [21 x i8] c"config->c_oflag: %u\0A\00"
@.str.3 = [21 x i8] c"config->c_cflag: %u\0A\00"
@.str.4 = [21 x i8] c"config->c_lflag: %u\0A\00"
define void @printTermistruct(i64 %0, i64 %1) {
%3 = trunc i64 %0 to i32
%4 = lshr i64 %0, 32
%5 = trunc i64 %4 to i32
%6 = trunc i64 %1 to i32
%7 = lshr i64 %1, 32
%8 = trunc i64 %7 to i32
%9 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 16)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i32 %8)
ret void
}