#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 /*<<< orphan*/ mem_address;

/* Variables and functions */
int /*<<< orphan*/ hexedit_clear();
scalar_t__ hexedit_prompt_value(unsigned long *, int, char *);
int /*<<< orphan*/ hexedit_start(unsigned char *);
void hexedit(void) {
  unsigned long mem_address = 0x06004000;
  hexedit_clear();
  while (1) {
    if (hexedit_prompt_value(&mem_address, sizeof(mem_address),
                             "Edit start address") == 0) {
      hexedit_clear();
      return;
    }
    hexedit_start((unsigned char *)mem_address);
    hexedit_clear();
  }
}


x86 assembly (clang, -O0):
<hexedit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x6004000,-0x8(%rbp)
06
mov    $0x0,%al
call   1040 <hexedit_clear@plt>
lea    -0x8(%rbp),%rdi
mov    $0x8,%esi
lea    0xea9(%rip),%rdx
call   1050 <hexedit_prompt_value@plt>
cmp    $0x0,%rax
jne    1173 <hexedit+0x43>
mov    $0x0,%al
call   1040 <hexedit_clear@plt>
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%rdi
call   1030 <hexedit_start@plt>
mov    $0x0,%al
call   1040 <hexedit_clear@plt>
jmp    1147 <hexedit+0x17>

x86 assembly (clang, -O2):
<hexedit>:
push   %r14
push   %rbx
push   %rax
movq   $0x6004000,(%rsp)
06
xor    %eax,%eax
call   1040 <hexedit_clear@plt>
lea    0xeb6(%rip),%rdx
mov    %rsp,%rdi
mov    $0x8,%esi
call   1050 <hexedit_prompt_value@plt>
test   %rax,%rax
je     1195 <hexedit+0x65>
lea    0xe9d(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
mov    (%rsp),%rdi
call   1030 <hexedit_start@plt>
xor    %eax,%eax
call   1040 <hexedit_clear@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
mov    %r14,%rdx
call   1050 <hexedit_prompt_value@plt>
test   %rax,%rax
jne    1170 <hexedit+0x40>
xor    %eax,%eax
call   1040 <hexedit_clear@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Edit start address\00"
define void @hexedit() {
%1 = alloca i64
store i64 100679680, i64* %1
%2 = call i32 (...) @hexedit_clear()
br label %3
3: ; preds = %0, %8
%4 = call i64 @hexedit_prompt_value(i64* %1, i32 8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = call i32 (...) @hexedit_clear()
ret void
8: ; preds = %3
%9 = load i64, i64* %1
%10 = inttoptr i64 %9 to i8*
%11 = call i32 @hexedit_start(i8* %10)
%12 = call i32 (...) @hexedit_clear()
br label %3
}

LLVM IR (-O2):
@.str = [19 x i8] c"Edit start address\00"
define void @hexedit() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 100679680, i64* %1
%3 = tail call i32 (...) @hexedit_clear()
%4 = call i64 @hexedit_prompt_value(i64* %1, i32 8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %8, %0
%7 = call i32 (...) @hexedit_clear()
ret void
8: ; preds = %0, %8
%9 = load i64, i64* %1
%10 = inttoptr i64 %9 to i8*
%11 = call i32 @hexedit_start(i8* %10)
%12 = call i32 (...) @hexedit_clear()
%13 = call i64 @hexedit_prompt_value(i64* %1, i32 8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %6, label %8
}