#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*/ printf(char *, char *, unsigned int, unsigned int,
                          unsigned int, ...);
void report_partition(char name[16], unsigned int flash_offset,
                      unsigned int size) {
  unsigned int file_offset, flash_address, jtag_address;
  file_offset = flash_offset - 0x20000;
  flash_address = 0xBE000000 + flash_offset;
  jtag_address = flash_address & 0x1FFFFFFF;
  if (flash_offset >= 0x20000)
    printf("%12s \t%08X\t%08X\t%08X\t%08X\n", name, file_offset, flash_offset,
           jtag_address, size);
  else
    printf("%12s \t--------\t%08X\t%08X\t%08X\n", name, flash_offset,
           jtag_address, size);
}


x86 assembly (clang, -O0):
<report_partition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x20000,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0xbe000000,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
and    $0x1fffffff,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x20000,-0xc(%rbp)
jb     1175 <report_partition+0x65>
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x10(%rbp),%r9d
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1191 <report_partition+0x81>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_partition>:
mov    %edx,%r9d
mov    %esi,%ecx
mov    %rdi,%rsi
lea    0x1e000000(%rcx),%r8d
and    $0x1fffffff,%r8d
cmp    $0x20000,%ecx
jb     1142 <report_partition+0x32>
lea    -0x20000(%rcx),%edx
lea    0xec5(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xed2(%rip),%rdi
mov    %ecx,%edx
mov    %r8d,%ecx
mov    %r9d,%r8d
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"%12s \09%08X\09%08X\09%08X\09%08X\0A\00"
@.str.1 = [31 x i8] c"%12s \09--------\09%08X\09%08X\09%08X\0A\00"
define void @report_partition(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %5
%11 = sub i32 %10, 131072
store i32 %11, i32* %7
%12 = load i32, i32* %5
%13 = add i32 -1107296256, %12
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = and i32 %14, 536870911
store i32 %15, i32* %9
%16 = load i32, i32* %5
%17 = icmp uge i32 %16, 131072
br i1 %17, label %18, label %25
18: ; preds = %3
%19 = load i8*, i8** %4
%20 = load i32, i32* %7
%21 = load i32, i32* %5
%22 = load i32, i32* %9
%23 = load i32, i32* %6
%24 = call i32 (i8*, i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %19, i32 %20, i32 %21, i32 %22, i32 %23)
br label %31
25: ; preds = %3
%26 = load i8*, i8** %4
%27 = load i32, i32* %5
%28 = load i32, i32* %9
%29 = load i32, i32* %6
%30 = call i32 (i8*, i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %26, i32 %27, i32 %28, i32 %29)
br label %31
31: ; preds = %25, %18
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"%12s \09%08X\09%08X\09%08X\09%08X\0A\00"
@.str.1 = [31 x i8] c"%12s \09--------\09%08X\09%08X\09%08X\0A\00"
define void @report_partition(i8* %0, i32 %1, i32 %2) {
%4 = add i32 %1, 503316480
%5 = and i32 %4, 536870911
%6 = icmp ugt i32 %1, 131071
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = add i32 %1, -131072
%9 = tail call i32 (i8*, i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %8, i32 %1, i32 %5, i32 %2)
br label %12
10: ; preds = %3
%11 = tail call i32 (i8*, i8*, i32, i32, i32, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %1, i32 %5, i32 %2)
br label %12
12: ; preds = %10, %7
ret void
}