#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 function(int, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int n;
  scanf("%d\n", &n);
  char *s;
  s = (char *)malloc((n + 1) * sizeof(char));
  scanf("%s\n", s);
  if (n == 0) {
    printf("Good String");
    return 0;
  }
  if (function(n, s) == (n - 1)) {
    printf("Good String");
  } else {
    printf("Not Good String");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    11ac <main+0x6c>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ea <main+0xaa>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <function@plt>
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    11d7 <main+0x97>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
jmp    11e3 <main+0xa3>
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xe96(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
je     11a5 <main+0x65>
mov    %rbx,%rsi
call   1060 <function@plt>
mov    0xc(%rsp),%ecx
add    $0xffffffff,%ecx
cmp    %ecx,%eax
lea    0xe74(%rip),%rax
lea    0xe69(%rip),%rdi
cmove  %rax,%rdi
jmp    11ac <main+0x6c>
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [12 x i8] c"Good String\00"
@.str.3 = [16 x i8] c"Not Good String\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %30
18: ; preds = %0
%19 = load i32, i32* %2
%20 = load i8*, i8** %3
%21 = call i32 @function(i32 %19, i8* %20)
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 1
%24 = icmp eq i32 %21, %23
br i1 %24, label %25, label %27
25: ; preds = %18
%26 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %29
27: ; preds = %18
%28 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
store i32 0, i32* %1
br label %30
30: ; preds = %29, %16
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [12 x i8] c"Good String\00"
@.str.3 = [16 x i8] c"Not Good String\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
%6 = call i64 @malloc(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 0
br i1 %10, label %17, label %11
11: ; preds = %0
%12 = call i32 @function(i32 %9, i8* %7)
%13 = load i32, i32* %1
%14 = add nsw i32 %13, -1
%15 = icmp eq i32 %12, %14
%16 = select i1 %15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0)
br label %17
17: ; preds = %11, %0
%18 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %0 ], [ %16, %11 ]
%19 = call i32 @printf(i8* dereferenceable(1) %18)
ret i32 0
}