#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*/ print_bytes(unsigned char *, unsigned int);
int /*<<< orphan*/ puts(char *);
int scan_hexnum(unsigned int *);
void disp_mem() {
  unsigned char *p;
  unsigned int len;
  if (scan_hexnum((unsigned *)&p) == 0x0) {
    if (scan_hexnum(&len) != 0x0)
      len = 0x100;
    print_bytes(p, len);
    return;
  }
  puts("Invalid arguments\n");
}


x86 assembly (clang, -O0):
<disp_mem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1040 <scan_hexnum@plt>
cmp    $0x0,%eax
jne    1174 <disp_mem+0x44>
lea    -0xc(%rbp),%rdi
call   1040 <scan_hexnum@plt>
cmp    $0x0,%eax
je     1163 <disp_mem+0x33>
movl   $0x100,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1050 <print_bytes@plt>
jmp    1180 <disp_mem+0x50>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disp_mem>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rdi
call   1040 <scan_hexnum@plt>
test   %eax,%eax
je     1153 <disp_mem+0x23>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
add    $0x18,%rsp
ret
lea    0xc(%rsp),%rdi
call   1040 <scan_hexnum@plt>
test   %eax,%eax
je     1170 <disp_mem+0x40>
movl   $0x100,0xc(%rsp)
mov    $0x100,%esi
jmp    1174 <disp_mem+0x44>
mov    0xc(%rsp),%esi
mov    0x10(%rsp),%rdi
call   1050 <print_bytes@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Invalid arguments\0A\00"
define void @disp_mem() {
%1 = alloca i8*
%2 = alloca i32
%3 = bitcast i8** %1 to i32*
%4 = call i32 @scan_hexnum(i32* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %0
%7 = call i32 @scan_hexnum(i32* %2)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 256, i32* %2
br label %10
10: ; preds = %9, %6
%11 = load i8*, i8** %1
%12 = load i32, i32* %2
%13 = call i32 @print_bytes(i8* %11, i32 %12)
br label %16
14: ; preds = %0
%15 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %10
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Invalid arguments\0A\00"
define void @disp_mem() {
%1 = alloca i8*
%2 = alloca i32
%3 = bitcast i8** %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = bitcast i8** %1 to i32*
%6 = call i32 @scan_hexnum(i32* %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %0
%9 = call i32 @scan_hexnum(i32* %2)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load i32, i32* %2
br label %14
13: ; preds = %8
store i32 256, i32* %2
br label %14
14: ; preds = %11, %13
%15 = phi i32 [ %12, %11 ], [ 256, %13 ]
%16 = load i8*, i8** %1
%17 = call i32 @print_bytes(i8* %16, i32 %15)
br label %20
18: ; preds = %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
ret void
}