#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
scalar_t__ strcmp(char *, char *);
void main() {
  int x, y, i, j, ast = 0;
  while (1) {
    scanf("%i %i", &x, &y);
    if ((x == 0) && (y == 0))
      return;
    char car[2];
    for (i = 0; i < x; i++)
      for (j = 0; j < y; j++) {
        scanf("%s", car);
        if (strcmp(car, "*") == 0) {
          ast++;
        }
      }
    if (ast == 1) {
      printf("UFA!\n");
    } else {
      printf("%i: MSA\n", ast);
    }
    ast = 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x14(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0x4(%rbp)
jne    116f <main+0x3f>
cmpl   $0x0,-0x8(%rbp)
jne    116f <main+0x3f>
add    $0x20,%rsp
pop    %rbp
ret
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11f0 <main+0xc0>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11dd <main+0xad>
lea    -0x16(%rbp),%rsi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    -0x16(%rbp),%rdi
lea    0xe57(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ca <main+0x9a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11cf <main+0x9f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1189 <main+0x59>
jmp    11e2 <main+0xb2>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1176 <main+0x46>
cmpl   $0x1,-0x14(%rbp)
jne    120d <main+0xdd>
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121e <main+0xee>
mov    -0x14(%rbp),%esi
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
jmp    113f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeab(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%eax
mov    %ecx,%edx
or     %eax,%edx
jne    1183 <main+0x43>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe7c(%rip),%r14
lea    0x16(%rsp),%rbx
lea    0xe73(%rip),%r15
jmp    11d7 <main+0x97>
nopl   0x0(%rax,%rax,1)
lea    0xe64(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe48(%rip),%rdi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%eax
mov    %ecx,%edx
or     %eax,%edx
je     1174 <main+0x34>
mov    $0x0,%r13d
test   %ecx,%ecx
jle    11a0 <main+0x60>
xor    %r13d,%r13d
xor    %ebp,%ebp
jmp    11f7 <main+0xb7>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    %ecx,%ebp
jge    1240 <main+0x100>
test   %eax,%eax
jle    11f0 <main+0xb0>
xor    %r12d,%r12d
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
cmp    $0x1,%rax
adc    $0x0,%r13d
add    $0x1,%r12d
mov    0xc(%rsp),%eax
cmp    %eax,%r12d
jl     1200 <main+0xc0>
mov    0x10(%rsp),%ecx
jmp    11f0 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x1,%r13d
jne    11a0 <main+0x60>
lea    0xdc3(%rip),%rdi
call   1030 <puts@plt>
jmp    11b1 <main+0x71>

LLVM IR (-O0):
@.str = [6 x i8] c"%i %i\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"*\00"
@.str.3 = [6 x i8] c"UFA!\0A\00"
@.str.4 = [9 x i8] c"%i: MSA\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [2 x i8]
store i32 0, i32* %5
br label %7
7: ; preds = %0, %50
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11
ret void
15: ; preds = %11, %7
store i32 0, i32* %3
br label %16
16: ; preds = %39, %15
%17 = load i32, i32* %3
%18 = load i32, i32* %1
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %42
20: ; preds = %16
store i32 0, i32* %4
br label %21
21: ; preds = %35, %20
%22 = load i32, i32* %4
%23 = load i32, i32* %2
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %38
25: ; preds = %21
%26 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %34
34: ; preds = %31, %25
br label %35
35: ; preds = %34
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %21
38: ; preds = %21
br label %39
39: ; preds = %38
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %16
42: ; preds = %16
%43 = load i32, i32* %5
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %47
45: ; preds = %42
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %50
47: ; preds = %42
%48 = load i32, i32* %5
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %47, %45
store i32 0, i32* %5
br label %7
}

LLVM IR (-O2):
@.str = [6 x i8] c"%i %i\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"*\00"
@.str.4 = [9 x i8] c"%i: MSA\0A\00"
@str = [5 x i8] c"UFA!\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [2 x i8]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 0
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %14, label %12
12: ; preds = %0
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
br label %15
14: ; preds = %51, %0
ret void
15: ; preds = %12, %51
%16 = phi i32 [ %9, %12 ], [ %55, %51 ]
%17 = phi i32 [ %7, %12 ], [ %53, %51 ]
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %48
19: ; preds = %15, %38
%20 = phi i32 [ %39, %38 ], [ %17, %15 ]
%21 = phi i32 [ %40, %38 ], [ %16, %15 ]
%22 = phi i32 [ %41, %38 ], [ 0, %15 ]
%23 = phi i32 [ %42, %38 ], [ 0, %15 ]
%24 = icmp sgt i32 %21, 0
br i1 %24, label %25, label %38
25: ; preds = %19, %25
%26 = phi i32 [ %32, %25 ], [ %22, %19 ]
%27 = phi i32 [ %33, %25 ], [ 0, %19 ]
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%29 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
%31 = zext i1 %30 to i32
%32 = add nsw i32 %26, %31
%33 = add nuw nsw i32 %27, 1
%34 = load i32, i32* %2
%35 = icmp slt i32 %33, %34
br i1 %35, label %25, label %36
36: ; preds = %25
%37 = load i32, i32* %1
br label %38
38: ; preds = %36, %19
%39 = phi i32 [ %20, %19 ], [ %37, %36 ]
%40 = phi i32 [ %21, %19 ], [ %34, %36 ]
%41 = phi i32 [ %22, %19 ], [ %32, %36 ]
%42 = add nuw nsw i32 %23, 1
%43 = icmp slt i32 %42, %39
br i1 %43, label %19, label %44
44: ; preds = %38
%45 = icmp eq i32 %41, 1
br i1 %45, label %46, label %48
46: ; preds = %44
%47 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %51
48: ; preds = %15, %44
%49 = phi i32 [ %41, %44 ], [ 0, %15 ]
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %48, %46
%52 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%53 = load i32, i32* %1
%54 = icmp eq i32 %53, 0
%55 = load i32, i32* %2
%56 = icmp eq i32 %55, 0
%57 = select i1 %54, i1 %56, i1 false
br i1 %57, label %14, label %15
}