#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 */
typedef int uint8_t;
typedef scalar_t__ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ MMIread(scalar_t__);
scalar_t__ get_PHY_base(int);
int /*<<< orphan*/ printf(char *, ...);
uint8_t printentry() {
  uint8_t i = 0;
  uint64_t baseaddress = 0;
  printf("compiled: %s %s\n", "Mar 19 2022", "07:27:42");
  printf("C_MMI_ADDR_MAP_REVISION"
         ":0x%lx\n",
         7);
  printf("C_SUB_ADDR_COMMON_TN_MAJOR_REV"
         ":0x%lx\n",
         0x000);
  printf("C_SUB_ADDR_COMMON_TN_MINOR_REV"
         ":0x%lx\n",
         0x004);
  printf("C_SUB_ADDR_COMMON_USER_REV"
         ":0x%lx\n",
         0x008);
  printf("C_SUB_ADDR_COMMON_ADDR_MAP_REV"
         ":0x%lx\n",
         0x00C);
  printf("PHY0_base"
         ":0x%lx\n",
         (0x4000 << 8));
  for (i = 0; i < 12; i++) {
    baseaddress = get_PHY_base(i);
    printf("Interface:%i 6Treeprefix:AF%06lx%08lx bytecount_src:%i "
           "bytecount_dst:%i\n",
           i, MMIread(baseaddress + 0x34), MMIread(baseaddress + 0x30),
           MMIread(baseaddress + 0x38), MMIread(baseaddress + 0x3C));
  }
}


x86 assembly (clang, -O0):
<printentry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xeb2(%rip),%rdi
lea    0xebc(%rip),%rsi
lea    0xec1(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
mov    $0x7,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
xor    %esi,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
mov    $0xc,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
mov    $0x400000,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xc,-0x8(%rbp)
jge    125e <printentry+0x12e>
mov    -0x8(%rbp),%edi
call   1040 <get_PHY_base@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x34,%rdi
call   1050 <MMIread@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x30,%rdi
call   1050 <MMIread@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x38,%rdi
call   1050 <MMIread@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x3c,%rdi
call   1050 <MMIread@plt>
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    %eax,%r9d
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d9 <printentry+0xa9>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printentry>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
lea    0xec8(%rip),%rsi
lea    0xecd(%rip),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xefd(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
mov    $0xc,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1f(%rip),%rdi
mov    $0x400000,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1d(%rip),%r14
xor    %ebp,%ebp
nop
mov    %ebp,%edi
call   1040 <get_PHY_base@plt>
mov    %rax,%rbx
lea    0x34(%rax),%rdi
call   1050 <MMIread@plt>
mov    %eax,%r15d
lea    0x30(%rbx),%rdi
call   1050 <MMIread@plt>
mov    %eax,%r12d
lea    0x38(%rbx),%rdi
call   1050 <MMIread@plt>
mov    %eax,%r13d
add    $0x3c,%rbx
mov    %rbx,%rdi
call   1050 <MMIread@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    %r12d,%ecx
mov    %r13d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    $0xc,%ebp
jne    11d0 <printentry+0xa0>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"compiled: %s %s\0A\00"
@.str.1 = [12 x i8] c"Mar 19 2022\00"
@.str.2 = [9 x i8] c"07:27:42\00"
@.str.3 = [31 x i8] c"C_MMI_ADDR_MAP_REVISION:0x%lx\0A\00"
@.str.4 = [38 x i8] c"C_SUB_ADDR_COMMON_TN_MAJOR_REV:0x%lx\0A\00"
@.str.5 = [38 x i8] c"C_SUB_ADDR_COMMON_TN_MINOR_REV:0x%lx\0A\00"
@.str.6 = [34 x i8] c"C_SUB_ADDR_COMMON_USER_REV:0x%lx\0A\00"
@.str.7 = [38 x i8] c"C_SUB_ADDR_COMMON_ADDR_MAP_REV:0x%lx\0A\00"
@.str.8 = [17 x i8] c"PHY0_base:0x%lx\0A\00"
@.str.9 = [73 x i8] c"Interface:%i 6Treeprefix:AF%06lx%08lx bytecount_src:%i bytecount_dst:%i\0A\00"
define i32 @printentry() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i64
store i32 0, i32* %2
store i64 0, i64* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 7)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 0)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 4)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i32 8)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 12)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 4194304)
store i32 0, i32* %2
br label %11
11: ; preds = %31, %0
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 12
br i1 %13, label %14, label %34
14: ; preds = %11
%15 = load i32, i32* %2
%16 = call i64 @get_PHY_base(i32 %15)
store i64 %16, i64* %3
%17 = load i32, i32* %2
%18 = load i64, i64* %3
%19 = add nsw i64 %18, 52
%20 = call i32 @MMIread(i64 %19)
%21 = load i64, i64* %3
%22 = add nsw i64 %21, 48
%23 = call i32 @MMIread(i64 %22)
%24 = load i64, i64* %3
%25 = add nsw i64 %24, 56
%26 = call i32 @MMIread(i64 %25)
%27 = load i64, i64* %3
%28 = add nsw i64 %27, 60
%29 = call i32 @MMIread(i64 %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.9, i64 0, i64 0), i32 %17, i32 %20, i32 %23, i32 %26, i32 %29)
br label %31
31: ; preds = %14
%32 = load i32, i32* %2
%33 = add nsw i32 %32, 1
store i32 %33, i32* %2
br label %11
34: ; preds = %11
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [17 x i8] c"compiled: %s %s\0A\00"
@.str.1 = [12 x i8] c"Mar 19 2022\00"
@.str.2 = [9 x i8] c"07:27:42\00"
@.str.3 = [31 x i8] c"C_MMI_ADDR_MAP_REVISION:0x%lx\0A\00"
@.str.4 = [38 x i8] c"C_SUB_ADDR_COMMON_TN_MAJOR_REV:0x%lx\0A\00"
@.str.5 = [38 x i8] c"C_SUB_ADDR_COMMON_TN_MINOR_REV:0x%lx\0A\00"
@.str.6 = [34 x i8] c"C_SUB_ADDR_COMMON_USER_REV:0x%lx\0A\00"
@.str.7 = [38 x i8] c"C_SUB_ADDR_COMMON_ADDR_MAP_REV:0x%lx\0A\00"
@.str.8 = [17 x i8] c"PHY0_base:0x%lx\0A\00"
@.str.9 = [73 x i8] c"Interface:%i 6Treeprefix:AF%06lx%08lx bytecount_src:%i bytecount_dst:%i\0A\00"
define i32 @printentry() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 7)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i32 4)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i32 8)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 12)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0), i32 4194304)
br label %8
8: ; preds = %0, %8
%9 = phi i32 [ 0, %0 ], [ %20, %8 ]
%10 = tail call i64 @get_PHY_base(i32 %9)
%11 = add nsw i64 %10, 52
%12 = tail call i32 @MMIread(i64 %11)
%13 = add nsw i64 %10, 48
%14 = tail call i32 @MMIread(i64 %13)
%15 = add nsw i64 %10, 56
%16 = tail call i32 @MMIread(i64 %15)
%17 = add nsw i64 %10, 60
%18 = tail call i32 @MMIread(i64 %17)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str.9, i64 0, i64 0), i32 %9, i32 %12, i32 %14, i32 %16, i32 %18)
%20 = add nuw nsw i32 %9, 1
%21 = icmp eq i32 %20, 12
br i1 %21, label %22, label %8
22: ; preds = %8
ret i32 undef
}