#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*/ write(int, char *, int);
int /*<<< orphan*/ writes(int, char const *);
void dumsg(const char *x, const char *p) {
  writes(2, x);
  if (p) {
    write(2, " `", 2);
    writes(2, p);
    write(2, "'\n", 2);
  } else
    write(2, "\n", 1);
}


x86 assembly (clang, -O0):
<dumsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x2,%edi
call   1040 <writes@plt>
cmpq   $0x0,-0x10(%rbp)
je     1182 <dumsg+0x62>
mov    $0x2,%edx
lea    0xeab(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x10(%rbp),%rsi
mov    $0x2,%edi
call   1040 <writes@plt>
mov    $0x2,%edx
lea    0xe8d(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
jmp    1198 <dumsg+0x78>
mov    $0x2,%edi
lea    0xe76(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumsg>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rsi
mov    $0x2,%edi
call   1040 <writes@plt>
test   %rbx,%rbx
je     1170 <dumsg+0x50>
lea    0xec3(%rip),%rsi
mov    $0x2,%edi
mov    $0x2,%edx
call   1030 <write@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
call   1040 <writes@plt>
lea    0xea3(%rip),%rsi
mov    $0x2,%edi
mov    $0x2,%edx
pop    %rbx
jmp    1030 <write@plt>
lea    0xe8d(%rip),%rsi
mov    $0x2,%edi
mov    $0x1,%edx
pop    %rbx
jmp    1030 <write@plt>

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

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