#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ strcmp(char *, char *);
void main(int argc, char *argv[]) {
  int disp, count;
  if (argc < 2) {
    printf("Put valeu in command line to count \n");
    exit(1);
  }
  if (argc == 3 && !strcmp(argv[2], "display"))
    disp = 1;
  else
    disp = 0;
  for (count = atoi(argv[1]); count; count--)
    if (disp)
      printf("%d\n", count);
  putchar('\a');
  printf("Finish \n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    1181 <main+0x31>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
cmpl   $0x3,-0x4(%rbp)
jne    11b4 <main+0x64>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe8b(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11b4 <main+0x64>
movl   $0x1,-0x14(%rbp)
jmp    11bb <main+0x6b>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1203 <main+0xb3>
cmpl   $0x0,-0x14(%rbp)
je     11f0 <main+0xa0>
mov    -0x18(%rbp),%esi
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11f5 <main+0xa5>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    11cb <main+0x7b>
mov    $0x7,%edi
call   1030 <putchar@plt>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x1,%edi
jle    11d6 <main+0x76>
mov    %rsi,%rbx
cmp    $0x3,%edi
jne    1185 <main+0x25>
mov    0x10(%rbx),%rdi
lea    0xe84(%rip),%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
je     11d2 <main+0x72>
mov    $0x1,%bpl
mov    0x8(%rbx),%rdi
call   1070 <atoi@plt>
test   %eax,%eax
je     11b8 <main+0x58>
mov    %eax,%ebx
lea    0xe6a(%rip),%r14
jmp    11a5 <main+0x45>
add    $0xffffffff,%ebx
je     11b8 <main+0x58>
test   %bpl,%bpl
jne    11a0 <main+0x40>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11a0 <main+0x40>
mov    $0x7,%edi
call   1030 <putchar@plt>
lea    0xe43(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <puts@plt>
xor    %ebp,%ebp
jmp    1188 <main+0x28>
lea    0xe37(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"Put valeu in command line to count \0A\00"
@.str.1 = [8 x i8] c"display\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [9 x i8] c"Finish \0A\00"
define void @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 3
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i8**, i8*** %4
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %15
store i32 1, i32* %5
br label %23
22: ; preds = %15, %12
store i32 0, i32* %5
br label %23
23: ; preds = %22, %21
%24 = load i8**, i8*** %4
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %6
br label %28
28: ; preds = %38, %23
%29 = load i32, i32* %6
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %41
31: ; preds = %28
%32 = load i32, i32* %5
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = load i32, i32* %6
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %35)
br label %37
37: ; preds = %34, %31
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, -1
store i32 %40, i32* %6
br label %28
41: ; preds = %28
%42 = call i32 @putchar(i8 signext 7)
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"display\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [8 x i8] c"Finish \00"
@str.4 = [36 x i8] c"Put valeu in command line to count \00"
define void @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.4, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = icmp eq i32 %0, 3
br i1 %8, label %9, label %14
9: ; preds = %7
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %11, i8* dereferenceable(8) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %9, %7
br label %15
15: ; preds = %9, %14
%16 = phi i1 [ true, %14 ], [ false, %9 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 1
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = icmp eq i32 %19, 0
br i1 %20, label %28, label %21
21: ; preds = %15, %25
%22 = phi i32 [ %26, %25 ], [ %19, %15 ]
br i1 %16, label %25, label %23
23: ; preds = %21
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %25
25: ; preds = %21, %23
%26 = add nsw i32 %22, -1
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %21
28: ; preds = %25, %15
%29 = tail call i32 @putchar(i8 signext 7)
%30 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret void
}