#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*/ conditionTable(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int strToInt(char);
int /*<<< orphan*/ strcpy(char *, char *);
int askTableSize() {
  int tableLength = 99;
  char sizeTemp[tableLength], size[tableLength];
  for (int i = 0; i < tableLength; i++) {
    sizeTemp[i] = '\a';
    size[i] = '\a';
  }
  do {
    printf("Please enter a table size: ");
    scanf("%s", sizeTemp);
    strcpy(size, sizeTemp);
  } while (!conditionTable(size));
  return strToInt(size[0]);
}


x86 assembly (clang, -O0):
<askTableSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x63,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11dd <askTableSize+0x8d>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
movslq -0x24(%rbp),%rdx
movb   $0x7,(%rcx,%rdx,1)
movslq -0x24(%rbp),%rcx
movb   $0x7,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11ab <askTableSize+0x5b>
jmp    11e2 <askTableSize+0x92>
lea    0xe17(%rip),%rdi
call   1060 <printf@plt>
mov    -0x38(%rbp),%rsi
lea    0xe23(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x30(%rbp),%rdi
call   1030 <conditionTable@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11e2 <askTableSize+0x92>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edi
call   1050 <strToInt@plt>
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<askTableSize>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0xd8,%rsp
movaps 0xe9b(%rip),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movl   $0x7070707,0xcf(%rsp)
07 07 07 07
movaps %xmm0,(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movl   $0x7070707,0x5f(%rsp)
07
lea    0xe47(%rip),%r14
lea    0xe5c(%rip),%r15
lea    0x70(%rsp),%r12
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1060 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1030 <conditionTable@plt>
test   %eax,%eax
je     11e0 <askTableSize+0x90>
movsbl (%rsp),%edi
call   1050 <strToInt@plt>
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Please enter a table size: \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @askTableSize() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
store i32 99, i32* %1
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %2
%9 = alloca i8, i64 %7
store i64 %7, i64* %3
%10 = load i32, i32* %1
%11 = zext i32 %10 to i64
%12 = alloca i8, i64 %11
store i64 %11, i64* %4
store i32 0, i32* %5
br label %13
13: ; preds = %24, %0
%14 = load i32, i32* %5
%15 = load i32, i32* %1
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %27
17: ; preds = %13
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %9, i64 %19
store i8 7, i8* %20
%21 = load i32, i32* %5
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %12, i64 %22
store i8 7, i8* %23
br label %24
24: ; preds = %17
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %13
27: ; preds = %13
br label %28
28: ; preds = %32, %27
%29 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%31 = call i32 @strcpy(i8* %12, i8* %9)
br label %32
32: ; preds = %28
%33 = call i32 @conditionTable(i8* %12)
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
br i1 %35, label %28, label %36
36: ; preds = %32
%37 = getelementptr inbounds i8, i8* %12, i64 0
%38 = load i8, i8* %37
%39 = call i32 @strToInt(i8 signext %38)
%40 = load i8*, i8** %2
ret i32 %39
}

LLVM IR (-O2):
@.str = [28 x i8] c"Please enter a table size: \00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @askTableSize() {
%1 = alloca [99 x i8]
%2 = getelementptr inbounds [99 x i8], [99 x i8]* %1, i64 0, i64 0
%3 = alloca [99 x i8]
%4 = getelementptr inbounds [99 x i8], [99 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [99 x i8], [99 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [99 x i8], [99 x i8]* %1, i64 0, i64 0
br label %7
7: ; preds = %0, %7
%8 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%10 = call i32 @strcpy(i8* %5, i8* %6)
%11 = call i32 @conditionTable(i8* %5)
%12 = icmp eq i32 %11, 0
br i1 %12, label %7, label %13
13: ; preds = %7
%14 = load i8, i8* %5
%15 = call i32 @strToInt(i8 signext %14)
ret i32 %15
}