#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*/ clearCarryflag(char *);
int /*<<< orphan*/ setCarryflag(char *);
int /*<<< orphan*/ zsflagging(char *, char *);
void op_alu_asl(char regina[], char reginb[], char regouta[], char flags[]) {
  int i;
  regouta[0] == '1' ? setCarryflag(flags) : clearCarryflag(flags);
  for (i = 1; i < 8; i++) {
    regouta[i - 1] = regouta[i];
  }
  regouta[8 - 1] = '0';
  zsflagging(flags, regouta);
}


x86 assembly (clang, -O0):
<op_alu_asl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
jne    1166 <op_alu_asl+0x36>
mov    -0x20(%rbp),%rdi
call   1030 <setCarryflag@plt>
jmp    116f <op_alu_asl+0x3f>
mov    -0x20(%rbp),%rdi
call   1050 <clearCarryflag@plt>
movl   $0x1,-0x24(%rbp)
cmpl   $0x8,-0x24(%rbp)
jge    11a9 <op_alu_asl+0x79>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1176 <op_alu_asl+0x46>
mov    -0x18(%rbp),%rax
movb   $0x30,0x7(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <zsflagging@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_alu_asl>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
cmpb   $0x31,(%rdx)
jne    1149 <op_alu_asl+0x19>
mov    %r14,%rdi
call   1030 <setCarryflag@plt>
jmp    1151 <op_alu_asl+0x21>
mov    %r14,%rdi
call   1050 <clearCarryflag@plt>
mov    0x1(%rbx),%eax
mov    %eax,(%rbx)
movzwl 0x5(%rbx),%eax
mov    %ax,0x4(%rbx)
mov    0x7(%rbx),%al
mov    %al,0x6(%rbx)
movb   $0x30,0x7(%rbx)
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <zsflagging@plt>

LLVM IR (-O0):
define void @op_alu_asl(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %7
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 49
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load i8*, i8** %8
%17 = call i32 @setCarryflag(i8* %16)
br label %21
18: ; preds = %4
%19 = load i8*, i8** %8
%20 = call i32 @clearCarryflag(i8* %19)
br label %21
21: ; preds = %18, %15
%22 = phi i32 [ %17, %15 ], [ %20, %18 ]
store i32 1, i32* %9
br label %23
23: ; preds = %37, %21
%24 = load i32, i32* %9
%25 = icmp slt i32 %24, 8
br i1 %25, label %26, label %40
26: ; preds = %23
%27 = load i8*, i8** %7
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
%31 = load i8, i8* %30
%32 = load i8*, i8** %7
%33 = load i32, i32* %9
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %32, i64 %35
store i8 %31, i8* %36
br label %37
37: ; preds = %26
%38 = load i32, i32* %9
%39 = add nsw i32 %38, 1
store i32 %39, i32* %9
br label %23
40: ; preds = %23
%41 = load i8*, i8** %7
%42 = getelementptr inbounds i8, i8* %41, i64 7
store i8 48, i8* %42
%43 = load i8*, i8** %8
%44 = load i8*, i8** %7
%45 = call i32 @zsflagging(i8* %43, i8* %44)
ret void
}

LLVM IR (-O2):
define void @op_alu_asl(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* %2, i8* %3) {
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 49
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @setCarryflag(i8* %3)
br label %11
9: ; preds = %4
%10 = tail call i32 @clearCarryflag(i8* %3)
br label %11
11: ; preds = %9, %7
%12 = getelementptr i8, i8* %2, i64 1
%13 = getelementptr inbounds i8, i8* %2, i64 7
store i8 48, i8* %13
%14 = tail call i32 @zsflagging(i8* %3, i8* %2)
ret void
}