#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 */
char getchar();
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ puts(char *);
int main() {
  int i;
  char str[10];
  for (i = 0; i < 10; i++) {
    str[i] = getchar();
    if (str[i] == '#') {
      str[i] = 0;
      break;
    }
  }
  puts(str);
  puts("--------------------------");
  for (i = 0; i < 10; i++)
    printf("%d\t", str[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1194 <main+0x64>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x12(%rbp,%rax,1)
movslq -0x8(%rbp),%rax
movsbl -0x12(%rbp,%rax,1),%eax
cmp    $0x23,%eax
jne    1181 <main+0x51>
movslq -0x8(%rbp),%rax
movb   $0x0,-0x12(%rbp,%rax,1)
jmp    1194 <main+0x64>
jmp    1186 <main+0x56>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
lea    -0x12(%rbp),%rdi
call   1030 <puts@plt>
lea    0xe5c(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11dd <main+0xad>
movslq -0x8(%rbp),%rax
lea    0xe56(%rip),%rdi
movsbl -0x12(%rbp,%rax,1),%esi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11b0 <main+0x80>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0x6(%rsp)
cmp    $0x23,%al
je     120e <main+0xde>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0x7(%rsp)
mov    $0x1,%ebp
cmp    $0x23,%al
je     120e <main+0xde>
mov    %eax,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0x8(%rsp)
mov    $0x2,%ebp
cmp    $0x23,%al
je     120e <main+0xde>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0x9(%rsp)
mov    $0x3,%ebp
cmp    $0x23,%al
je     120e <main+0xde>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0xa(%rsp)
mov    $0x4,%ebp
cmp    $0x23,%al
je     120e <main+0xde>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0xb(%rsp)
mov    $0x5,%ebp
cmp    $0x23,%al
je     120e <main+0xde>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0xc(%rsp)
mov    $0x6,%ebp
cmp    $0x23,%al
je     120e <main+0xde>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0xd(%rsp)
mov    $0x7,%ebp
cmp    $0x23,%al
je     120e <main+0xde>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0xe(%rsp)
mov    $0x8,%ebp
cmp    $0x23,%al
je     120e <main+0xde>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0xf(%rsp)
mov    $0x9,%ebp
cmp    $0x23,%al
jne    121c <main+0xec>
movb   $0x0,0x6(%rsp,%rbp,1)
mov    0x6(%rsp),%bl
mov    0x7(%rsp),%r14b
lea    0x6(%rsp),%rdi
call   1030 <puts@plt>
lea    0xdd3(%rip),%rdi
call   1030 <puts@plt>
movsbl %bl,%esi
lea    0xddf(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
movsbl %r14b,%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movsbl 0x8(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movsbl 0x9(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movsbl 0xa(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movsbl 0xb(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movsbl 0xc(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movsbl 0xd(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movsbl 0xe(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"--------------------------\00"
@.str.1 = [4 x i8] c"%d\09\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
br label %4
4: ; preds = %23, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %26
7: ; preds = %4
%8 = call signext i8 (...) @getchar()
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %10
store i8 %8, i8* %11
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 35
br i1 %17, label %18, label %22
18: ; preds = %7
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %20
store i8 0, i8* %21
br label %26
22: ; preds = %7
br label %23
23: ; preds = %22
%24 = load i32, i32* %2
%25 = add nsw i32 %24, 1
store i32 %25, i32* %2
br label %4
26: ; preds = %18, %4
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%28 = call i32 @puts(i8* %27)
%29 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %30
30: ; preds = %39, %26
%31 = load i32, i32* %2
%32 = icmp slt i32 %31, 10
br i1 %32, label %33, label %42
33: ; preds = %30
%34 = load i32, i32* %2
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %37)
br label %39
39: ; preds = %33
%40 = load i32, i32* %2
%41 = add nsw i32 %40, 1
store i32 %41, i32* %2
br label %30
42: ; preds = %30
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"--------------------------\00"
@.str.1 = [4 x i8] c"%d\09\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call signext i8 (...) @getchar()
store i8 %3, i8* %2
%4 = icmp eq i8 %3, 35
br i1 %4, label %5, label %11
5: ; preds = %43, %39, %35, %31, %27, %23, %19, %15, %11, %0
%6 = phi i64 [ 0, %0 ], [ 1, %11 ], [ 2, %15 ], [ 3, %19 ], [ 4, %23 ], [ 5, %27 ], [ 6, %31 ], [ 7, %35 ], [ 8, %39 ], [ 9, %43 ]
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %6
store i8 0, i8* %7
%8 = load i8, i8* %2
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
%10 = load i8, i8* %9
br label %47
11: ; preds = %0
%12 = tail call signext i8 (...) @getchar()
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 1
store i8 %12, i8* %13
%14 = icmp eq i8 %12, 35
br i1 %14, label %5, label %15
15: ; preds = %11
%16 = tail call signext i8 (...) @getchar()
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
store i8 %16, i8* %17
%18 = icmp eq i8 %16, 35
br i1 %18, label %5, label %19
19: ; preds = %15
%20 = tail call signext i8 (...) @getchar()
%21 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 3
store i8 %20, i8* %21
%22 = icmp eq i8 %20, 35
br i1 %22, label %5, label %23
23: ; preds = %19
%24 = tail call signext i8 (...) @getchar()
%25 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
store i8 %24, i8* %25
%26 = icmp eq i8 %24, 35
br i1 %26, label %5, label %27
27: ; preds = %23
%28 = tail call signext i8 (...) @getchar()
%29 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 5
store i8 %28, i8* %29
%30 = icmp eq i8 %28, 35
br i1 %30, label %5, label %31
31: ; preds = %27
%32 = tail call signext i8 (...) @getchar()
%33 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 6
store i8 %32, i8* %33
%34 = icmp eq i8 %32, 35
br i1 %34, label %5, label %35
35: ; preds = %31
%36 = tail call signext i8 (...) @getchar()
%37 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 7
store i8 %36, i8* %37
%38 = icmp eq i8 %36, 35
br i1 %38, label %5, label %39
39: ; preds = %35
%40 = tail call signext i8 (...) @getchar()
%41 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 8
store i8 %40, i8* %41
%42 = icmp eq i8 %40, 35
br i1 %42, label %5, label %43
43: ; preds = %39
%44 = tail call signext i8 (...) @getchar()
%45 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 9
store i8 %44, i8* %45
%46 = icmp eq i8 %44, 35
br i1 %46, label %5, label %47
47: ; preds = %43, %5
%48 = phi i8 [ %10, %5 ], [ %12, %43 ]
%49 = phi i8 [ %8, %5 ], [ %3, %43 ]
%50 = call i32 @puts(i8* %2)
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%52 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %49)
%53 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %48)
%54 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 2
%55 = load i8, i8* %54
%56 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %55)
%57 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 3
%58 = load i8, i8* %57
%59 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %58)
%60 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
%61 = load i8, i8* %60
%62 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %61)
%63 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 5
%64 = load i8, i8* %63
%65 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %64)
%66 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 6
%67 = load i8, i8* %66
%68 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %67)
%69 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 7
%70 = load i8, i8* %69
%71 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %70)
%72 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 8
%73 = load i8, i8* %72
%74 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %73)
%75 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 9
%76 = load i8, i8* %75
%77 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext %76)
ret i32 0
}