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


x86 assembly (clang, -O0):
<tst_abs>:
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
mov    0x3(%rax),%r8b
mov    -0x18(%rbp),%rax
lea    0xea0(%rip),%rsi
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl 0x2(%rax),%r9d
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x120(%rbp),%rcx
call   1030 <lineprint4@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tst_abs>:
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 0x3(%rdx),%r8d
movzbl 0x2(%rdx),%r9d
lea    0xeb4(%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 <lineprint4@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [22 x i8] c"%-4s $%02X, $%02X%02X\00"
define void @tst_abs(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 3
%17 = load i8, i8* %16
%18 = load i8*, i8** %7
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %11, i8 zeroext %14, i8 zeroext %17, i8 zeroext %20)
%22 = load i8*, i8** %5
%23 = load i64, i64* %6
%24 = load i8*, i8** %7
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%26 = call i32 @lineprint4(i8* %22, i64 %23, i8* %24, i8* %25)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%-4s $%02X, $%02X%02X\00"
define void @tst_abs(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 3
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %2, i64 2
%12 = load i8, i8* %11
%13 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3, i8 zeroext %8, i8 zeroext %10, i8 zeroext %12)
%14 = call i32 @lineprint4(i8* %0, i64 %1, i8* %2, i8* %6)
ret void
}