#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 scanf(char *, int *, ...);
int main(int argc, const char *argv[]) {
  int a[101], m, n, i;
  while (scanf("%d%d", &n, &m), n != 0) {
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    printf("%d", a[0]);
    for (i = 1; i < n; i++) {
      printf(" %d", a[i]);
      if (a[i] <= m && a[i + 1] >= m)
        printf(" %d", m);
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec0(%rip),%rdi
lea    -0x1b8(%rbp),%rsi
lea    -0x1b4(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x0,-0x1b8(%rbp)
je     1279 <main+0x159>
movl   $0x0,-0x1bc(%rbp)
mov    -0x1bc(%rbp),%eax
cmp    -0x1b8(%rbp),%eax
jge    11b5 <main+0x95>
movslq -0x1bc(%rbp),%rax
lea    -0x1b0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    116c <main+0x4c>
mov    -0x1b0(%rbp),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x1bc(%rbp)
mov    -0x1bc(%rbp),%eax
cmp    -0x1b8(%rbp),%eax
jge    1266 <main+0x146>
movslq -0x1bc(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x1bc(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%eax
cmp    -0x1b4(%rbp),%eax
jg     124d <main+0x12d>
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x1b0(%rbp,%rax,4),%eax
cmp    -0x1b4(%rbp),%eax
jl     124d <main+0x12d>
mov    -0x1b4(%rbp),%esi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1252 <main+0x132>
mov    -0x1bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1bc(%rbp)
jmp    11d3 <main+0xb3>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1139 <main+0x19>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
lea    0xeb8(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
je     123f <main+0x10f>
lea    0xe9a(%rip),%r12
lea    0xe92(%rip),%r14
lea    0xc(%rsp),%r13
jmp    11ac <main+0x7c>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe6f(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
je     123f <main+0x10f>
test   %eax,%eax
jle    11df <main+0xaf>
lea    0x10(%rsp),%rbp
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%r15
movslq 0x8(%rsp),%rax
add    $0x4,%rbp
cmp    %rax,%r15
jl     11c0 <main+0x90>
mov    0x10(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x2,0x8(%rsp)
jl     1180 <main+0x50>
mov    $0x1,%ebx
jmp    120e <main+0xde>
nopl   0x0(%rax,%rax,1)
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jge    1180 <main+0x50>
mov    %rbx,%rbp
mov    0x10(%rsp,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
add    $0x1,%rbx
cmp    %esi,0x10(%rsp,%rbp,4)
jg     1200 <main+0xd0>
cmp    %esi,0x14(%rsp,%rbp,4)
jl     1200 <main+0xd0>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1200 <main+0xd0>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [101 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %10
10: ; preds = %62, %2
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %8, i32* %7)
%12 = load i32, i32* %8
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %64
14: ; preds = %10
store i32 0, i32* %9
br label %15
15: ; preds = %24, %14
%16 = load i32, i32* %9
%17 = load i32, i32* %8
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [101 x i32], [101 x i32]* %6, i64 0, i64 %21
%23 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
br label %24
24: ; preds = %19
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 1
store i32 %26, i32* %9
br label %15
27: ; preds = %15
%28 = getelementptr inbounds [101 x i32], [101 x i32]* %6, i64 0, i64 0
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %29)
store i32 1, i32* %9
br label %31
31: ; preds = %59, %27
%32 = load i32, i32* %9
%33 = load i32, i32* %8
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %62
35: ; preds = %31
%36 = load i32, i32* %9
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [101 x i32], [101 x i32]* %6, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [101 x i32], [101 x i32]* %6, i64 0, i64 %42
%44 = load i32, i32* %43
%45 = load i32, i32* %7
%46 = icmp sle i32 %44, %45
br i1 %46, label %47, label %58
47: ; preds = %35
%48 = load i32, i32* %9
%49 = add nsw i32 %48, 1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [101 x i32], [101 x i32]* %6, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = load i32, i32* %7
%54 = icmp sge i32 %52, %53
br i1 %54, label %55, label %58
55: ; preds = %47
%56 = load i32, i32* %7
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %56)
br label %58
58: ; preds = %55, %47, %35
br label %59
59: ; preds = %58
%60 = load i32, i32* %9
%61 = add nsw i32 %60, 1
store i32 %61, i32* %9
br label %31
62: ; preds = %31
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %10
64: ; preds = %10
ret i32 0
}

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