#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*/ rcerror(char *);
void regerr2(const char *s, int c) {
  char buf[100];
  char *cp = buf;
  while (*s)
    *cp++ = *s++;
  *cp++ = c;
  *cp = '\0';
  rcerror(buf);
}


x86 assembly (clang, -O0):
<regerr2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     115e <regerr2+0x4e>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x78(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x78(%rbp)
mov    %cl,(%rax)
jmp    112a <regerr2+0x1a>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x78(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x78(%rbp)
mov    %cl,(%rax)
mov    -0x78(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x70(%rbp),%rdi
call   1030 <rcerror@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<regerr2>:
sub    $0x68,%rsp
mov    (%rdi),%cl
mov    %rsp,%rax
test   %cl,%cl
je     1141 <regerr2+0x31>
add    $0x1,%rdi
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1130 <regerr2+0x20>
mov    %sil,(%rax)
movb   $0x0,0x1(%rax)
mov    %rsp,%rdi
call   1030 <rcerror@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
define void @regerr2(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
store i8* %7, i8** %6
br label %8
8: ; preds = %12, %2
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
%15 = load i8, i8* %13
%16 = load i8*, i8** %6
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %6
store i8 %15, i8* %16
br label %8
18: ; preds = %8
%19 = load i32, i32* %4
%20 = trunc i32 %19 to i8
%21 = load i8*, i8** %6
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %6
store i8 %20, i8* %21
%23 = load i8*, i8** %6
store i8 0, i8* %23
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%25 = call i32 @rcerror(i8* %24)
ret void
}

LLVM IR (-O2):
define void @regerr2(i8* nocapture %0, i32 %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %2, %7
%8 = phi i8 [ %13, %7 ], [ %5, %2 ]
%9 = phi i8* [ %12, %7 ], [ %4, %2 ]
%10 = phi i8* [ %11, %7 ], [ %0, %2 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = getelementptr inbounds i8, i8* %9, i64 1
store i8 %8, i8* %9
%13 = load i8, i8* %11
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %7
15: ; preds = %7, %2
%16 = phi i8* [ %4, %2 ], [ %12, %7 ]
%17 = trunc i32 %1 to i8
%18 = getelementptr inbounds i8, i8* %16, i64 1
store i8 %17, i8* %16
store i8 0, i8* %18
%19 = call i32 @rcerror(i8* %4)
ret void
}