#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 */
struct compiler {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ activate_current_message_save();
int /*<<< orphan*/ clear_messages();
int /*<<< orphan*/ error_msg(char *, char const *);
struct compiler *find_compiler(char const *);
scalar_t__ message_count();
int /*<<< orphan*/ spawn_compiler(char **, unsigned int, struct compiler *);
void cmd_compile(const char *pf, char **args) {
  struct compiler *c;
  unsigned int flags = 0;
  const char *name;
  while (*pf) {
    switch (*pf) {
    case '1':
      flags |= (1 << 0);
      break;
    case 'p':
      flags |= (1 << 4);
      break;
    case 's':
      flags |= (1 << 2);
      break;
    }
    pf++;
  }
  name = *args++;
  c = find_compiler(name);
  if (!c) {
    error_msg("No such error parser %s", name);
    return;
  }
  clear_messages();
  spawn_compiler(args, flags, c);
  if (message_count())
    activate_current_message_save();
}


x86 assembly (clang, -O0):
<cmd_compile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11f4 <cmd_compile+0x94>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x31,%eax
je     11be <cmd_compile+0x5e>
jmp    119c <cmd_compile+0x3c>
mov    -0x2c(%rbp),%eax
sub    $0x70,%eax
je     11cc <cmd_compile+0x6c>
jmp    11ad <cmd_compile+0x4d>
mov    -0x2c(%rbp),%eax
sub    $0x73,%eax
je     11da <cmd_compile+0x7a>
jmp    11e3 <cmd_compile+0x83>
mov    -0x1c(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e3 <cmd_compile+0x83>
mov    -0x1c(%rbp),%eax
or     $0x10,%eax
mov    %eax,-0x1c(%rbp)
jmp    11e3 <cmd_compile+0x83>
mov    -0x1c(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1177 <cmd_compile+0x17>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1040 <find_compiler@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1237 <cmd_compile+0xd7>
mov    -0x28(%rbp),%rsi
lea    0xdd3(%rip),%rdi
call   1030 <error_msg@plt>
jmp    1266 <cmd_compile+0x106>
mov    $0x0,%al
call   1060 <clear_messages@plt>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1070 <spawn_compiler@plt>
mov    $0x0,%al
call   1080 <message_count@plt>
cmp    $0x0,%rax
je     1266 <cmd_compile+0x106>
mov    $0x0,%al
call   1050 <activate_current_message_save@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_compile>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    (%rdi),%al
test   %al,%al
je     11b5 <cmd_compile+0x55>
add    $0x1,%rdi
xor    %ebp,%ebp
jmp    118e <cmd_compile+0x2e>
nopl   0x0(%rax,%rax,1)
or     $0x4,%ebp
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
je     11b7 <cmd_compile+0x57>
movsbl %al,%eax
cmp    $0x73,%eax
je     1180 <cmd_compile+0x20>
cmp    $0x70,%eax
je     11b0 <cmd_compile+0x50>
cmp    $0x31,%eax
jne    1183 <cmd_compile+0x23>
or     $0x1,%ebp
jmp    1183 <cmd_compile+0x23>
cs nopw 0x0(%rax,%rax,1)
nop
or     $0x10,%ebp
jmp    1183 <cmd_compile+0x23>
xor    %ebp,%ebp
mov    (%r14),%rbx
mov    %rbx,%rdi
call   1040 <find_compiler@plt>
test   %rax,%rax
je     11ff <cmd_compile+0x9f>
mov    %rax,%r15
add    $0x8,%r14
xor    %eax,%eax
call   1060 <clear_messages@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r15,%rdx
call   1070 <spawn_compiler@plt>
xor    %eax,%eax
call   1080 <message_count@plt>
test   %rax,%rax
je     1218 <cmd_compile+0xb8>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <activate_current_message_save@plt>
lea    0xdfa(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <error_msg@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.compiler = type { i32 }
@.str = [24 x i8] c"No such error parser %s\00"
define void @cmd_compile(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca %struct.compiler*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %3
store i8** %1, i8*** %4
store i32 0, i32* %6
br label %8
8: ; preds = %25, %2
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %28
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
switch i32 %15, label %25 [
i32 49, label %16
i32 112, label %19
i32 115, label %22
]
16: ; preds = %12
%17 = load i32, i32* %6
%18 = or i32 %17, 1
store i32 %18, i32* %6
br label %25
19: ; preds = %12
%20 = load i32, i32* %6
%21 = or i32 %20, 16
store i32 %21, i32* %6
br label %25
22: ; preds = %12
%23 = load i32, i32* %6
%24 = or i32 %23, 4
store i32 %24, i32* %6
br label %25
25: ; preds = %12, %22, %19, %16
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %3
br label %8
28: ; preds = %8
%29 = load i8**, i8*** %4
%30 = getelementptr inbounds i8*, i8** %29, i32 1
store i8** %30, i8*** %4
%31 = load i8*, i8** %29
store i8* %31, i8** %7
%32 = load i8*, i8** %7
%33 = call %struct.compiler* @find_compiler(i8* %32)
store %struct.compiler* %33, %struct.compiler** %5
%34 = load %struct.compiler*, %struct.compiler** %5
%35 = icmp ne %struct.compiler* %34, null
br i1 %35, label %39, label %36
36: ; preds = %28
%37 = load i8*, i8** %7
%38 = call i32 @error_msg(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %37)
br label %49
39: ; preds = %28
%40 = call i32 (...) @clear_messages()
%41 = load i8**, i8*** %4
%42 = load i32, i32* %6
%43 = load %struct.compiler*, %struct.compiler** %5
%44 = call i32 @spawn_compiler(i8** %41, i32 %42, %struct.compiler* %43)
%45 = call i64 (...) @message_count()
%46 = icmp ne i64 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %39
%48 = call i32 (...) @activate_current_message_save()
br label %49
49: ; preds = %36, %47, %39
ret void
}

LLVM IR (-O2):
%struct.compiler = type { i32 }
@.str = [24 x i8] c"No such error parser %s\00"
define void @cmd_compile(i8* nocapture %0, i8** %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %21, label %5
5: ; preds = %2, %16
%6 = phi i8 [ %19, %16 ], [ %3, %2 ]
%7 = phi i8* [ %18, %16 ], [ %0, %2 ]
%8 = phi i32 [ %17, %16 ], [ 0, %2 ]
%9 = sext i8 %6 to i32
switch i32 %9, label %16 [
i32 49, label %10
i32 112, label %12
i32 115, label %14
]
10: ; preds = %5
%11 = or i32 %8, 1
br label %16
12: ; preds = %5
%13 = or i32 %8, 16
br label %16
14: ; preds = %5
%15 = or i32 %8, 4
br label %16
16: ; preds = %5, %14, %12, %10
%17 = phi i32 [ %8, %5 ], [ %15, %14 ], [ %13, %12 ], [ %11, %10 ]
%18 = getelementptr inbounds i8, i8* %7, i64 1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %5
21: ; preds = %16, %2
%22 = phi i32 [ 0, %2 ], [ %17, %16 ]
%23 = load i8*, i8** %1
%24 = tail call %struct.compiler* @find_compiler(i8* %23)
%25 = icmp eq %struct.compiler* %24, null
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = tail call i32 @error_msg(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %23)
br label %36
28: ; preds = %21
%29 = getelementptr inbounds i8*, i8** %1, i64 1
%30 = tail call i32 (...) @clear_messages()
%31 = tail call i32 @spawn_compiler(i8** %29, i32 %22, %struct.compiler* %24)
%32 = tail call i64 (...) @message_count()
%33 = icmp eq i64 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %28
%35 = tail call i32 (...) @activate_current_message_save()
br label %36
36: ; preds = %28, %34, %26
ret void
}