#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 MM_INFO;
int /*<<< orphan*/ MM_PRINT;
int /*<<< orphan*/ addseverity(int, char *);
int /*<<< orphan*/ fmtmsg(int /*<<< orphan*/, char *, int, char *, char *,
                          char *);
int main(void) {
  addseverity(5, "NOTE2");
  fmtmsg(MM_PRINT, "only1field", MM_INFO, "text2", "action2", "tag2");
  fmtmsg(MM_PRINT, "UX:cat", 5, "invalid syntax", "refer to manual",
         "UX:cat:001");
  fmtmsg(MM_PRINT, "label:foo", 6, "text", "action", "tag");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
lea    0xec5(%rip),%rsi
call   1040 <addseverity@plt>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
mov    0x2e90(%rip),%rax
mov    (%rax),%edx
lea    0xead(%rip),%rsi
lea    0xeb1(%rip),%rcx
lea    0xeb0(%rip),%r8
lea    0xeb1(%rip),%r9
call   1030 <fmtmsg@plt>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xea1(%rip),%rsi
mov    $0x5,%edx
lea    0xe9c(%rip),%rcx
lea    0xea4(%rip),%r8
lea    0xead(%rip),%r9
call   1030 <fmtmsg@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
mov    $0x6,%edx
lea    0xea1(%rip),%rcx
lea    0xe9f(%rip),%r8
lea    0xe9f(%rip),%r9
call   1030 <fmtmsg@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rsi
mov    $0x5,%edi
call   1040 <addseverity@plt>
mov    0x2eaf(%rip),%rbx
mov    (%rbx),%edi
mov    0x2e9e(%rip),%rax
mov    (%rax),%edx
lea    0xebb(%rip),%rsi
lea    0xebf(%rip),%rcx
lea    0xebe(%rip),%r8
lea    0xebf(%rip),%r9
call   1030 <fmtmsg@plt>
mov    (%rbx),%edi
lea    0xeb6(%rip),%rsi
lea    0xeb6(%rip),%rcx
lea    0xebe(%rip),%r8
lea    0xec7(%rip),%r9
mov    $0x5,%edx
call   1030 <fmtmsg@plt>
mov    (%rbx),%edi
lea    0xebf(%rip),%rsi
lea    0xec2(%rip),%rcx
lea    0xec0(%rip),%r8
lea    0xec0(%rip),%r9
mov    $0x6,%edx
call   1030 <fmtmsg@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"NOTE2\00"
@MM_PRINT = global i32 0
@.str.1 = [11 x i8] c"only1field\00"
@MM_INFO = global i32 0
@.str.2 = [6 x i8] c"text2\00"
@.str.3 = [8 x i8] c"action2\00"
@.str.4 = [5 x i8] c"tag2\00"
@.str.5 = [7 x i8] c"UX:cat\00"
@.str.6 = [15 x i8] c"invalid syntax\00"
@.str.7 = [16 x i8] c"refer to manual\00"
@.str.8 = [11 x i8] c"UX:cat:001\00"
@.str.9 = [10 x i8] c"label:foo\00"
@.str.10 = [5 x i8] c"text\00"
@.str.11 = [7 x i8] c"action\00"
@.str.12 = [4 x i8] c"tag\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @addseverity(i32 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @MM_PRINT
%4 = load i32, i32* @MM_INFO
%5 = call i32 @fmtmsg(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%6 = load i32, i32* @MM_PRINT
%7 = call i32 @fmtmsg(i32 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%8 = load i32, i32* @MM_PRINT
%9 = call i32 @fmtmsg(i32 %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"NOTE2\00"
@MM_PRINT = global i32 0
@.str.1 = [11 x i8] c"only1field\00"
@MM_INFO = global i32 0
@.str.2 = [6 x i8] c"text2\00"
@.str.3 = [8 x i8] c"action2\00"
@.str.4 = [5 x i8] c"tag2\00"
@.str.5 = [7 x i8] c"UX:cat\00"
@.str.6 = [15 x i8] c"invalid syntax\00"
@.str.7 = [16 x i8] c"refer to manual\00"
@.str.8 = [11 x i8] c"UX:cat:001\00"
@.str.9 = [10 x i8] c"label:foo\00"
@.str.10 = [5 x i8] c"text\00"
@.str.11 = [7 x i8] c"action\00"
@.str.12 = [4 x i8] c"tag\00"
define i32 @main() {
%1 = tail call i32 @addseverity(i32 5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @MM_PRINT
%3 = load i32, i32* @MM_INFO
%4 = tail call i32 @fmtmsg(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%5 = load i32, i32* @MM_PRINT
%6 = tail call i32 @fmtmsg(i32 %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 5, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
%7 = load i32, i32* @MM_PRINT
%8 = tail call i32 @fmtmsg(i32 %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i32 6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
ret i32 0
}