#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 strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int);
void warning(const char *msg) {
  write(2,
        "Shell"
        ": ",
        sizeof("Shell"
               ": ") -
            1);
  if (msg) {
    write(2, msg, strlen(msg));
    write(2, "\n", 1);
  } else {
    write(2, "Internal Error\n", 15);
  }
}


x86 assembly (clang, -O0):
<warning>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2,%edi
lea    0xec8(%rip),%rsi
mov    $0x7,%edx
call   1030 <write@plt>
cmpq   $0x0,-0x8(%rbp)
je     1189 <warning+0x69>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x2,%edi
call   1030 <write@plt>
mov    $0x2,%edi
lea    0xe9c(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
jmp    119f <warning+0x7f>
mov    $0x2,%edi
lea    0xe73(%rip),%rsi
mov    $0xf,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<warning>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
mov    $0x2,%edi
mov    $0x7,%edx
call   1030 <write@plt>
test   %rbx,%rbx
je     116d <warning+0x4d>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xeb9(%rip),%rsi
mov    $0x2,%edi
mov    $0x1,%edx
pop    %rbx
jmp    1030 <write@plt>
lea    0xe94(%rip),%rsi
mov    $0x2,%edi
mov    $0xf,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Shell: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [16 x i8] c"Internal Error\0A\00"
define void @warning(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @write(i32 2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%4 = load i8*, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
%10 = call i32 @write(i32 2, i8* %7, i32 %9)
%11 = call i32 @write(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %14
12: ; preds = %1
%13 = call i32 @write(i32 2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 15)
br label %14
14: ; preds = %12, %6
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"Shell: \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [16 x i8] c"Internal Error\0A\00"
define void @warning(i8* %0) {
%2 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%3 = icmp eq i8* %0, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @strlen(i8* %0)
%6 = tail call i32 @write(i32 2, i8* %0, i32 %5)
%7 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
br label %10
8: ; preds = %1
%9 = tail call i32 @write(i32 2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 15)
br label %10
10: ; preds = %8, %4
ret void
}