#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*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fputc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void _gfortran_caf_error_stop_str(const char *string, int32_t len) {
  fputs("ERROR STOP ", stderr);
  while (len--)
    fputc(*(string++), stderr);
  fputs("\n", stderr);
  exit(1);
}


x86 assembly (clang, -O0):
<_gfortran_caf_error_stop_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%esi
lea    0xeb1(%rip),%rdi
call   1030 <fputs@plt>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     118d <_gfortran_caf_error_stop_str+0x5d>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
mov    0x2e5f(%rip),%rax
mov    (%rax),%esi
call   1040 <fputc@plt>
jmp    1154 <_gfortran_caf_error_stop_str+0x24>
mov    0x2e4c(%rip),%rax
mov    (%rax),%esi
lea    0xe6f(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<_gfortran_caf_error_stop_str>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
mov    0x2e9b(%rip),%r15
mov    (%r15),%esi
lea    0xeb1(%rip),%rdi
call   1030 <fputs@plt>
test   %r14d,%r14d
je     1175 <_gfortran_caf_error_stop_str+0x45>
mov    %r14d,%ebp
xor    %ebx,%ebx
xchg   %ax,%ax
movsbl (%r12,%rbx,1),%edi
mov    (%r15),%esi
call   1040 <fputc@plt>
add    $0x1,%rbx
cmp    %ebx,%ebp
jne    1160 <_gfortran_caf_error_stop_str+0x30>
mov    (%r15),%esi
lea    0xe8d(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"ERROR STOP \00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define void @_gfortran_caf_error_stop_str(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stderr
%6 = call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %7
7: ; preds = %11, %2
%8 = load i32, i32* %4
%9 = add nsw i32 %8, -1
store i32 %9, i32* %4
%10 = icmp ne i32 %8, 0
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
%14 = load i8, i8* %12
%15 = sext i8 %14 to i32
%16 = load i32, i32* @stderr
%17 = call i32 @fputc(i32 %15, i32 %16)
br label %7
18: ; preds = %7
%19 = load i32, i32* @stderr
%20 = call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"ERROR STOP \00"
@stderr = global i32 0
@.str.1 = [2 x i8] c"\0A\00"
define void @_gfortran_caf_error_stop_str(i8* nocapture %0, i32 %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp eq i32 %1, 0
br i1 %5, label %16, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %9, %6 ], [ %1, %2 ]
%8 = phi i8* [ %10, %6 ], [ %0, %2 ]
%9 = add nsw i32 %7, -1
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %8
%12 = sext i8 %11 to i32
%13 = load i32, i32* @stderr
%14 = tail call i32 @fputc(i32 %12, i32 %13)
%15 = icmp eq i32 %9, 0
br i1 %15, label %16, label %6
16: ; preds = %6, %2
%17 = load i32, i32* @stderr
%18 = tail call i32 @fputs(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = tail call i32 @exit(i32 1)
unreachable
}