#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*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void error_tag(char error_string[], int error_number) {
  char error_buffer[100];
  if (error_number != 0) {
    strcpy(error_buffer, error_string);
    if (error_number > 4) {
      strcpy(error_string, "error: ");
    } else {
      strcpy(error_string, "warning: ");
    }
    strcat(error_string, error_buffer);
  }
}


x86 assembly (clang, -O0):
<error_tag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1182 <error_tag+0x62>
lea    -0x70(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
cmpl   $0x4,-0xc(%rbp)
jle    1165 <error_tag+0x45>
mov    -0x8(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1175 <error_tag+0x55>
mov    -0x8(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x70(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_tag>:
test   %esi,%esi
je     116f <error_tag+0x4f>
push   %rbp
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
cmp    $0x5,%ebp
lea    0xeb7(%rip),%rax
lea    0xeb8(%rip),%rsi
cmovge %rax,%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"error: \00"
@.str.1 = [10 x i8] c"warning: \00"
define void @error_tag(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [100 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %24
8: ; preds = %2
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = load i8*, i8** %3
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i32, i32* %4
%13 = icmp sgt i32 %12, 4
br i1 %13, label %14, label %17
14: ; preds = %8
%15 = load i8*, i8** %3
%16 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %20
17: ; preds = %8
%18 = load i8*, i8** %3
%19 = call i32 @strcpy(i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %17, %14
%21 = load i8*, i8** %3
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%23 = call i32 @strcat(i8* %21, i8* %22)
br label %24
24: ; preds = %20, %2
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"error: \00"
@.str.1 = [10 x i8] c"warning: \00"
define void @error_tag(i8* %0, i32 %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %1, 0
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = call i32 @strcpy(i8* %4, i8* %0)
%8 = icmp sgt i32 %1, 4
%9 = select i1 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0)
%10 = call i32 @strcpy(i8* %0, i8* %9)
%11 = call i32 @strcat(i8* %0, i8* %4)
br label %12
12: ; preds = %6, %2
ret void
}