#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*/ enum_strings(char *, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ malloc(int);
scalar_t__ sscanf(char *, char *, int *);
int /*<<< orphan*/ stderr;
main(int argc, char **argv) {
  char *s;
  int a, b;
  if (argc != 3 || sscanf(argv[1], "%d", &a) == 0 ||
      sscanf(argv[1], "%d", &b) == 0 || a < 0 || b < 0) {
    fprintf(stderr, "usage: q8 a b\n");
    exit(1);
  }
  s = (char *)malloc(sizeof(char) * (a + b + 1));
  enum_strings(s, a, b, 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x4(%rbp)
jne    11c1 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe88(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
je     11c1 <main+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe66(%rip),%rsi
lea    -0x20(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x0,%rax
je     11c1 <main+0x71>
cmpl   $0x0,-0x1c(%rbp)
jl     11c1 <main+0x71>
cmpl   $0x0,-0x20(%rbp)
jge    11e0 <main+0x90>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
lea    0xe32(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
xor    %ecx,%ecx
call   1030 <enum_strings@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
cmp    $0x3,%edi
jne    11c6 <main+0x76>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe98(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1060 <sscanf@plt>
test   %rax,%rax
je     11c6 <main+0x76>
mov    0x8(%rbx),%rdi
lea    0xe7e(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1060 <sscanf@plt>
test   %rax,%rax
je     11c6 <main+0x76>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     11c6 <main+0x76>
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
js     11c6 <main+0x76>
lea    (%rax,%rcx,1),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rax,%rdi
xor    %ecx,%ecx
call   1030 <enum_strings@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    0xe2d(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [15 x i8] c"usage: q8 a b\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 3
br i1 %9, label %28, label %10
10: ; preds = %2
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @sscanf(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%15 = icmp eq i64 %14, 0
br i1 %15, label %28, label %16
16: ; preds = %10
%17 = load i8**, i8*** %4
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @sscanf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%21 = icmp eq i64 %20, 0
br i1 %21, label %28, label %22
22: ; preds = %16
%23 = load i32, i32* %6
%24 = icmp slt i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* %7
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %25, %22, %16, %10, %2
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %25
%33 = load i32, i32* %6
%34 = load i32, i32* %7
%35 = add nsw i32 %33, %34
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = mul i64 1, %37
%39 = trunc i64 %38 to i32
%40 = call i64 @malloc(i32 %39)
%41 = inttoptr i64 %40 to i8*
store i8* %41, i8** %5
%42 = load i8*, i8** %5
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = call i32 @enum_strings(i8* %42, i32 %43, i32 %44, i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [15 x i8] c"usage: q8 a b\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = icmp eq i32 %0, 3
br i1 %7, label %8, label %23
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i64 @sscanf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %8
%14 = load i8*, i8** %9
%15 = call i64 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%16 = icmp eq i64 %15, 0
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 0
%19 = select i1 %16, i1 true, i1 %18
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 0
%22 = select i1 %19, i1 true, i1 %21
br i1 %22, label %23, label %27
23: ; preds = %13, %8, %2
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %13
%28 = add nuw i32 %17, 1
%29 = add nuw i32 %28, %20
%30 = call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to i8*
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = call i32 @enum_strings(i8* %31, i32 %32, i32 %33, i32 0)
ret i32 0
}