#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 */
unsigned int _atoi(char const *, int);
int /*<<< orphan*/ ddump(unsigned int, unsigned int);
int CMD_db(int argc, char *argv[]) {
  unsigned int src;
  unsigned int len, i;
  if (argv[0])
    src = _atoi((const char *)(argv[0]), 16);
  if (!argv[1])
    len = 1;
  else
    len = _atoi((const char *)(argv[1]), 10);
  ddump(src, len);
}


x86 assembly (clang, -O0):
<CMD_db>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1151 <CMD_db+0x31>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x10,%esi
call   1040 <_atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    116c <CMD_db+0x4c>
movl   $0x1,-0x18(%rbp)
jmp    1181 <CMD_db+0x61>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0xa,%esi
call   1040 <_atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <ddump@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CMD_db>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    (%rsi),%rdi
test   %rdi,%rdi
je     113c <CMD_db+0x1c>
mov    $0x10,%esi
call   1040 <_atoi@plt>
mov    %eax,%ebp
jmp    113c <CMD_db+0x1c>
mov    0x8(%rbx),%rdi
test   %rdi,%rdi
je     1153 <CMD_db+0x33>
mov    $0xa,%esi
call   1040 <_atoi@plt>
mov    %eax,%esi
jmp    1158 <CMD_db+0x38>
mov    $0x1,%esi
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <ddump@plt>

LLVM IR (-O0):
define i32 @CMD_db(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @_atoi(i8* %16, i32 16)
store i32 %17, i32* %6
br label %18
18: ; preds = %13, %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = icmp ne i8* %21, null
br i1 %22, label %24, label %23
23: ; preds = %18
store i32 1, i32* %7
br label %29
24: ; preds = %18
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @_atoi(i8* %27, i32 10)
store i32 %28, i32* %7
br label %29
29: ; preds = %24, %23
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = call i32 @ddump(i32 %30, i32 %31)
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @CMD_db(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @_atoi(i8* %3, i32 16)
br label %7
7: ; preds = %5, %2
%8 = phi i32 [ %6, %5 ], [ undef, %2 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = icmp eq i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %7
%13 = tail call i32 @_atoi(i8* %10, i32 10)
br label %14
14: ; preds = %7, %12
%15 = phi i32 [ %13, %12 ], [ 1, %7 ]
%16 = tail call i32 @ddump(i32 %8, i32 %15)
ret i32 undef
}