#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 *, unsigned char);
int /*<<< orphan*/ puts(char *);
void printstate(unsigned char state[][4]) {
  int idx, idx2;
  for (idx = 0; idx < 4; idx++)
    for (idx2 = 0; idx2 < 4; idx2++)
      printf("%02x", state[idx2][idx]);
  puts("");
}


x86 assembly (clang, -O0):
<printstate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1192 <printstate+0x72>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    117f <printstate+0x5f>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
lea    0xe98(%rip),%rdi
movzbl (%rax,%rcx,1),%esi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <printstate+0x24>
jmp    1184 <printstate+0x64>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <printstate+0x13>
lea    0xe6b(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printstate>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movzbl (%rdi),%esi
lea    0xecf(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x4(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x8(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0xc(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x1(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x5(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x9(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0xd(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x2(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x6(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0xa(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0xe(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x3(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0x7(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0xb(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
movzbl 0xf(%rbx),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%02x\00"
@.str.1 = [1 x i8] zeroinitializer
define void @printstate([4 x i8]* %0) {
%2 = alloca [4 x i8]*
%3 = alloca i32
%4 = alloca i32
store [4 x i8]* %0, [4 x i8]** %2
store i32 0, i32* %3
br label %5
5: ; preds = %26, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 4
br i1 %7, label %8, label %29
8: ; preds = %5
store i32 0, i32* %4
br label %9
9: ; preds = %22, %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %25
12: ; preds = %9
%13 = load [4 x i8]*, [4 x i8]** %2
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %13, i64 %15
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %16, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %20)
br label %22
22: ; preds = %12
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %9
25: ; preds = %9
br label %26
26: ; preds = %25
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %5
29: ; preds = %5
%30 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%02x\00"
define void @printstate([4 x i8]* nocapture %0) {
%2 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 0
%3 = load i8, i8* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %3)
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 0
%6 = load i8, i8* %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %6)
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 0
%9 = load i8, i8* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %9)
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 0
%12 = load i8, i8* %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %12)
%14 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 1
%15 = load i8, i8* %14
%16 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %15)
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 1
%18 = load i8, i8* %17
%19 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %18)
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 1
%21 = load i8, i8* %20
%22 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %21)
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 1
%24 = load i8, i8* %23
%25 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %24)
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 2
%27 = load i8, i8* %26
%28 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %27)
%29 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 2
%30 = load i8, i8* %29
%31 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %30)
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 2
%33 = load i8, i8* %32
%34 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %33)
%35 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 2
%36 = load i8, i8* %35
%37 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %36)
%38 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 0, i64 3
%39 = load i8, i8* %38
%40 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %39)
%41 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 1, i64 3
%42 = load i8, i8* %41
%43 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %42)
%44 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 2, i64 3
%45 = load i8, i8* %44
%46 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %45)
%47 = getelementptr inbounds [4 x i8], [4 x i8]* %0, i64 3, i64 3
%48 = load i8, i8* %47
%49 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 zeroext %48)
%50 = tail call i32 @putchar(i32 10)
ret void
}