#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*/ lineprint3(char *, long, unsigned char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, unsigned char,
                           unsigned char);
void tst_zpx(char *outf, long ctr, unsigned char *op, char *str) {
  char buf[256];
  sprintf(buf, "%-4s $%02X, $%02X", str, *(op + 1), *(op + 2));
  lineprint3(outf, ctr, op, buf);
}


x86 assembly (clang, -O0):
<tst_zpx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x18(%rbp),%rax
lea    0xea8(%rip),%rsi
movzbl %cl,%ecx
movzbl 0x2(%rax),%r8d
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x120(%rbp),%rcx
call   1030 <lineprint3@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst_zpx>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
movzbl 0x1(%rdx),%eax
movzbl 0x2(%rdx),%r8d
lea    0xeb9(%rip),%rsi
mov    %rsp,%r12
mov    %r12,%rdi
mov    %rcx,%rdx
mov    %eax,%ecx
call   1040 <sprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
call   1030 <lineprint3@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [18 x i8] c"%-4s $%02X, $%02X\00"
define void @tst_zpx(i8* %0, i64 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [256 x i8]
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %8
%12 = load i8*, i8** %7
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = load i8*, i8** %7
%16 = getelementptr inbounds i8, i8* %15, i64 2
%17 = load i8, i8* %16
%18 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %11, i8 zeroext %14, i8 zeroext %17)
%19 = load i8*, i8** %5
%20 = load i64, i64* %6
%21 = load i8*, i8** %7
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%23 = call i32 @lineprint3(i8* %19, i64 %20, i8* %21, i8* %22)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%-4s $%02X, $%02X\00"
define void @tst_zpx(i8* %0, i64 %1, i8* %2, i8* %3) {
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = getelementptr inbounds i8, i8* %2, i64 1
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %2, i64 2
%10 = load i8, i8* %9
%11 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %3, i8 zeroext %8, i8 zeroext %10)
%12 = call i32 @lineprint3(i8* %0, i64 %1, i8* %2, i8* %6)
ret void
}