#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 getCarryflag(char *);
int getOverflowflag(char *);
int getSignflag(char *);
int getZeroflag(char *);
int /*<<< orphan*/ print_reg(char *);
int /*<<< orphan*/ printf(char *, ...);
void print_alu(char *rega, char *regb, char *accumulator, char flags[]) {
  printf("Register A:   ");
  print_reg(rega);
  printf("Register B:   ");
  print_reg(regb);
  printf("Accumulator:  ");
  print_reg(accumulator);
  printf("Carryflag:    %c\n", getCarryflag(flags));
  printf("Signflag:     %c\n", getSignflag(flags));
  printf("Zeroflag:     %c\n", getZeroflag(flags));
  printf("Overflowflag: %c\n", getOverflowflag(flags));
  printf("***********************\n");
}


x86 assembly (clang, -O0):
<print_alu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <print_reg@plt>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <print_reg@plt>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <print_reg@plt>
mov    -0x20(%rbp),%rdi
call   1070 <getCarryflag@plt>
mov    %eax,%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1080 <getSignflag@plt>
mov    %eax,%esi
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1050 <getZeroflag@plt>
mov    %eax,%esi
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1060 <getOverflowflag@plt>
mov    %eax,%esi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_alu>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r12
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xe75(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <print_reg@plt>
lea    0xe6e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1050 <print_reg@plt>
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1050 <print_reg@plt>
mov    %r12,%rdi
call   1080 <getCarryflag@plt>
lea    0xe58(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
call   1090 <getSignflag@plt>
lea    0xe52(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
call   1060 <getZeroflag@plt>
lea    0xe4c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
call   1070 <getOverflowflag@plt>
lea    0xe46(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe48(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Register A: \00"
@.str.1 = [15 x i8] c"Register B: \00"
@.str.2 = [15 x i8] c"Accumulator: \00"
@.str.3 = [18 x i8] c"Carryflag: %c\0A\00"
@.str.4 = [18 x i8] c"Signflag: %c\0A\00"
@.str.5 = [18 x i8] c"Zeroflag: %c\0A\00"
@.str.6 = [18 x i8] c"Overflowflag: %c\0A\00"
@.str.7 = [25 x i8] c"***********************\0A\00"
define void @print_alu(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = load i8*, i8** %5
%11 = call i32 @print_reg(i8* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%13 = load i8*, i8** %6
%14 = call i32 @print_reg(i8* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%16 = load i8*, i8** %7
%17 = call i32 @print_reg(i8* %16)
%18 = load i8*, i8** %8
%19 = call i32 @getCarryflag(i8* %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = load i8*, i8** %8
%22 = call i32 @getSignflag(i8* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %22)
%24 = load i8*, i8** %8
%25 = call i32 @getZeroflag(i8* %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %25)
%27 = load i8*, i8** %8
%28 = call i32 @getOverflowflag(i8* %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Register A: \00"
@.str.1 = [15 x i8] c"Register B: \00"
@.str.2 = [15 x i8] c"Accumulator: \00"
@.str.3 = [18 x i8] c"Carryflag: %c\0A\00"
@.str.4 = [18 x i8] c"Signflag: %c\0A\00"
@.str.5 = [18 x i8] c"Zeroflag: %c\0A\00"
@.str.6 = [18 x i8] c"Overflowflag: %c\0A\00"
@str = [24 x i8] c"***********************\00"
define void @print_alu(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @print_reg(i8* %0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @print_reg(i8* %1)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @print_reg(i8* %2)
%11 = tail call i32 @getCarryflag(i8* %3)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = tail call i32 @getSignflag(i8* %3)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = tail call i32 @getZeroflag(i8* %3)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%17 = tail call i32 @getOverflowflag(i8* %3)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), i32 %17)
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}