#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*/ free(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ puts(char *);
scalar_t__ strcmp(char const *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
int /*<<< orphan*/ yyerror(char *);
void pragmaString(const char *pragmaType, const char *command) {
  char *tmp = (char *)malloc(sizeof(char) * (strlen(command) + 1));
  strcpy(tmp, command);
  char *str = tmp;
  ++str;
  str[strlen(str) - 1] = '\0';
  if (strcmp(pragmaType, "msg") == 0) {
    puts(str);
  } else {
    yyerror("unknown pragma");
  }
  free(tmp);
}


x86 assembly (clang, -O0):
<pragmaString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1207 <pragmaString+0x97>
mov    -0x20(%rbp),%rdi
call   1050 <puts@plt>
jmp    1213 <pragmaString+0xa3>
lea    0xdf6(%rip),%rdi
call   1060 <yyerror@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pragmaString>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
lea    0x1(%rbx),%r14
mov    %r14,%rdi
call   1070 <strlen@plt>
cltq
movb   $0x0,(%rax,%rbx,1)
lea    0xe4e(%rip),%rsi
mov    %r15,%rdi
call   1080 <strcmp@plt>
test   %rax,%rax
je     11cd <pragmaString+0x5d>
lea    0xe3e(%rip),%rdi
call   1060 <yyerror@plt>
jmp    11d5 <pragmaString+0x65>
mov    %r14,%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"msg\00"
@.str.1 = [15 x i8] c"unknown pragma\00"
define void @pragmaString(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = add nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = mul i64 1, %10
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %5
%15 = load i8*, i8** %5
%16 = load i8*, i8** %4
%17 = call i32 @strcpy(i8* %15, i8* %16)
%18 = load i8*, i8** %5
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %6
%21 = load i8*, i8** %6
%22 = load i8*, i8** %6
%23 = call i32 @strlen(i8* %22)
%24 = sub nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %21, i64 %25
store i8 0, i8* %26
%27 = load i8*, i8** %3
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %2
%31 = load i8*, i8** %6
%32 = call i32 @puts(i8* %31)
br label %35
33: ; preds = %2
%34 = call i32 @yyerror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %33, %30
%36 = load i8*, i8** %5
%37 = call i32 @free(i8* %36)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"msg\00"
@.str.1 = [15 x i8] c"unknown pragma\00"
define void @pragmaString(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = add nsw i32 %3, 1
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @strcpy(i8* %6, i8* %1)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = tail call i32 @strlen(i8* %8)
%10 = add nsw i32 %9, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
store i8 0, i8* %12
%13 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = tail call i32 @puts(i8* %8)
br label %19
17: ; preds = %2
%18 = tail call i32 @yyerror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
%20 = tail call i32 @free(i8* %6)
ret void
}