#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 */
typedef int /*<<< orphan*/ rows;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ make_rows(int, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ print_rows(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int main(int argc, char **argv) {
  int nd;
  char rows[6 * (9 + 3) + 1 * 5];
  sscanf(argv[1], "%d", &nd);
  if (argc == 1 || nd < 1 || nd > 6) {
    printf("Input number of dices between 1 and %d\n", 6);
    return (EXIT_FAILURE);
  }
  memset(rows, 0, sizeof(rows));
  make_rows(nd, rows);
  print_rows(rows);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe8b(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1070 <sscanf@plt>
cmpl   $0x1,-0x8(%rbp)
je     119c <main+0x4c>
cmpl   $0x1,-0x14(%rbp)
jl     119c <main+0x4c>
cmpl   $0x6,-0x14(%rbp)
jle    11be <main+0x6e>
lea    0xe60(%rip),%rdi
mov    $0x6,%esi
call   1050 <printf@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ef <main+0x9f>
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x4d,%edx
call   1060 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x70(%rbp),%rsi
call   1030 <make_rows@plt>
lea    -0x70(%rbp),%rdi
call   1040 <print_rows@plt>
mov    0x2dee(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
mov    %edi,%ebx
mov    0x8(%rsi),%rdi
lea    0xe9e(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%ebx
je     11af <main+0x5f>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    11af <main+0x5f>
cmp    $0x7,%eax
jge    11af <main+0x5f>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x4d,%edx
call   1060 <memset@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1030 <make_rows@plt>
mov    %rbx,%rdi
call   1040 <print_rows@plt>
mov    0x2e2b(%rip),%rax
jmp    11c7 <main+0x77>
lea    0xe4d(%rip),%rdi
mov    $0x6,%esi
call   1050 <printf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [40 x i8] c"Input number of dices between 1 and %d\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [77 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 1
br i1 %13, label %20, label %14
14: ; preds = %2
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 1
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %6
%19 = icmp sgt i32 %18, 6
br i1 %19, label %20, label %23
20: ; preds = %17, %14, %2
%21 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 6)
%22 = load i32, i32* @EXIT_FAILURE
store i32 %22, i32* %3
br label %32
23: ; preds = %17
%24 = getelementptr inbounds [77 x i8], [77 x i8]* %7, i64 0, i64 0
%25 = call i32 @memset(i8* %24, i32 0, i32 77)
%26 = load i32, i32* %6
%27 = getelementptr inbounds [77 x i8], [77 x i8]* %7, i64 0, i64 0
%28 = call i32 @make_rows(i32 %26, i8* %27)
%29 = getelementptr inbounds [77 x i8], [77 x i8]* %7, i64 0, i64 0
%30 = call i32 @print_rows(i8* %29)
%31 = load i32, i32* @EXIT_SUCCESS
store i32 %31, i32* %3
br label %32
32: ; preds = %23, %20
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [40 x i8] c"Input number of dices between 1 and %d\0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [77 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [77 x i8], [77 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%10 = icmp eq i32 %0, 1
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 1
%13 = select i1 %10, i1 true, i1 %12
%14 = icmp sgt i32 %11, 6
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 6)
br label %23
18: ; preds = %2
%19 = call i32 @memset(i8* %6, i32 0, i32 77)
%20 = load i32, i32* %3
%21 = call i32 @make_rows(i32 %20, i8* %6)
%22 = call i32 @print_rows(i8* %6)
br label %23
23: ; preds = %18, %16
%24 = phi i32* [ @EXIT_FAILURE, %16 ], [ @EXIT_SUCCESS, %18 ]
%25 = load i32, i32* %24
ret i32 %25
}