#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 char *alpha2_encode(unsigned char *, int);
int /*<<< orphan*/ printf(char *, ...);
void testAllAsicc() {
  unsigned char tmp[1];
  unsigned char *ret;
  int i = 0;
  for (i = 0x00; i <= 0xFF; i++) {
    tmp[0] = i;
    printf("tmp[0]=0x%02x   ==>  ", tmp[0]);
    ret = alpha2_encode(tmp, 1);
    printf("%s\n", ret);
  }
}


x86 assembly (clang, -O0):
<testAllAsicc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xff,-0x14(%rbp)
jg     118d <testAllAsicc+0x6d>
mov    -0x14(%rbp),%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1(%rbp),%rdi
mov    $0x1,%esi
call   1040 <alpha2_encode@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <testAllAsicc+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testAllAsicc>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec1(%rip),%r14
lea    0xf(%rsp),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    %bpl,0xf(%rsp)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1050 <alpha2_encode@plt>
mov    %rax,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
jne    1150 <testAllAsicc+0x20>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"tmp[0]=0x%02x ==> \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @testAllAsicc() {
%1 = alloca [1 x i8]
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %3
store i32 0, i32* %3
br label %4
4: ; preds = %19, %0
%5 = load i32, i32* %3
%6 = icmp sle i32 %5, 255
br i1 %6, label %7, label %22
7: ; preds = %4
%8 = load i32, i32* %3
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
store i8 %9, i8* %10
%11 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
%12 = load i8, i8* %11
%13 = zext i8 %12 to i32
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
%16 = call i8* @alpha2_encode(i8* %15, i32 1)
store i8* %16, i8** %2
%17 = load i8*, i8** %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %19
19: ; preds = %7
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %4
22: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"tmp[0]=0x%02x ==> \00"
define void @testAllAsicc() {
%1 = alloca [1 x i8]
%2 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i32 [ 0, %0 ], [ %9, %3 ]
%5 = trunc i32 %4 to i8
store i8 %5, i8* %2
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4)
%7 = call i8* @alpha2_encode(i8* %2, i32 1)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
%9 = add nuw nsw i32 %4, 1
%10 = icmp eq i32 %9, 256
br i1 %10, label %11, label %3
11: ; preds = %3
ret void
}