#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*/ puts(char const *);
void print_generic_response() {
  static const char *responses[] = {"How are you this beautiful day?",
                                    "Did you have a happy childhood?",
                                    "Did you hate your father?",
                                    "Did you have a good friend?",
                                    "Did you like your friend?",
                                    "What do you think about your friendship?",
                                    "I'm not sure I understand.",
                                    NULL};
  static int next = 0;
  if (!responses[next])
    next = 0;
  puts(responses[next++]);
}


x86 assembly (clang, -O0):
<print_generic_response>:
push   %rbp
mov    %rsp,%rbp
movslq 0x2f59(%rip),%rcx
lea    0x2f0e(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
jne    1137 <print_generic_response+0x27>
movl   $0x0,0x2f3d(%rip)
mov    0x2f37(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f2c(%rip)
movslq %eax,%rcx
lea    0x2ede(%rip),%rax
mov    (%rax,%rcx,8),%rdi
call   1030 <puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_generic_response>:
mov    0x2f16(%rip),%eax
xor    %ecx,%ecx
cmp    $0x7,%eax
cmovne %eax,%ecx
lea    0x1(%rcx),%eax
mov    %eax,0x2f05(%rip)
movslq %ecx,%rax
lea    0x2caf(%rip),%rcx
mov    (%rcx,%rax,8),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@print_generic_response.responses = internal global [8 x i8*] [i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i32 0, i32 0), i8* null]
@.str = [32 x i8] c"How are you this beautiful day?\00"
@.str.1 = [32 x i8] c"Did you have a happy childhood?\00"
@.str.2 = [26 x i8] c"Did you hate your father?\00"
@.str.3 = [28 x i8] c"Did you have a good friend?\00"
@.str.4 = [26 x i8] c"Did you like your friend?\00"
@.str.5 = [41 x i8] c"What do you think about your friendship?\00"
@.str.6 = [27 x i8] c"I'm not sure I understand.\00"
@print_generic_response.next = internal global i32 0
define void @print_generic_response() {
%1 = load i32, i32* @print_generic_response.next
%2 = sext i32 %1 to i64
%3 = getelementptr inbounds [8 x i8*], [8 x i8*]* @print_generic_response.responses, i64 0, i64 %2
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %0
store i32 0, i32* @print_generic_response.next
br label %7
7: ; preds = %6, %0
%8 = load i32, i32* @print_generic_response.next
%9 = add nsw i32 %8, 1
store i32 %9, i32* @print_generic_response.next
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds [8 x i8*], [8 x i8*]* @print_generic_response.responses, i64 0, i64 %10
%12 = load i8*, i8** %11
%13 = call i32 @puts(i8* %12)
ret void
}

LLVM IR (-O2):
@print_generic_response.responses = internal unnamed_addr constant [8 x i8*] [i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i32 0, i32 0), i8* null]
@.str = [32 x i8] c"How are you this beautiful day?\00"
@.str.1 = [32 x i8] c"Did you have a happy childhood?\00"
@.str.2 = [26 x i8] c"Did you hate your father?\00"
@.str.3 = [28 x i8] c"Did you have a good friend?\00"
@.str.4 = [26 x i8] c"Did you like your friend?\00"
@.str.5 = [41 x i8] c"What do you think about your friendship?\00"
@.str.6 = [27 x i8] c"I'm not sure I understand.\00"
@print_generic_response.next = internal unnamed_addr global i32 0
define void @print_generic_response() {
%1 = load i32, i32* @print_generic_response.next
%2 = icmp eq i32 %1, 7
%3 = select i1 %2, i32 0, i32 %1
%4 = add nsw i32 %3, 1
store i32 %4, i32* @print_generic_response.next
%5 = sext i32 %3 to i64
%6 = getelementptr inbounds [8 x i8*], [8 x i8*]* @print_generic_response.responses, i64 0, i64 %5
%7 = load i8*, i8** %6
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret void
}