#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 */
char *malloc(int);
int rand();
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *shape() {
  int i;
  int j;
  char *shape;
  shape = malloc(9 * sizeof(char));
  char *shapes[7] = {"---", "--", "-", "", "+", "++", "+++"};
  i = rand() % 7;
  j = rand() % 7;
  strcpy(shape, "s");
  strcat(shape, shapes[i]);
  strcat(shape, ":");
  strcat(shape, shapes[j]);
  return shape;
}


x86 assembly (clang, -O0):
<shape>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    $0x9,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2c6f(%rip),%rsi
mov    $0x38,%edx
call   1040 <memcpy@plt>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
movslq -0x4(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
call   1060 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x10(%rbp),%rdi
movslq -0x8(%rbp),%rax
mov    -0x50(%rbp,%rax,8),%rsi
call   1060 <strcat@plt>
mov    -0x10(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shape>:
push   %r15
push   %r14
push   %rbx
mov    $0x9,%edi
call   1040 <malloc@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0xffffffff92492493,%rax,%r15
shr    $0x20,%r15
add    %eax,%r15d
mov    %r15d,%ecx
shr    $0x1f,%ecx
sar    $0x2,%r15d
add    %ecx,%r15d
lea    0x0(,%r15,8),%ecx
sub    %ecx,%r15d
add    %eax,%r15d
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0xffffffff92492493,%rax,%rbx
shr    $0x20,%rbx
add    %eax,%ebx
mov    %ebx,%ecx
shr    $0x1f,%ecx
sar    $0x2,%ebx
add    %ecx,%ebx
lea    0x0(,%rbx,8),%ecx
sub    %ecx,%ebx
add    %eax,%ebx
lea    0xe52(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
movslq %r15d,%rax
lea    0x2c18(%rip),%r15
mov    (%r15,%rax,8),%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
lea    0xe2f(%rip),%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
movslq %ebx,%rax
mov    (%r15,%rax,8),%rsi
mov    %r14,%rdi
call   1050 <strcat@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"---\00"
@.str.1 = [3 x i8] c"--\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [2 x i8] c"+\00"
@.str.5 = [3 x i8] c"++\00"
@.str.6 = [4 x i8] c"+++\00"
@__const.shape.shapes = [7 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [2 x i8] c"s\00"
@.str.8 = [2 x i8] c":\00"
define i8* @shape() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [7 x i8*]
%5 = call i8* @malloc(i32 9)
store i8* %5, i8** %3
%6 = bitcast [7 x i8*]* %4 to i8*
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 7
store i32 %8, i32* %1
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 7
store i32 %10, i32* %2
%11 = load i8*, i8** %3
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%13 = load i8*, i8** %3
%14 = load i32, i32* %1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [7 x i8*], [7 x i8*]* %4, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @strcat(i8* %13, i8* %17)
%19 = load i8*, i8** %3
%20 = call i32 @strcat(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%21 = load i8*, i8** %3
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [7 x i8*], [7 x i8*]* %4, i64 0, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @strcat(i8* %21, i8* %25)
%27 = load i8*, i8** %3
ret i8* %27
}

LLVM IR (-O2):
@.str = [4 x i8] c"---\00"
@.str.1 = [3 x i8] c"--\00"
@.str.2 = [2 x i8] c"-\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [2 x i8] c"+\00"
@.str.5 = [3 x i8] c"++\00"
@.str.6 = [4 x i8] c"+++\00"
@__const.shape.shapes = [7 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [2 x i8] c"s\00"
@.str.8 = [2 x i8] c":\00"
define i8* @shape() {
%1 = tail call dereferenceable_or_null(9) i8* @malloc(i32 9)
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 7
%4 = tail call i32 (...) @rand()
%5 = srem i32 %4, 7
%6 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds [7 x i8*], [7 x i8*]* @__const.shape.shapes, i64 0, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @strcat(i8* %1, i8* %9)
%11 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%12 = sext i32 %5 to i64
%13 = getelementptr inbounds [7 x i8*], [7 x i8*]* @__const.shape.shapes, i64 0, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @strcat(i8* %1, i8* %14)
ret i8* %1
}