#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*/ printMessageFor(int);
int /*<<< orphan*/ printf(char *, ...);
void manageNonFatalErrorWithLine(int code, char *message, int line,
                                 int position) {
  printf("\x1B[31m"
         "ERROR CODE [%d]: ",
         code);
  printMessageFor(code);
  printf("\n\t%s\n\thappened at line %d, in position %d\n\n"
         "\x1B[0m",
         message, line, position);
  return;
}


x86 assembly (clang, -O0):
<manageNonFatalErrorWithLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <printMessageFor@plt>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<manageNonFatalErrorWithLine>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xec7(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1030 <printMessageFor@plt>
lea    0xec7(%rip),%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14d,%ecx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"\1B[31mERROR CODE [%d]: \00"
@.str.1 = [48 x i8] c"\0A\09%s\0A\09happened at line %d, in position %d\0A\0A\1B[0m\00"
define void @manageNonFatalErrorWithLine(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %5
%12 = call i32 @printMessageFor(i32 %11)
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %13, i32 %14, i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"\1B[31mERROR CODE [%d]: \00"
@.str.1 = [48 x i8] c"\0A\09%s\0A\09happened at line %d, in position %d\0A\0A\1B[0m\00"
define void @manageNonFatalErrorWithLine(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %0)
%6 = tail call i32 @printMessageFor(i32 %0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %2, i32 %3)
ret void
}