#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*/ getchar();
scalar_t__ putchar(char const);
int main(void) {
  const char *seven[] = {"bashful", "doc",    "dopey", "grumpy",
                         "happy",   "sneezy", "sleepy"};
  int x, c;
  for (x = 0; x < 7; x++) {
    c = 0;
    putchar('\t');
    while (putchar(*(*(seven + x) + c++)))
      ;
    putchar('\n');
  }
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0x2c96(%rip),%rsi
mov    $0x38,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0x7,-0x44(%rbp)
jge    11bd <main+0x8d>
movl   $0x0,-0x48(%rbp)
mov    $0x9,%edi
call   1030 <putchar@plt>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
mov    -0x48(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x48(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
cmp    $0x0,%rax
je     11a5 <main+0x75>
jmp    1176 <main+0x46>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    115b <main+0x2b>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x9,%edi
call   1030 <putchar@plt>
lea    0xece(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1140 <main+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
lea    0xe9c(%rip),%rbx
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1170 <main+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
lea    0xe70(%rip),%rbx
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    11a0 <main+0x80>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
lea    0xe46(%rip),%rbx
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    11d0 <main+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
lea    0xe1d(%rip),%rbx
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1200 <main+0xe0>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
lea    0xdf3(%rip),%rbx
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1230 <main+0x110>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x9,%edi
call   1030 <putchar@plt>
lea    0xdca(%rip),%rbx
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1260 <main+0x140>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"bashful\00"
@.str.1 = [4 x i8] c"doc\00"
@.str.2 = [6 x i8] c"dopey\00"
@.str.3 = [7 x i8] c"grumpy\00"
@.str.4 = [6 x i8] c"happy\00"
@.str.5 = [7 x i8] c"sneezy\00"
@.str.6 = [7 x i8] c"sleepy\00"
@__const.main.seven = [7 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i32 0, i32 0)]
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8*]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [7 x i8*]* %2 to i8*
store i32 0, i32* %3
br label %6
6: ; preds = %27, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 7
br i1 %8, label %9, label %30
9: ; preds = %6
store i32 0, i32* %4
%10 = call i64 @putchar(i8 signext 9)
br label %11
11: ; preds = %24, %9
%12 = getelementptr inbounds [7 x i8*], [7 x i8*]* %2, i64 0, i64 0
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
%19 = sext i32 %17 to i64
%20 = getelementptr inbounds i8, i8* %16, i64 %19
%21 = load i8, i8* %20
%22 = call i64 @putchar(i8 signext %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %11
br label %11
25: ; preds = %11
%26 = call i64 @putchar(i8 signext 10)
br label %27
27: ; preds = %25
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %6
30: ; preds = %6
%31 = call i32 (...) @getchar()
ret i32 0
}

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