#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*/ get_input(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
int /*<<< orphan*/ stdin;
void list_forms(char **response, const char **list, const size_t list_size) {
  if (list_size > 2) {
    for (size_t i = 0; i < list_size - 1; i++) {
      printf("%s, ", list[i]);
    }
  } else {
    printf("%s ", list[0]);
  }
  printf("or %s? ", list[list_size - 1]);
  size_t response_size = 0;
  get_input(response, &response_size, stdin);
}


x86 assembly (clang, -O0):
<list_forms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x2,-0x18(%rbp)
jbe    118a <list_forms+0x6a>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    1185 <list_forms+0x65>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1147 <list_forms+0x27>
jmp    119d <list_forms+0x7d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e1c(%rip),%rax
mov    (%rax),%edx
lea    -0x28(%rbp),%rsi
call   1040 <get_input@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_forms>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r13
mov    %rsi,%r15
mov    %rdi,%r14
cmp    $0x3,%rdx
jb     1167 <list_forms+0x47>
add    $0xffffffffffffffff,%r13
xor    %ebx,%ebx
lea    0xeb7(%rip),%r12
nopl   0x0(%rax)
mov    (%r15,%rbx,8),%rsi
mov    %r12,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1150 <list_forms+0x30>
jmp    117a <list_forms+0x5a>
mov    (%r15),%rsi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
add    $0xffffffffffffffff,%r13
mov    (%r15,%r13,8),%rsi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
movq   $0x0,0x8(%rsp)
mov    0x2e4e(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1040 <get_input@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s, \00"
@.str.1 = [4 x i8] c"%s \00"
@.str.2 = [8 x i8] c"or %s? \00"
@stdin = global i32 0
define void @list_forms(i8** %0, i8** %1, i64 %2) {
%4 = alloca i8**
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i8** %0, i8*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%9 = load i64, i64* %6
%10 = icmp ugt i64 %9, 2
br i1 %10, label %11, label %27
11: ; preds = %3
store i64 0, i64* %7
br label %12
12: ; preds = %23, %11
%13 = load i64, i64* %7
%14 = load i64, i64* %6
%15 = sub i64 %14, 1
%16 = icmp ult i64 %13, %15
br i1 %16, label %17, label %26
17: ; preds = %12
%18 = load i8**, i8*** %5
%19 = load i64, i64* %7
%20 = getelementptr inbounds i8*, i8** %18, i64 %19
%21 = load i8*, i8** %20
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %17
%24 = load i64, i64* %7
%25 = add i64 %24, 1
store i64 %25, i64* %7
br label %12
26: ; preds = %12
br label %32
27: ; preds = %3
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %30)
br label %32
32: ; preds = %27, %26
%33 = load i8**, i8*** %5
%34 = load i64, i64* %6
%35 = sub i64 %34, 1
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %37)
store i64 0, i64* %8
%39 = load i8**, i8*** %4
%40 = load i32, i32* @stdin
%41 = call i32 @get_input(i8** %39, i64* %8, i32 %40)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s, \00"
@.str.1 = [4 x i8] c"%s \00"
@.str.2 = [8 x i8] c"or %s? \00"
@stdin = global i32 0
define void @list_forms(i8** %0, i8** nocapture %1, i64 %2) {
%4 = alloca i64
%5 = icmp ugt i64 %2, 2
br i1 %5, label %6, label %15
6: ; preds = %3
%7 = add i64 %2, -1
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ %13, %8 ], [ 0, %6 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = add nuw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %19, label %8
15: ; preds = %3
%16 = load i8*, i8** %1
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = add nsw i64 %2, -1
br label %19
19: ; preds = %8, %15
%20 = phi i64 [ %18, %15 ], [ %7, %8 ]
%21 = getelementptr inbounds i8*, i8** %1, i64 %20
%22 = load i8*, i8** %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%25 = load i32, i32* @stdin
%26 = call i32 @get_input(i8** %0, i64* %4, i32 %25)
ret void
}