#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 /*<<< orphan*/ drv_L7_page(int);
int /*<<< orphan*/ drv_L7_write_ctrl(int);
int /*<<< orphan*/ drv_L7_write_data(int);
void drv_L7_put(int col, int val) {
  static int cc = -1;
  drv_L7_page(8);
  if (col != cc) {
    cc = col;
    drv_L7_write_ctrl(0x00 | (cc & 0x0f));
    drv_L7_write_ctrl(0x10 | (cc >> 4));
  }
  drv_L7_write_data(val);
  cc++;
}


x86 assembly (clang, -O0):
<drv_L7_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x8,%edi
call   1040 <drv_L7_page@plt>
mov    -0x4(%rbp),%eax
cmp    0x2ee7(%rip),%eax
je     1182 <drv_L7_put+0x52>
mov    -0x4(%rbp),%eax
mov    %eax,0x2ed8(%rip)
mov    0x2ed2(%rip),%edi
and    $0xf,%edi
or     $0x0,%edi
call   1030 <drv_L7_write_ctrl@plt>
mov    0x2ec1(%rip),%edi
sar    $0x4,%edi
or     $0x10,%edi
call   1030 <drv_L7_write_ctrl@plt>
mov    -0x8(%rbp),%edi
call   1050 <drv_L7_write_data@plt>
mov    0x2ea8(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e9f(%rip)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drv_L7_put>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x8,%edi
call   1040 <drv_L7_page@plt>
cmp    %ebp,0x2ef1(%rip)
je     116a <drv_L7_put+0x3a>
mov    %ebp,0x2ee9(%rip)
and    $0xf,%ebp
mov    %ebp,%edi
call   1030 <drv_L7_write_ctrl@plt>
mov    0x2ed9(%rip),%edi
sar    $0x4,%edi
or     $0x10,%edi
call   1030 <drv_L7_write_ctrl@plt>
mov    %ebx,%edi
call   1050 <drv_L7_write_data@plt>
addl   $0x1,0x2ec0(%rip)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@drv_L7_put.cc = internal global i32 -1
define void @drv_L7_put(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @drv_L7_page(i32 8)
%6 = load i32, i32* %3
%7 = load i32, i32* @drv_L7_put.cc
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load i32, i32* %3
store i32 %10, i32* @drv_L7_put.cc
%11 = load i32, i32* @drv_L7_put.cc
%12 = and i32 %11, 15
%13 = or i32 0, %12
%14 = call i32 @drv_L7_write_ctrl(i32 %13)
%15 = load i32, i32* @drv_L7_put.cc
%16 = ashr i32 %15, 4
%17 = or i32 16, %16
%18 = call i32 @drv_L7_write_ctrl(i32 %17)
br label %19
19: ; preds = %9, %2
%20 = load i32, i32* %4
%21 = call i32 @drv_L7_write_data(i32 %20)
%22 = load i32, i32* @drv_L7_put.cc
%23 = add nsw i32 %22, 1
store i32 %23, i32* @drv_L7_put.cc
ret void
}

LLVM IR (-O2):
@drv_L7_put.cc = internal unnamed_addr global i32 -1
define void @drv_L7_put(i32 %0, i32 %1) {
%3 = tail call i32 @drv_L7_page(i32 8)
%4 = load i32, i32* @drv_L7_put.cc
%5 = icmp eq i32 %4, %0
br i1 %5, label %13, label %6
6: ; preds = %2
store i32 %0, i32* @drv_L7_put.cc
%7 = and i32 %0, 15
%8 = tail call i32 @drv_L7_write_ctrl(i32 %7)
%9 = load i32, i32* @drv_L7_put.cc
%10 = ashr i32 %9, 4
%11 = or i32 %10, 16
%12 = tail call i32 @drv_L7_write_ctrl(i32 %11)
br label %13
13: ; preds = %6, %2
%14 = tail call i32 @drv_L7_write_data(i32 %1)
%15 = load i32, i32* @drv_L7_put.cc
%16 = add nsw i32 %15, 1
store i32 %16, i32* @drv_L7_put.cc
ret void
}