#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_ERROR;
int MM_HALT;
int MM_INFO;
int MM_NOSEV;
scalar_t__ MM_NOTOK;
scalar_t__ MM_OK;
int /*<<< orphan*/ MM_PRINT;
int MM_WARNING;
scalar_t__ addseverity(int, char *);
scalar_t__ fmtmsg(int /*<<< orphan*/, char *, int, char *, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ mtrace();
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strdup(char *);
int main(void) {
  int result = 0;
  mtrace();
  char TEST[] = "ABCD";
  if (addseverity(10, TEST) != MM_OK) {
    puts("addseverity failed");
    result = 1;
  }
  strcpy(TEST, "TEST");
  if (fmtmsg(MM_PRINT, "GLIBC:tst-fmtmsg", MM_HALT, "halt",
             "should print message for MM_HALT", "GLIBC:tst-fmtmsg:1") != MM_OK)
    result = 1;
  if (fmtmsg(MM_PRINT, "GLIBC:tst-fmtmsg", MM_ERROR, "halt",
             "should print message for MM_ERROR",
             "GLIBC:tst-fmtmsg:2") != MM_OK)
    result = 1;
  if (fmtmsg(MM_PRINT, "GLIBC:tst-fmtmsg", MM_WARNING, "halt",
             "should print message for MM_WARNING",
             "GLIBC:tst-fmtmsg:3") != MM_OK)
    result = 1;
  if (fmtmsg(MM_PRINT, "GLIBC:tst-fmtmsg", MM_INFO, "halt",
             "should print message for MM_INFO", "GLIBC:tst-fmtmsg:4") != MM_OK)
    result = 1;
  if (fmtmsg(MM_PRINT, "GLIBC:tst-fmtmsg", MM_NOSEV, "halt",
             "should print message for MM_NOSEV",
             "GLIBC:tst-fmtmsg:5") != MM_OK)
    result = 1;
  if (fmtmsg(MM_PRINT, "GLIBC:tst-fmtmsg", 10, "halt",
             "should print message for MM_TEST", "GLIBC:tst-fmtmsg:6") != MM_OK)
    result = 1;
  if (addseverity(10, NULL) != MM_OK) {
    puts("second addseverity failed");
    result = 1;
  }
  if (addseverity(10, NULL) != MM_NOTOK) {
    puts("third addseverity unexpectedly succeeded");
    result = 1;
  }
  char *p = strdup("TEST2");
  if (addseverity(10, p) != MM_OK) {
    puts("fourth addseverity failed");
    result = 1;
  }
  if (addseverity(10, "TEST3") != MM_OK) {
    puts("fifth addseverity failed");
    result = 1;
  }
  free(p);
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1070 <mtrace@plt>
mov    0xe6d(%rip),%eax
mov    %eax,-0xd(%rbp)
mov    0xe68(%rip),%al
mov    %al,-0x9(%rbp)
lea    -0xd(%rbp),%rsi
mov    $0xa,%edi
call   1080 <addseverity@plt>
mov    0x2dec(%rip),%rcx
cmp    (%rcx),%rax
je     11d0 <main+0x60>
lea    0xf9b(%rip),%rdi
call   1050 <puts@plt>
movl   $0x1,-0x8(%rbp)
lea    -0xd(%rbp),%rdi
lea    0xf65(%rip),%rsi
call   1040 <strcpy@plt>
mov    0x2e01(%rip),%rax
mov    (%rax),%edi
mov    0x2dc0(%rip),%rax
mov    (%rax),%edx
lea    0xe0c(%rip),%rsi
lea    0xe16(%rip),%rcx
lea    0xe14(%rip),%r8
lea    0xe2e(%rip),%r9
call   1060 <fmtmsg@plt>
mov    0x2d86(%rip),%rcx
cmp    (%rcx),%rax
je     122a <main+0xba>
movl   $0x1,-0x8(%rbp)
mov    0x2db7(%rip),%rax
mov    (%rax),%edi
mov    0x2d6e(%rip),%rax
mov    (%rax),%edx
lea    0xdc2(%rip),%rsi
lea    0xdcc(%rip),%rcx
lea    0xdfe(%rip),%r8
lea    0xe19(%rip),%r9
call   1060 <fmtmsg@plt>
mov    0x2d3c(%rip),%rcx
cmp    (%rcx),%rax
je     1274 <main+0x104>
movl   $0x1,-0x8(%rbp)
mov    0x2d6d(%rip),%rax
mov    (%rax),%edi
mov    0x2d4c(%rip),%rax
mov    (%rax),%edx
lea    0xd78(%rip),%rsi
lea    0xd82(%rip),%rcx
lea    0xde9(%rip),%r8
lea    0xe06(%rip),%r9
call   1060 <fmtmsg@plt>
mov    0x2cf2(%rip),%rcx
cmp    (%rcx),%rax
je     12be <main+0x14e>
movl   $0x1,-0x8(%rbp)
mov    0x2d23(%rip),%rax
mov    (%rax),%edi
mov    0x2d12(%rip),%rax
mov    (%rax),%edx
lea    0xd2e(%rip),%rsi
lea    0xd38(%rip),%rcx
lea    0xdd6(%rip),%r8
lea    0xdf0(%rip),%r9
call   1060 <fmtmsg@plt>
mov    0x2ca8(%rip),%rcx
cmp    (%rcx),%rax
je     1308 <main+0x198>
movl   $0x1,-0x8(%rbp)
mov    0x2cd9(%rip),%rax
mov    (%rax),%edi
mov    0x2cc0(%rip),%rax
mov    (%rax),%edx
lea    0xce4(%rip),%rsi
lea    0xcee(%rip),%rcx
lea    0xdc0(%rip),%r8
lea    0xddb(%rip),%r9
call   1060 <fmtmsg@plt>
mov    0x2c5e(%rip),%rcx
cmp    (%rcx),%rax
je     1352 <main+0x1e2>
movl   $0x1,-0x8(%rbp)
mov    0x2c8f(%rip),%rax
mov    (%rax),%edi
lea    0xca3(%rip),%rsi
mov    $0xa,%edx
lea    0xca8(%rip),%rcx
lea    0xdaf(%rip),%r8
lea    0xdc9(%rip),%r9
call   1060 <fmtmsg@plt>
mov    0x2c18(%rip),%rcx
cmp    (%rcx),%rax
je     1398 <main+0x228>
movl   $0x1,-0x8(%rbp)
mov    $0xa,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <addseverity@plt>
mov    0x2bf3(%rip),%rcx
cmp    (%rcx),%rax
je     13c9 <main+0x259>
lea    0xd9b(%rip),%rdi
call   1050 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    $0xa,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <addseverity@plt>
mov    0x2be2(%rip),%rcx
cmp    (%rcx),%rax
je     13fa <main+0x28a>
lea    0xd84(%rip),%rdi
call   1050 <puts@plt>
movl   $0x1,-0x8(%rbp)
lea    0xd9a(%rip),%rdi
call   1090 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0xa,%edi
call   1080 <addseverity@plt>
mov    0x2b81(%rip),%rcx
cmp    (%rcx),%rax
je     143b <main+0x2cb>
lea    0xd72(%rip),%rdi
call   1050 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    $0xa,%edi
lea    0xd74(%rip),%rsi
call   1080 <addseverity@plt>
mov    0x2b4d(%rip),%rcx
cmp    (%rcx),%rax
je     146f <main+0x2ff>
lea    0xd5e(%rip),%rdi
call   1050 <puts@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <mtrace@plt>
movb   $0x0,0x10(%rsp)
movl   $0x44434241,0xc(%rsp)
44
lea    0xc(%rsp),%rsi
mov    $0xa,%edi
call   1080 <addseverity@plt>
mov    0x2df6(%rip),%r13
cmp    0x0(%r13),%rax
je     11c1 <main+0x51>
lea    0xfa8(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,0x14(%rsp)
lea    0xf74(%rip),%rsi
lea    0xc(%rsp),%rdi
call   1040 <strcpy@plt>
mov    0x2e0b(%rip),%r14
mov    (%r14),%edi
mov    0x2dc9(%rip),%rax
mov    (%rax),%edx
lea    0xe15(%rip),%r12
lea    0xe1f(%rip),%r15
lea    0xe1d(%rip),%r8
lea    0xe37(%rip),%r9
mov    %r12,%rsi
mov    %r15,%rcx
call   1060 <fmtmsg@plt>
mov    %rax,%rbx
xor    0x0(%r13),%rbx
mov    (%r14),%edi
mov    0x2d87(%rip),%rax
mov    (%rax),%edx
lea    0xe25(%rip),%r8
lea    0xe40(%rip),%r9
mov    %r12,%rsi
mov    %r15,%rcx
call   1060 <fmtmsg@plt>
mov    %rax,%rbp
xor    0x0(%r13),%rbp
or     %rbx,%rbp
mov    (%r14),%edi
mov    0x2d80(%rip),%rax
mov    (%rax),%edx
lea    0xe2b(%rip),%r8
lea    0xe48(%rip),%r9
mov    %r12,%rsi
mov    %r15,%rbx
mov    %r15,%rcx
call   1060 <fmtmsg@plt>
mov    %r13,%r15
mov    %rax,%r13
xor    (%r15),%r13
mov    (%r14),%edi
mov    0x2d5f(%rip),%rax
mov    (%rax),%edx
lea    0xe31(%rip),%r8
lea    0xe4b(%rip),%r9
mov    %r12,%rsi
mov    %rbx,%rcx
call   1060 <fmtmsg@plt>
mov    %rax,%rbx
xor    (%r15),%rbx
or     %r13,%rbx
mov    %r15,%r13
or     %rbp,%rbx
mov    (%r14),%edi
mov    0x2d23(%rip),%rax
mov    (%rax),%edx
lea    0xe31(%rip),%r8
lea    0xe4c(%rip),%r9
mov    %r12,%rsi
lea    0xd47(%rip),%r15
mov    %r15,%rcx
call   1060 <fmtmsg@plt>
mov    %rax,%rbp
xor    0x0(%r13),%rbp
mov    (%r14),%edi
lea    0xe3c(%rip),%r8
lea    0xe56(%rip),%r9
mov    %r12,%rsi
mov    $0xa,%edx
mov    %r15,%rcx
call   1060 <fmtmsg@plt>
xor    0x0(%r13),%rax
or     %rbp,%rax
mov    0x14(%rsp),%ebp
or     %rbx,%rax
mov    $0x1,%eax
cmovne %eax,%ebp
mov    $0xa,%edi
xor    %esi,%esi
call   1080 <addseverity@plt>
cmp    0x0(%r13),%rax
je     1338 <main+0x1c8>
lea    0xe2a(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebp
mov    $0xa,%edi
xor    %esi,%esi
call   1080 <addseverity@plt>
mov    0x2c75(%rip),%rcx
cmp    (%rcx),%rax
je     1361 <main+0x1f1>
lea    0xe1b(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebp
lea    0xe33(%rip),%rdi
call   1090 <strdup@plt>
mov    %rax,%rbx
mov    $0xa,%edi
mov    %rax,%rsi
call   1080 <addseverity@plt>
cmp    0x0(%r13),%rax
je     1394 <main+0x224>
lea    0xe17(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebp
lea    0xe20(%rip),%rsi
mov    $0xa,%edi
call   1080 <addseverity@plt>
cmp    0x0(%r13),%rax
je     13bc <main+0x24c>
lea    0xe0f(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.TEST = [5 x i8] c"ABCD\00"
@MM_OK = global i64 0
@.str = [19 x i8] c"addseverity failed\00"
@.str.1 = [5 x i8] c"TEST\00"
@MM_PRINT = global i32 0
@.str.2 = [17 x i8] c"GLIBC:tst-fmtmsg\00"
@MM_HALT = global i32 0
@.str.3 = [5 x i8] c"halt\00"
@.str.4 = [33 x i8] c"should print message for MM_HALT\00"
@.str.5 = [19 x i8] c"GLIBC:tst-fmtmsg:1\00"
@MM_ERROR = global i32 0
@.str.6 = [34 x i8] c"should print message for MM_ERROR\00"
@.str.7 = [19 x i8] c"GLIBC:tst-fmtmsg:2\00"
@MM_WARNING = global i32 0
@.str.8 = [36 x i8] c"should print message for MM_WARNING\00"
@.str.9 = [19 x i8] c"GLIBC:tst-fmtmsg:3\00"
@MM_INFO = global i32 0
@.str.10 = [33 x i8] c"should print message for MM_INFO\00"
@.str.11 = [19 x i8] c"GLIBC:tst-fmtmsg:4\00"
@MM_NOSEV = global i32 0
@.str.12 = [34 x i8] c"should print message for MM_NOSEV\00"
@.str.13 = [19 x i8] c"GLIBC:tst-fmtmsg:5\00"
@.str.14 = [33 x i8] c"should print message for MM_TEST\00"
@.str.15 = [19 x i8] c"GLIBC:tst-fmtmsg:6\00"
@.str.16 = [26 x i8] c"second addseverity failed\00"
@MM_NOTOK = global i64 0
@.str.17 = [41 x i8] c"third addseverity unexpectedly succeeded\00"
@.str.18 = [6 x i8] c"TEST2\00"
@.str.19 = [26 x i8] c"fourth addseverity failed\00"
@.str.20 = [6 x i8] c"TEST3\00"
@.str.21 = [25 x i8] c"fifth addseverity failed\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x i8]
%4 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %2
%5 = call i32 (...) @mtrace()
%6 = bitcast [5 x i8]* %3 to i8*
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%8 = call i64 @addseverity(i32 10, i8* %7)
%9 = load i64, i64* @MM_OK
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %13
13: ; preds = %11, %0
%14 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%15 = call i32 @strcpy(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32, i32* @MM_PRINT
%17 = load i32, i32* @MM_HALT
%18 = call i64 @fmtmsg(i32 %16, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%19 = load i64, i64* @MM_OK
%20 = icmp ne i64 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %13
store i32 1, i32* %2
br label %22
22: ; preds = %21, %13
%23 = load i32, i32* @MM_PRINT
%24 = load i32, i32* @MM_ERROR
%25 = call i64 @fmtmsg(i32 %23, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%26 = load i64, i64* @MM_OK
%27 = icmp ne i64 %25, %26
br i1 %27, label %28, label %29
28: ; preds = %22
store i32 1, i32* %2
br label %29
29: ; preds = %28, %22
%30 = load i32, i32* @MM_PRINT
%31 = load i32, i32* @MM_WARNING
%32 = call i64 @fmtmsg(i32 %30, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%33 = load i64, i64* @MM_OK
%34 = icmp ne i64 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %29
store i32 1, i32* %2
br label %36
36: ; preds = %35, %29
%37 = load i32, i32* @MM_PRINT
%38 = load i32, i32* @MM_INFO
%39 = call i64 @fmtmsg(i32 %37, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
%40 = load i64, i64* @MM_OK
%41 = icmp ne i64 %39, %40
br i1 %41, label %42, label %43
42: ; preds = %36
store i32 1, i32* %2
br label %43
43: ; preds = %42, %36
%44 = load i32, i32* @MM_PRINT
%45 = load i32, i32* @MM_NOSEV
%46 = call i64 @fmtmsg(i32 %44, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
%47 = load i64, i64* @MM_OK
%48 = icmp ne i64 %46, %47
br i1 %48, label %49, label %50
49: ; preds = %43
store i32 1, i32* %2
br label %50
50: ; preds = %49, %43
%51 = load i32, i32* @MM_PRINT
%52 = call i64 @fmtmsg(i32 %51, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0))
%53 = load i64, i64* @MM_OK
%54 = icmp ne i64 %52, %53
br i1 %54, label %55, label %56
55: ; preds = %50
store i32 1, i32* %2
br label %56
56: ; preds = %55, %50
%57 = call i64 @addseverity(i32 10, i8* null)
%58 = load i64, i64* @MM_OK
%59 = icmp ne i64 %57, %58
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0))
store i32 1, i32* %2
br label %62
62: ; preds = %60, %56
%63 = call i64 @addseverity(i32 10, i8* null)
%64 = load i64, i64* @MM_NOTOK
%65 = icmp ne i64 %63, %64
br i1 %65, label %66, label %68
66: ; preds = %62
%67 = call i32 @puts(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.17, i64 0, i64 0))
store i32 1, i32* %2
br label %68
68: ; preds = %66, %62
%69 = call i8* @strdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0))
store i8* %69, i8** %4
%70 = load i8*, i8** %4
%71 = call i64 @addseverity(i32 10, i8* %70)
%72 = load i64, i64* @MM_OK
%73 = icmp ne i64 %71, %72
br i1 %73, label %74, label %76
74: ; preds = %68
%75 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0))
store i32 1, i32* %2
br label %76
76: ; preds = %74, %68
%77 = call i64 @addseverity(i32 10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0))
%78 = load i64, i64* @MM_OK
%79 = icmp ne i64 %77, %78
br i1 %79, label %80, label %82
80: ; preds = %76
%81 = call i32 @puts(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.21, i64 0, i64 0))
store i32 1, i32* %2
br label %82
82: ; preds = %80, %76
%83 = load i8*, i8** %4
%84 = call i32 @free(i8* %83)
%85 = load i32, i32* %2
ret i32 %85
}

LLVM IR (-O2):
@__const.main.TEST = [5 x i8] c"ABCD\00"
@MM_OK = global i64 0
@.str = [19 x i8] c"addseverity failed\00"
@.str.1 = [5 x i8] c"TEST\00"
@MM_PRINT = global i32 0
@.str.2 = [17 x i8] c"GLIBC:tst-fmtmsg\00"
@MM_HALT = global i32 0
@.str.3 = [5 x i8] c"halt\00"
@.str.4 = [33 x i8] c"should print message for MM_HALT\00"
@.str.5 = [19 x i8] c"GLIBC:tst-fmtmsg:1\00"
@MM_ERROR = global i32 0
@.str.6 = [34 x i8] c"should print message for MM_ERROR\00"
@.str.7 = [19 x i8] c"GLIBC:tst-fmtmsg:2\00"
@MM_WARNING = global i32 0
@.str.8 = [36 x i8] c"should print message for MM_WARNING\00"
@.str.9 = [19 x i8] c"GLIBC:tst-fmtmsg:3\00"
@MM_INFO = global i32 0
@.str.10 = [33 x i8] c"should print message for MM_INFO\00"
@.str.11 = [19 x i8] c"GLIBC:tst-fmtmsg:4\00"
@MM_NOSEV = global i32 0
@.str.12 = [34 x i8] c"should print message for MM_NOSEV\00"
@.str.13 = [19 x i8] c"GLIBC:tst-fmtmsg:5\00"
@.str.14 = [33 x i8] c"should print message for MM_TEST\00"
@.str.15 = [19 x i8] c"GLIBC:tst-fmtmsg:6\00"
@.str.16 = [26 x i8] c"second addseverity failed\00"
@MM_NOTOK = global i64 0
@.str.17 = [41 x i8] c"third addseverity unexpectedly succeeded\00"
@.str.18 = [6 x i8] c"TEST2\00"
@.str.19 = [26 x i8] c"fourth addseverity failed\00"
@.str.20 = [6 x i8] c"TEST3\00"
@.str.21 = [25 x i8] c"fifth addseverity failed\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = tail call i32 (...) @mtrace()
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = call i64 @addseverity(i32 10, i8* %3)
%5 = load i64, i64* @MM_OK
%6 = icmp eq i64 %4, %5
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = phi i32 [ 1, %7 ], [ 0, %0 ]
%11 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* @MM_PRINT
%13 = load i32, i32* @MM_HALT
%14 = call i64 @fmtmsg(i32 %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%15 = load i64, i64* @MM_OK
%16 = icmp eq i64 %14, %15
%17 = load i32, i32* @MM_PRINT
%18 = load i32, i32* @MM_ERROR
%19 = call i64 @fmtmsg(i32 %17, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%20 = load i64, i64* @MM_OK
%21 = icmp eq i64 %19, %20
%22 = load i32, i32* @MM_PRINT
%23 = load i32, i32* @MM_WARNING
%24 = call i64 @fmtmsg(i32 %22, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.9, i64 0, i64 0))
%25 = load i64, i64* @MM_OK
%26 = icmp eq i64 %24, %25
%27 = load i32, i32* @MM_PRINT
%28 = load i32, i32* @MM_INFO
%29 = call i64 @fmtmsg(i32 %27, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %28, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0))
%30 = load i64, i64* @MM_OK
%31 = icmp eq i64 %29, %30
%32 = load i32, i32* @MM_PRINT
%33 = load i32, i32* @MM_NOSEV
%34 = call i64 @fmtmsg(i32 %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
%35 = load i64, i64* @MM_OK
%36 = icmp eq i64 %34, %35
%37 = load i32, i32* @MM_PRINT
%38 = call i64 @fmtmsg(i32 %37, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.15, i64 0, i64 0))
%39 = load i64, i64* @MM_OK
%40 = icmp eq i64 %38, %39
%41 = select i1 %40, i1 %36, i1 false
%42 = select i1 %41, i1 %31, i1 false
%43 = select i1 %42, i1 %26, i1 false
%44 = select i1 %43, i1 %21, i1 false
%45 = select i1 %44, i1 %16, i1 false
%46 = select i1 %45, i32 %10, i32 1
%47 = call i64 @addseverity(i32 10, i8* null)
%48 = load i64, i64* @MM_OK
%49 = icmp eq i64 %47, %48
br i1 %49, label %52, label %50
50: ; preds = %9
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.16, i64 0, i64 0))
br label %52
52: ; preds = %50, %9
%53 = phi i32 [ 1, %50 ], [ %46, %9 ]
%54 = call i64 @addseverity(i32 10, i8* null)
%55 = load i64, i64* @MM_NOTOK
%56 = icmp eq i64 %54, %55
br i1 %56, label %59, label %57
57: ; preds = %52
%58 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.17, i64 0, i64 0))
br label %59
59: ; preds = %57, %52
%60 = phi i32 [ 1, %57 ], [ %53, %52 ]
%61 = call dereferenceable_or_null(6) i8* @strdup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0))
%62 = call i64 @addseverity(i32 10, i8* %61)
%63 = load i64, i64* @MM_OK
%64 = icmp eq i64 %62, %63
br i1 %64, label %67, label %65
65: ; preds = %59
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0))
br label %67
67: ; preds = %65, %59
%68 = phi i32 [ 1, %65 ], [ %60, %59 ]
%69 = call i64 @addseverity(i32 10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.20, i64 0, i64 0))
%70 = load i64, i64* @MM_OK
%71 = icmp eq i64 %69, %70
br i1 %71, label %74, label %72
72: ; preds = %67
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.21, i64 0, i64 0))
br label %74
74: ; preds = %72, %67
%75 = phi i32 [ 1, %72 ], [ %68, %67 ]
%76 = call i32 @free(i8* %61)
ret i32 %75
}