#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 mash_mem_L(int *);
int mash_reg_L(int);
int mash_reg_W(int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main(void) {
  int i, ii;
  for (i = 0; i < 0x10; i++) {
    ii = i;
    printf("0x%x -> 0x%2x 0x%2x 0x%2x\n", i, mash_reg_L(i), mash_mem_L(&ii),
           mash_reg_W(i));
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    11b1 <main+0x71>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <mash_reg_L@plt>
mov    %eax,-0x14(%rbp)
lea    -0xc(%rbp),%rdi
call   1060 <mash_mem_L@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <mash_reg_W@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    %eax,%r8d
lea    0xe62(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1156 <main+0x16>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
lea    0xc(%rsp),%r14
lea    0xea6(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %ebx,0xc(%rsp)
mov    %ebx,%edi
call   1030 <mash_reg_L@plt>
mov    %eax,%r12d
mov    %r14,%rdi
call   1060 <mash_mem_L@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1050 <mash_reg_W@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x10,%ebx
jne    1160 <main+0x20>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"0x%x -> 0x%2x 0x%2x 0x%2x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 16
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %2
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = call i32 @mash_reg_L(i32 %10)
%12 = call i32 @mash_mem_L(i32* %3)
%13 = load i32, i32* %2
%14 = call i32 @mash_reg_W(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11, i32 %12, i32 %14)
br label %16
16: ; preds = %7
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %4
19: ; preds = %4
ret i32 1
}

LLVM IR (-O2):
@.str = [27 x i8] c"0x%x -> 0x%2x 0x%2x 0x%2x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %9, %3 ]
store i32 %4, i32* %1
%5 = call i32 @mash_reg_L(i32 %4)
%6 = call i32 @mash_mem_L(i32* %1)
%7 = call i32 @mash_reg_W(i32 %4)
%8 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5, i32 %6, i32 %7)
%9 = add nuw nsw i32 %4, 1
%10 = icmp eq i32 %9, 16
br i1 %10, label %11, label %3
11: ; preds = %3
ret i32 1
}