#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 getval(int);
int ioperm(int, int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int res, a, b;
  res = ioperm(0x70, 0x04, 1);
  printf("res =%d \n", res);
  printf(" year= %x \n", getval(9));
  printf(" month = %x \n", getval(8));
  printf(" day = %x \n", getval(7));
  printf(" hours = %x \n", getval(4));
  printf(" minutes = %x \n", getval(2));
  printf(" seconds = %x \n", getval(0));
  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    0xea0(%rip),%rdi
call   1040 <printf@plt>
mov    $0x9,%edi
call   1030 <getval@plt>
mov    %eax,%esi
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
mov    $0x8,%edi
call   1030 <getval@plt>
mov    %eax,%esi
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
mov    $0x7,%edi
call   1030 <getval@plt>
mov    %eax,%esi
lea    0xe7c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1030 <getval@plt>
mov    %eax,%esi
lea    0xe70(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1030 <getval@plt>
mov    %eax,%esi
lea    0xe66(%rip),%rdi
call   1040 <printf@plt>
xor    %edi,%edi
call   1030 <getval@plt>
mov    %eax,%esi
lea    0xe61(%rip),%rdi
call   1040 <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    0xeb4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x9,%edi
call   1030 <getval@plt>
lea    0xea6(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x8,%edi
call   1030 <getval@plt>
lea    0xe9a(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x7,%edi
call   1030 <getval@plt>
lea    0xe90(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x4,%edi
call   1030 <getval@plt>
lea    0xe84(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x2,%edi
call   1030 <getval@plt>
lea    0xe7a(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %edi,%edi
call   1030 <getval@plt>
lea    0xe75(%rip),%rdi
mov    %eax,%esi
call   1040 <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"
@.str.4 = [14 x i8] c" hours = %x \0A\00"
@.str.5 = [16 x i8] c" minutes = %x \0A\00"
@.str.6 = [16 x i8] c" seconds = %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 @getval(i32 9)
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 @getval(i32 8)
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = call i32 @getval(i32 7)
%13 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = call i32 @getval(i32 4)
%15 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %14)
%16 = call i32 @getval(i32 2)
%17 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %16)
%18 = call i32 @getval(i32 0)
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %18)
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"
@.str.4 = [14 x i8] c" hours = %x \0A\00"
@.str.5 = [16 x i8] c" minutes = %x \0A\00"
@.str.6 = [16 x i8] c" seconds = %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 @getval(i32 9)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @getval(i32 8)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @getval(i32 7)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @getval(i32 4)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = tail call i32 @getval(i32 2)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i32 %11)
%13 = tail call i32 @getval(i32 0)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i32 %13)
ret i32 0
}