#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 *, int *);
int main(void) {
  printf("Input Int array: ");
  char continue_q = 1, array_length = 0, i;
  int a[100];
  int bob;
  printf("%d", bob);
  for (i = 0; continue_q && i < 100; i++) {
    scanf("%d", &a[i]);
    if (a[i] == '\n')
      continue_q = 0;
    else
      continue_q = 1;
  }
  array_length = i;
  printf("\n Array length: %i \n", array_length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x1,-0x5(%rbp)
movb   $0x0,-0x6(%rbp)
mov    -0x1a4(%rbp),%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x0,-0x7(%rbp)
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1a5(%rbp)
je     1185 <main+0x65>
movsbl -0x7(%rbp),%eax
cmp    $0x64,%eax
setl   %al
mov    %al,-0x1a5(%rbp)
mov    -0x1a5(%rbp),%al
test   $0x1,%al
jne    1198 <main+0x78>
jmp    11e9 <main+0xc9>
movsbq -0x7(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe60(%rip),%rdi
call   1040 <scanf@plt>
movsbq -0x7(%rbp),%rax
cmpl   $0xa,-0x1a0(%rbp,%rax,4)
0a
jne    11d3 <main+0xb3>
movb   $0x0,-0x5(%rbp)
jmp    11d7 <main+0xb7>
movb   $0x1,-0x5(%rbp)
jmp    11dc <main+0xbc>
mov    -0x7(%rbp),%al
add    $0x1,%al
mov    %al,-0x7(%rbp)
jmp    1160 <main+0x40>
mov    -0x7(%rbp),%al
mov    %al,-0x6(%rbp)
movsbl -0x6(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x190,%rsp
lea    0xecd(%rip),%rdi
xor    %r15d,%r15d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xece(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %ebx,%ebx
lea    (%rsp,%r15,1),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0x1(%rbx),%rsi
cmpl   $0xa,(%rsp,%rbx,4)
je     1173 <main+0x53>
add    $0x4,%r15
cmp    $0x63,%rbx
mov    %rsi,%rbx
jb     1150 <main+0x30>
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"Input Int array: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [21 x i8] c"\0A Array length: %i \0A\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = bitcast [100 x i32]* %1 to i8*
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 undef)
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %11, %5 ]
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %6
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = load i32, i32* %7
%10 = icmp ne i32 %9, 10
%11 = add nuw nsw i64 %6, 1
%12 = icmp ult i64 %6, 99
%13 = select i1 %10, i1 %12, i1 false
br i1 %13, label %5, label %14
14: ; preds = %5
%15 = trunc i64 %11 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %15)
ret i32 0
}