#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 */
scalar_t__ check(long);
char getchar();
int /*<<< orphan*/ getstr(long);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, long *);
int main() {
  char ch;
  long int n;
  scanf("%ld", &n);
  while (n != 0) {
    ch = getchar();
    getstr(n);
    if (check(n))
      puts("ambiguous");
    else
      puts("not ambiguous");
    scanf("%ld", &n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
je     11d2 <main+0x82>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x5(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getstr@plt>
mov    -0x10(%rbp),%rdi
call   1070 <check@plt>
cmp    $0x0,%rax
je     11b1 <main+0x61>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
jmp    11bd <main+0x6d>
lea    0xe4c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe3c(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1060 <scanf@plt>
jmp    116f <main+0x1f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xea1(%rip),%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
cmpq   $0x0,(%rsp)
je     11ca <main+0x7a>
lea    0xe8f(%rip),%r15
lea    0xe8c(%rip),%r12
lea    0xe7d(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    (%rsp),%rdi
call   1040 <getstr@plt>
mov    (%rsp),%rdi
call   1070 <check@plt>
test   %rax,%rax
mov    %r12,%rdi
cmove  %r15,%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
cmpq   $0x0,(%rsp)
jne    1190 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [10 x i8] c"ambiguous\00"
@.str.2 = [14 x i8] c"not ambiguous\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i64
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
br label %5
5: ; preds = %19, %0
%6 = load i64, i64* %3
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %5
%9 = call signext i8 (...) @getchar()
store i8 %9, i8* %2
%10 = load i64, i64* %3
%11 = call i32 @getstr(i64 %10)
%12 = load i64, i64* %3
%13 = call i64 @check(i64 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %8
%16 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %19
17: ; preds = %8
%18 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
%20 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %3)
br label %5
21: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%ld\00"
@.str.1 = [10 x i8] c"ambiguous\00"
@.str.2 = [14 x i8] c"not ambiguous\00"
define i32 @main() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%4 = load i64, i64* %1
%5 = icmp eq i64 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %0, %6
%7 = call signext i8 (...) @getchar()
%8 = load i64, i64* %1
%9 = call i32 @getstr(i64 %8)
%10 = load i64, i64* %1
%11 = call i64 @check(i64 %10)
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0)
%14 = call i32 @puts(i8* dereferenceable(1) %13)
%15 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %1)
%16 = load i64, i64* %1
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %6
18: ; preds = %6, %0
ret i32 0
}