#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 in(int);
int /*<<< orphan*/ out(int, int);
void int_remap(int offset1, int offset2) {
  int a1 = in(0x21);
  int a2 = in(0xA1);
  out(0x20, 0x10 + 0x01);
  out(0xA0, 0x10 + 0x01);
  out(0x21, offset1);
  out(0xA1, offset2);
  out(0x21, 0x04);
  out(0xA1, 0x02);
  out(0x21, 0x01);
  out(0xA1, 0x01);
  out(0x21, a1);
  out(0xA1, a2);
}


x86 assembly (clang, -O0):
<int_remap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x21,%edi
call   1040 <in@plt>
mov    %eax,-0xc(%rbp)
mov    $0xa1,%edi
call   1040 <in@plt>
mov    %eax,-0x10(%rbp)
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <out@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <out@plt>
mov    -0x4(%rbp),%esi
mov    $0x21,%edi
call   1030 <out@plt>
mov    -0x8(%rbp),%esi
mov    $0xa1,%edi
call   1030 <out@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <out@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <out@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <out@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <out@plt>
mov    -0xc(%rbp),%esi
mov    $0x21,%edi
call   1030 <out@plt>
mov    -0x10(%rbp),%esi
mov    $0xa1,%edi
call   1030 <out@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_remap>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x21,%edi
call   1040 <in@plt>
mov    %eax,%r14d
mov    $0xa1,%edi
call   1040 <in@plt>
mov    %eax,%r15d
mov    $0x20,%edi
mov    $0x11,%esi
call   1030 <out@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1030 <out@plt>
mov    $0x21,%edi
mov    %ebp,%esi
call   1030 <out@plt>
mov    $0xa1,%edi
mov    %ebx,%esi
call   1030 <out@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1030 <out@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1030 <out@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1030 <out@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1030 <out@plt>
mov    $0x21,%edi
mov    %r14d,%esi
call   1030 <out@plt>
mov    $0xa1,%edi
mov    %r15d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <out@plt>

LLVM IR (-O0):
define void @int_remap(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = call i32 @in(i32 33)
store i32 %7, i32* %5
%8 = call i32 @in(i32 161)
store i32 %8, i32* %6
%9 = call i32 @out(i32 32, i32 17)
%10 = call i32 @out(i32 160, i32 17)
%11 = load i32, i32* %3
%12 = call i32 @out(i32 33, i32 %11)
%13 = load i32, i32* %4
%14 = call i32 @out(i32 161, i32 %13)
%15 = call i32 @out(i32 33, i32 4)
%16 = call i32 @out(i32 161, i32 2)
%17 = call i32 @out(i32 33, i32 1)
%18 = call i32 @out(i32 161, i32 1)
%19 = load i32, i32* %5
%20 = call i32 @out(i32 33, i32 %19)
%21 = load i32, i32* %6
%22 = call i32 @out(i32 161, i32 %21)
ret void
}

LLVM IR (-O2):
define void @int_remap(i32 %0, i32 %1) {
%3 = tail call i32 @in(i32 33)
%4 = tail call i32 @in(i32 161)
%5 = tail call i32 @out(i32 32, i32 17)
%6 = tail call i32 @out(i32 160, i32 17)
%7 = tail call i32 @out(i32 33, i32 %0)
%8 = tail call i32 @out(i32 161, i32 %1)
%9 = tail call i32 @out(i32 33, i32 4)
%10 = tail call i32 @out(i32 161, i32 2)
%11 = tail call i32 @out(i32 33, i32 1)
%12 = tail call i32 @out(i32 161, i32 1)
%13 = tail call i32 @out(i32 33, i32 %3)
%14 = tail call i32 @out(i32 161, i32 %4)
ret void
}