#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*/ exit(int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *strcat(char *, char *);
void syserr_ext(char *prog, char *msg, int line) {
  char line_str[20];
  sprintf(line_str, "%d", line);
  char *str_temp = strcat(prog, " | line: ");
  str_temp = strcat(str_temp, line_str);
  str_temp = strcat(str_temp, " | "
                              "\033[31m"
                              "error"
                              "\e[0m"
                              " ");
  str_temp = strcat(str_temp, msg);
  perror(str_temp);
  exit(1);
}


x86 assembly (clang, -O0):
<syserr_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe9f(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe92(%rip),%rsi
call   1040 <strcat@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <strcat@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xe77(%rip),%rsi
call   1040 <strcat@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcat@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<syserr_ext>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xe9a(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movabs $0x3a656e696c207c20,%rcx
6e 65 3a
mov    %rcx,(%rbx,%rax,1)
movw   $0x20,0x8(%rbx,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movups 0xe65(%rip),%xmm0
movups %xmm0,(%rbx,%rax,1)
movl   $0x206d30,0xf(%rbx,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c" | line: \00"
@.str.2 = [19 x i8] c" | \1B[31merror\1B[0m \00"
define void @syserr_ext(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [20 x i8]
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%10 = load i32, i32* %6
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i8*, i8** %4
%13 = call i8* @strcat(i8* %12, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
store i8* %13, i8** %8
%14 = load i8*, i8** %8
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%16 = call i8* @strcat(i8* %14, i8* %15)
store i8* %16, i8** %8
%17 = load i8*, i8** %8
%18 = call i8* @strcat(i8* %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
store i8* %18, i8** %8
%19 = load i8*, i8** %8
%20 = load i8*, i8** %5
%21 = call i8* @strcat(i8* %19, i8* %20)
store i8* %21, i8** %8
%22 = load i8*, i8** %8
%23 = call i32 @perror(i8* %22)
%24 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c" | line: \00"
@.str.2 = [19 x i8] c" | \1B[31merror\1B[0m \00"
define void @syserr_ext(i8* %0, i8* nocapture %1, i32 %2) {
%4 = alloca [20 x i8]
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%7 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%8 = getelementptr i8, i8* %0, i64 %7
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(10) %8, i8* align 1 dereferenceable(10) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i64 10, i1 false)
%9 = call i8* @strcat(i8* dereferenceable(1) %0, i8* %5)
%10 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%11 = getelementptr i8, i8* %0, i64 %10
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(19) %11, i8* align 1 dereferenceable(19) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 19, i1 false)
%12 = tail call i8* @strcat(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%13 = tail call i32 @perror(i8* %0)
%14 = tail call i32 @exit(i32 1)
unreachable
}