#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 tl880_dev {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ tl880_read_register(struct tl880_dev *, int);
int /*<<< orphan*/ tl880_set_dpc_clock(struct tl880_dev *, int, int,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ tl880_write_register(struct tl880_dev *, int, int);
void tl880_init_dpc_pll(struct tl880_dev *tl880dev) {
  int i;
  tl880_write_register(tl880dev, 0x10014, 0x80000000);
  tl880_set_dpc_clock(tl880dev, 1024, 768, 0);
  for (i = 0; i < 10; i++) {
    tl880_read_register(tl880dev, 0x10014);
  }
  tl880_write_register(tl880dev, 0x10014, 0);
}


x86 assembly (clang, -O0):
<tl880_init_dpc_pll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x10014,%esi
mov    $0x80000000,%edx
call   1040 <tl880_write_register@plt>
mov    -0x8(%rbp),%rdi
mov    $0x400,%esi
mov    $0x300,%edx
xor    %ecx,%ecx
call   1050 <tl880_set_dpc_clock@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1191 <tl880_init_dpc_pll+0x61>
mov    -0x8(%rbp),%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116b <tl880_init_dpc_pll+0x3b>
mov    -0x8(%rbp),%rdi
mov    $0x10014,%esi
xor    %edx,%edx
call   1040 <tl880_write_register@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tl880_init_dpc_pll>:
push   %rbx
mov    %rdi,%rbx
mov    $0x10014,%esi
mov    $0x80000000,%edx
call   1040 <tl880_write_register@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    $0x300,%edx
xor    %ecx,%ecx
call   1050 <tl880_set_dpc_clock@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
call   1030 <tl880_read_register@plt>
mov    %rbx,%rdi
mov    $0x10014,%esi
xor    %edx,%edx
pop    %rbx
jmp    1040 <tl880_write_register@plt>

LLVM IR (-O0):
%struct.tl880_dev = type { i32 }
define void @tl880_init_dpc_pll(%struct.tl880_dev* %0) {
%2 = alloca %struct.tl880_dev*
%3 = alloca i32
store %struct.tl880_dev* %0, %struct.tl880_dev** %2
%4 = load %struct.tl880_dev*, %struct.tl880_dev** %2
%5 = call i32 @tl880_write_register(%struct.tl880_dev* %4, i32 65556, i32 -2147483648)
%6 = load %struct.tl880_dev*, %struct.tl880_dev** %2
%7 = call i32 @tl880_set_dpc_clock(%struct.tl880_dev* %6, i32 1024, i32 768, i32 0)
store i32 0, i32* %3
br label %8
8: ; preds = %14, %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %9, 10
br i1 %10, label %11, label %17
11: ; preds = %8
%12 = load %struct.tl880_dev*, %struct.tl880_dev** %2
%13 = call i32 @tl880_read_register(%struct.tl880_dev* %12, i32 65556)
br label %14
14: ; preds = %11
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %8
17: ; preds = %8
%18 = load %struct.tl880_dev*, %struct.tl880_dev** %2
%19 = call i32 @tl880_write_register(%struct.tl880_dev* %18, i32 65556, i32 0)
ret void
}

LLVM IR (-O2):
%struct.tl880_dev = type { i32 }
define void @tl880_init_dpc_pll(%struct.tl880_dev* %0) {
%2 = tail call i32 @tl880_write_register(%struct.tl880_dev* %0, i32 65556, i32 -2147483648)
%3 = tail call i32 @tl880_set_dpc_clock(%struct.tl880_dev* %0, i32 1024, i32 768, i32 0)
%4 = tail call i32 @tl880_read_register(%struct.tl880_dev* %0, i32 65556)
%5 = tail call i32 @tl880_read_register(%struct.tl880_dev* %0, i32 65556)
%6 = tail call i32 @tl880_read_register(%struct.tl880_dev* %0, i32 65556)
%7 = tail call i32 @tl880_read_register(%struct.tl880_dev* %0, i32 65556)
%8 = tail call i32 @tl880_read_register(%struct.tl880_dev* %0, i32 65556)
%9 = tail call i32 @tl880_read_register(%struct.tl880_dev* %0, i32 65556)
%10 = tail call i32 @tl880_read_register(%struct.tl880_dev* %0, i32 65556)
%11 = tail call i32 @tl880_read_register(%struct.tl880_dev* %0, i32 65556)
%12 = tail call i32 @tl880_read_register(%struct.tl880_dev* %0, i32 65556)
%13 = tail call i32 @tl880_read_register(%struct.tl880_dev* %0, i32 65556)
%14 = tail call i32 @tl880_write_register(%struct.tl880_dev* %0, i32 65556, i32 0)
ret void
}