#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*/ puts(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  char buf[80];
  int i;
  int lost = 0;
  scanf("%2s", buf);
  lost |= (buf[0] != 'X' || buf[1] != 'Y' || buf[2] != '\0');
  if (lost)
    puts("test of %2s failed.");
  scanf(" ");
  scanf("%d", &i);
  lost |= (i != 1234);
  if (lost)
    puts("test of %d failed.");
  scanf("%c", buf);
  lost |= (buf[0] != 'L');
  if (lost)
    puts("test of %c failed.\n");
  puts(lost ? "Test FAILED!" : "Test succeeded.");
  return lost;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x68(%rbp)
lea    -0x60(%rbp),%rsi
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x60(%rbp),%ecx
mov    $0x1,%al
cmp    $0x58,%ecx
mov    %al,-0x69(%rbp)
jne    1179 <main+0x59>
movsbl -0x5f(%rbp),%ecx
mov    $0x1,%al
cmp    $0x59,%ecx
mov    %al,-0x69(%rbp)
jne    1179 <main+0x59>
movsbl -0x5e(%rbp),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x69(%rbp)
mov    -0x69(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
or     -0x68(%rbp),%eax
mov    %eax,-0x68(%rbp)
cmpl   $0x0,-0x68(%rbp)
je     119d <main+0x7d>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe68(%rip),%rdi
lea    -0x64(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x4d2,-0x64(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
or     -0x68(%rbp),%eax
mov    %eax,-0x68(%rbp)
cmpl   $0x0,-0x68(%rbp)
je     11e8 <main+0xc8>
lea    0xe3a(%rip),%rdi
call   1030 <puts@plt>
lea    -0x60(%rbp),%rsi
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x60(%rbp),%eax
cmp    $0x4c,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
or     -0x68(%rbp),%eax
mov    %eax,-0x68(%rbp)
cmpl   $0x0,-0x68(%rbp)
je     1225 <main+0x105>
lea    0xe13(%rip),%rdi
call   1030 <puts@plt>
mov    -0x68(%rbp),%ecx
lea    0xe25(%rip),%rdi
lea    0xe11(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
call   1030 <puts@plt>
mov    -0x68(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0xed4(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%al
mov    0x11(%rsp),%cl
xor    $0x58,%al
xor    $0x59,%cl
or     %al,%cl
or     0x12(%rsp),%cl
setne  %bl
je     115c <main+0x3c>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xea9(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x4d2,0xc(%rsp)
setne  %al
or     %al,%bl
cmp    $0x1,%bl
jne    119b <main+0x7b>
lea    0xe87(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8e(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpb   $0x4c,0x10(%rsp)
setne  %al
or     %al,%bl
cmp    $0x1,%bl
jne    11d2 <main+0xb2>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe77(%rip),%rdi
jmp    11d9 <main+0xb9>
lea    0xe7b(%rip),%rdi
movzbl %bl,%ebx
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%2s\00"
@.str.1 = [20 x i8] c"test of %2s failed.\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [19 x i8] c"test of %d failed.\00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [20 x i8] c"test of %c failed.\0A\00"
@.str.7 = [13 x i8] c"Test FAILED!\00"
@.str.8 = [16 x i8] c"Test succeeded.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 88
br i1 %10, label %21, label %11
11: ; preds = %0
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 1
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 89
br i1 %15, label %21, label %16
16: ; preds = %11
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 2
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 0
br label %21
21: ; preds = %16, %11, %0
%22 = phi i1 [ true, %11 ], [ true, %0 ], [ %20, %16 ]
%23 = zext i1 %22 to i32
%24 = load i32, i32* %4
%25 = or i32 %24, %23
store i32 %25, i32* %4
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %21
%29 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28, %21
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%33 = load i32, i32* %3
%34 = icmp ne i32 %33, 1234
%35 = zext i1 %34 to i32
%36 = load i32, i32* %4
%37 = or i32 %36, %35
store i32 %37, i32* %4
%38 = load i32, i32* %4
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %30
%41 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %42
42: ; preds = %40, %30
%43 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%44 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %43)
%45 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 76
%49 = zext i1 %48 to i32
%50 = load i32, i32* %4
%51 = or i32 %50, %49
store i32 %51, i32* %4
%52 = load i32, i32* %4
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %42
%55 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %56
56: ; preds = %54, %42
%57 = load i32, i32* %4
%58 = icmp ne i32 %57, 0
%59 = zext i1 %58 to i64
%60 = select i1 %58, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0)
%61 = call i32 @puts(i8* %60)
%62 = load i32, i32* %4
ret i32 %62
}

LLVM IR (-O2):
@.str = [4 x i8] c"%2s\00"
@.str.1 = [20 x i8] c"test of %2s failed.\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [19 x i8] c"test of %d failed.\00"
@.str.5 = [3 x i8] c"%c\00"
@.str.6 = [20 x i8] c"test of %c failed.\0A\00"
@.str.7 = [13 x i8] c"Test FAILED!\00"
@.str.8 = [16 x i8] c"Test succeeded.\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = load i8, i8* %3
%7 = icmp ne i8 %6, 88
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 1
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 89
%11 = select i1 %7, i1 true, i1 %10
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 2
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
%15 = select i1 %11, i1 true, i1 %14
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %0, %16
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%21 = load i32, i32* %2
%22 = icmp ne i32 %21, 1234
%23 = or i1 %15, %22
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %26
26: ; preds = %24, %18
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%28 = load i8, i8* %3
%29 = icmp ne i8 %28, 76
%30 = or i1 %23, %29
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
br label %33
33: ; preds = %31, %26
%34 = phi i8* [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), %31 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), %26 ]
%35 = zext i1 %30 to i32
%36 = call i32 @puts(i8* dereferenceable(1) %34)
ret i32 %35
}