#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 */

/* Variables and functions */
int inb(int);
int ioperm(int, int, int);
int /*<<< orphan*/ outb(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int res, a, b;
  res = ioperm(0x70, 0x04, 1);
  printf("res =%d \n", res);
  outb(0x09, 0x70);
  printf(" year= %x \n", inb(0x71));
  outb(0x08, 0x70);
  printf(" month = %x \n", inb(0x71));
  outb(0x07, 0x70);
  printf(" day = %x \n", inb(0x71));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x70,%edi
mov    $0x4,%esi
mov    $0x1,%edx
call   1050 <ioperm@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
mov    $0x9,%edi
mov    $0x70,%esi
call   1040 <outb@plt>
mov    $0x71,%edi
call   1060 <inb@plt>
mov    %eax,%esi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    $0x8,%edi
mov    $0x70,%esi
call   1040 <outb@plt>
mov    $0x71,%edi
call   1060 <inb@plt>
mov    %eax,%esi
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
mov    $0x7,%edi
mov    $0x70,%esi
call   1040 <outb@plt>
mov    $0x71,%edi
call   1060 <inb@plt>
mov    %eax,%esi
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x70,%edi
mov    $0x4,%esi
mov    $0x1,%edx
call   1050 <ioperm@plt>
lea    0xea4(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x9,%edi
mov    $0x70,%esi
call   1040 <outb@plt>
mov    $0x71,%edi
call   1060 <inb@plt>
lea    0xe87(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x8,%edi
mov    $0x70,%esi
call   1040 <outb@plt>
mov    $0x71,%edi
call   1060 <inb@plt>
lea    0xe6c(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x7,%edi
mov    $0x70,%esi
call   1040 <outb@plt>
mov    $0x71,%edi
call   1060 <inb@plt>
lea    0xe53(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"res =%d \0A\00"
@.str.1 = [12 x i8] c" year= %x \0A\00"
@.str.2 = [14 x i8] c" month = %x \0A\00"
@.str.3 = [12 x i8] c" day = %x \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @ioperm(i32 112, i32 4, i32 1)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @outb(i32 9, i32 112)
%9 = call i32 @inb(i32 113)
%10 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = call i32 @outb(i32 8, i32 112)
%12 = call i32 @inb(i32 113)
%13 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = call i32 @outb(i32 7, i32 112)
%15 = call i32 @inb(i32 113)
%16 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"res =%d \0A\00"
@.str.1 = [12 x i8] c" year= %x \0A\00"
@.str.2 = [14 x i8] c" month = %x \0A\00"
@.str.3 = [12 x i8] c" day = %x \0A\00"
define i32 @main() {
%1 = tail call i32 @ioperm(i32 112, i32 4, i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @outb(i32 9, i32 112)
%4 = tail call i32 @inb(i32 113)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = tail call i32 @outb(i32 8, i32 112)
%7 = tail call i32 @inb(i32 113)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = tail call i32 @outb(i32 7, i32 112)
%10 = tail call i32 @inb(i32 113)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %10)
ret i32 0
}