#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 */
scalar_t__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
char *getenv(char *);
int /*<<< orphan*/ stdout;
scalar_t__ strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
long strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[], char *argenv[]) {
  char num[5];
  long index;
  long nbr = 1;
  for (index = 0; index < 5; index++) {
    num[index] = '\0';
  }
  if (argc == 2) {
    strncpy(num, argv[1], 5 - 1);
  }
  if (getenv("NOPNUM") != NULL && strlen(getenv("NOPNUM")) < 5) {
    strncpy(num, getenv("NOPNUM"), 5 - 1);
  }
  if (strlen(num) > 0) {
    long result;
    errno = 0;
    result = strtol(num, NULL, 10);
    if (!errno) {
      nbr = result;
    }
  }
  for (index = 0; index < nbr; index++) {
    (void)fprintf(stdout, "%c", '\x90');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x1,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
cmpq   $0x5,-0x28(%rbp)
jge    119f <main+0x4f>
mov    -0x28(%rbp),%rax
movb   $0x0,-0x1d(%rbp,%rax,1)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    117a <main+0x2a>
cmpl   $0x2,-0x8(%rbp)
jne    11bf <main+0x6f>
lea    -0x1d(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x4,%edx
call   1040 <strncpy@plt>
lea    0xe3a(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1218 <main+0xc8>
lea    0xe24(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <strlen@plt>
cmp    $0x5,%rax
jge    1218 <main+0xc8>
lea    -0x1d(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    0xdfe(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x40(%rbp),%rdi
mov    %rax,%rsi
mov    $0x4,%edx
call   1040 <strncpy@plt>
lea    -0x1d(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%rax
jle    126d <main+0x11d>
mov    0x2dae(%rip),%rax
movq   $0x0,(%rax)
lea    -0x1d(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,-0x38(%rbp)
mov    0x2d8a(%rip),%rax
cmpq   $0x0,(%rax)
jne    1268 <main+0x118>
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    126d <main+0x11d>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x30(%rbp),%rax
jge    12ae <main+0x15e>
mov    0x2d4e(%rip),%rax
mov    (%rax),%edi
lea    0xd74(%rip),%rsi
mov    $0xffffff90,%edx
call   1060 <fprintf@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1275 <main+0x125>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movb   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
cmp    $0x2,%edi
jne    117e <main+0x2e>
mov    0x8(%rsi),%rsi
lea    0x8(%rsp),%rdi
mov    $0x4,%edx
call   1040 <strncpy@plt>
lea    0xe7b(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11b2 <main+0x62>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <strlen@plt>
cmp    $0x4,%rax
jg     11b2 <main+0x62>
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1040 <strncpy@plt>
lea    0x8(%rsp),%rdi
call   1050 <strlen@plt>
mov    $0x1,%ebx
test   %rax,%rax
jle    11f3 <main+0xa3>
mov    0x2e13(%rip),%r14
movq   $0x0,(%r14)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1070 <strtol@plt>
cmpq   $0x0,(%r14)
jne    11f3 <main+0xa3>
mov    %rax,%rbx
test   %rax,%rax
jle    1226 <main+0xd6>
mov    0x2dde(%rip),%r15
lea    0xe06(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r15),%edi
mov    %r14,%rsi
mov    $0xffffff90,%edx
call   1060 <fprintf@plt>
add    $0xffffffffffffffff,%rbx
jne    1210 <main+0xc0>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"NOPNUM\00"
@errno = global i64 0
@stdout = global i32 0
@.str.1 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca [5 x i8]
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i64 1, i64* %10
store i64 0, i64* %9
br label %12
12: ; preds = %18, %3
%13 = load i64, i64* %9
%14 = icmp slt i64 %13, 5
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i64, i64* %9
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 %16
store i8 0, i8* %17
br label %18
18: ; preds = %15
%19 = load i64, i64* %9
%20 = add nsw i64 %19, 1
store i64 %20, i64* %9
br label %12
21: ; preds = %12
%22 = load i32, i32* %5
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%26 = load i8**, i8*** %6
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @strncpy(i8* %25, i8* %28, i32 4)
br label %30
30: ; preds = %24, %21
%31 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %41
33: ; preds = %30
%34 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%35 = call i64 @strlen(i8* %34)
%36 = icmp slt i64 %35, 5
br i1 %36, label %37, label %41
37: ; preds = %33
%38 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%39 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%40 = call i32 @strncpy(i8* %38, i8* %39, i32 4)
br label %41
41: ; preds = %37, %33, %30
%42 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%43 = call i64 @strlen(i8* %42)
%44 = icmp sgt i64 %43, 0
br i1 %44, label %45, label %53
45: ; preds = %41
store i64 0, i64* @errno
%46 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%47 = call i64 @strtol(i8* %46, i32* null, i32 10)
store i64 %47, i64* %11
%48 = load i64, i64* @errno
%49 = icmp ne i64 %48, 0
br i1 %49, label %52, label %50
50: ; preds = %45
%51 = load i64, i64* %11
store i64 %51, i64* %10
br label %52
52: ; preds = %50, %45
br label %53
53: ; preds = %52, %41
store i64 0, i64* %9
br label %54
54: ; preds = %61, %53
%55 = load i64, i64* %9
%56 = load i64, i64* %10
%57 = icmp slt i64 %55, %56
br i1 %57, label %58, label %64
58: ; preds = %54
%59 = load i32, i32* @stdout
%60 = call i32 @fprintf(i32 %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext -112)
br label %61
61: ; preds = %58
%62 = load i64, i64* %9
%63 = add nsw i64 %62, 1
store i64 %63, i64* %9
br label %54
64: ; preds = %54
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"NOPNUM\00"
@errno = global i64 0
@stdout = global i32 0
@.str.1 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = alloca [5 x i8]
%5 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%7 = icmp eq i32 %0, 2
br i1 %7, label %8, label %12
8: ; preds = %3
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @strncpy(i8* %6, i8* %10, i32 4)
br label %12
12: ; preds = %8, %3
%13 = call i8* @getenv(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i8* %13, null
br i1 %14, label %20, label %15
15: ; preds = %12
%16 = call i64 @strlen(i8* %13)
%17 = icmp slt i64 %16, 5
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @strncpy(i8* %6, i8* %13, i32 4)
br label %20
20: ; preds = %18, %15, %12
%21 = call i64 @strlen(i8* %6)
%22 = icmp sgt i64 %21, 0
br i1 %22, label %23, label %29
23: ; preds = %20
store i64 0, i64* @errno
%24 = call i64 @strtol(i8* nocapture %6, i32* null, i32 10)
%25 = load i64, i64* @errno
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %23
%28 = icmp sgt i64 %24, 0
br i1 %28, label %29, label %37
29: ; preds = %20, %23, %27
%30 = phi i64 [ %24, %27 ], [ 1, %23 ], [ 1, %20 ]
br label %31
31: ; preds = %29, %31
%32 = phi i64 [ %35, %31 ], [ 0, %29 ]
%33 = load i32, i32* @stdout
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext -112)
%35 = add nuw nsw i64 %32, 1
%36 = icmp eq i64 %35, %30
br i1 %36, label %37, label %31
37: ; preds = %31, %27
ret i32 0
}