#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*/ dumpT2chan(int);
int /*<<< orphan*/ dumpT2ctl();
int /*<<< orphan*/ printf(char *, ...);
int dumpT2(void) {
  int i;
  printf("T2 Controller Registers:\n");
  dumpT2ctl();
  for (i = 1; i <= 4; i++) {
    printf("T2 Channel %d\n", i);
    dumpT2chan(i);
  }
  return (0);
}


x86 assembly (clang, -O0):
<dumpT2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <dumpT2ctl@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jg     1185 <dumpT2+0x55>
mov    -0x4(%rbp),%esi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <dumpT2chan@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1154 <dumpT2+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpT2>:
push   %rbx
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <dumpT2ctl@plt>
lea    0xea5(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <dumpT2chan@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
call   1060 <dumpT2chan@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x3,%edi
call   1060 <dumpT2chan@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x4,%edi
call   1060 <dumpT2chan@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"T2 Controller Registers:\0A\00"
@.str.1 = [15 x i8] c"T2 Channel %d\0A\00"
define i32 @dumpT2() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @dumpT2ctl()
store i32 1, i32* %1
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %1
%6 = icmp sle i32 %5, 4
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %1
%11 = call i32 @dumpT2chan(i32 %10)
br label %12
12: ; preds = %7
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %4
15: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"T2 Channel %d\0A\00"
@str = [25 x i8] c"T2 Controller Registers:\00"
define i32 @dumpT2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @dumpT2ctl()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 1)
%4 = tail call i32 @dumpT2chan(i32 1)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 2)
%6 = tail call i32 @dumpT2chan(i32 2)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 3)
%8 = tail call i32 @dumpT2chan(i32 3)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 4)
%10 = tail call i32 @dumpT2chan(i32 4)
ret i32 0
}