#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 */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ i915_get_instruction_dst(int /*<<< orphan*/ const *, int,
                                            char *, int);
int /*<<< orphan*/ i915_get_instruction_src0(int /*<<< orphan*/ const *, int,
                                             char *);
int /*<<< orphan*/ instr_out(int /*<<< orphan*/ const *, int /*<<< orphan*/,
                             int /*<<< orphan*/, char *, char *, ...);
void i915_decode_alu1(const uint32_t *data, uint32_t hw_offset, int i,
                      char *instr_prefix, char *op_name) {
  char dst[100], src0[100];
  i915_get_instruction_dst(data, i, dst, 1);
  i915_get_instruction_src0(data, i, src0);
  instr_out(data, hw_offset, i++, "%s: %s %s, %s\n", instr_prefix, op_name, dst,
            src0);
  instr_out(data, hw_offset, i++, "%s\n", instr_prefix);
  instr_out(data, hw_offset, i++, "%s\n", instr_prefix);
}


x86 assembly (clang, -O0):
<i915_decode_alu1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
lea    -0x90(%rbp),%rdx
mov    $0x1,%ecx
call   1040 <i915_get_instruction_dst@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
lea    -0x100(%rbp),%rdx
call   1030 <i915_get_instruction_src0@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    -0x90(%rbp),%r10
lea    -0x100(%rbp),%rax
lea    0xe59(%rip),%rcx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   1050 <instr_out@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%r8
lea    0xe37(%rip),%rcx
mov    $0x0,%al
call   1050 <instr_out@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%r8
lea    0xe13(%rip),%rcx
mov    $0x0,%al
call   1050 <instr_out@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i915_decode_alu1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    %r8,%rbp
mov    %rcx,%r14
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%r12
lea    0x70(%rsp),%rdx
mov    %ebx,%esi
mov    $0x1,%ecx
call   1040 <i915_get_instruction_dst@plt>
mov    %rsp,%rdx
mov    %r12,%rdi
mov    %ebx,%esi
call   1030 <i915_get_instruction_src0@plt>
lea    0x1(%rbx),%r13d
lea    0xe88(%rip),%rcx
mov    %r12,%rdi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %r14,%r8
mov    %rbp,%r9
xor    %eax,%eax
mov    %rsp,%rbp
push   %rbp
lea    0x78(%rsp),%rbp
push   %rbp
call   1050 <instr_out@plt>
add    $0x10,%rsp
add    $0x2,%ebx
lea    0xe66(%rip),%rbp
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %rbp,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1050 <instr_out@plt>
mov    %r12,%rdi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %rbp,%rcx
mov    %r14,%r8
xor    %eax,%eax
call   1050 <instr_out@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%s: %s %s, %s\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @i915_decode_alu1(i32* %0, i32 %1, i32 %2, i8* %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [100 x i8]
%12 = alloca [100 x i8]
store i32* %0, i32** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%13 = load i32*, i32** %6
%14 = load i32, i32* %8
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%16 = call i32 @i915_get_instruction_dst(i32* %13, i32 %14, i8* %15, i32 1)
%17 = load i32*, i32** %6
%18 = load i32, i32* %8
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%20 = call i32 @i915_get_instruction_src0(i32* %17, i32 %18, i8* %19)
%21 = load i32*, i32** %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = add nsw i32 %23, 1
store i32 %24, i32* %8
%25 = load i8*, i8** %9
%26 = load i8*, i8** %10
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%29 = call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %21, i32 %22, i32 %23, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %25, i8* %26, i8* %27, i8* %28)
%30 = load i32*, i32** %6
%31 = load i32, i32* %7
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
%34 = load i8*, i8** %9
%35 = call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %30, i32 %31, i32 %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %34)
%36 = load i32*, i32** %6
%37 = load i32, i32* %7
%38 = load i32, i32* %8
%39 = add nsw i32 %38, 1
store i32 %39, i32* %8
%40 = load i8*, i8** %9
%41 = call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %36, i32 %37, i32 %38, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %40)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s: %s %s, %s\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @i915_decode_alu1(i32* %0, i32 %1, i32 %2, i8* %3, i8* %4) {
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%10 = call i32 @i915_get_instruction_dst(i32* %0, i32 %2, i8* %8, i32 1)
%11 = call i32 @i915_get_instruction_src0(i32* %0, i32 %2, i8* %9)
%12 = add nsw i32 %2, 1
%13 = call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %0, i32 %1, i32 %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4, i8* %8, i8* %9)
%14 = add nsw i32 %2, 2
%15 = call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %0, i32 %1, i32 %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%16 = call i32 (i32*, i32, i32, i8*, i8*, ...) @instr_out(i32* %0, i32 %1, i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}