#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
int main(void) {
  char ans[] = "yes";
  int i;
  char ans1[4];
  printf("Do you want to download this package? (yes/no): ");
  scanf("%s", ans1);
  if (strcmp(ans, ans1) == 0) {
    for (i = 0; i < 101; i++) {
      printf("Downloading....%d%%.\n", i);
      system("sleep 2");
      system("clear");
    }
    printf("Download complete.....%d%%\n", i - 1);
    printf("Package now Available and Ready for Use.\n");
  } else {
    printf("Download Aborted, Exiting......\n");
    system("sleep 2");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeab(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x10(%rbp),%rsi
lea    0xec4(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11fc <main+0xbc>
movl   $0x0,-0xc(%rbp)
cmpl   $0x65,-0xc(%rbp)
jge    11d5 <main+0x95>
mov    -0xc(%rbp),%esi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe98(%rip),%rdi
call   1030 <system@plt>
lea    0xe94(%rip),%rdi
call   1030 <system@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1194 <main+0x54>
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1216 <main+0xd6>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe3d(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
movl   $0x736579,(%rsp)
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebe(%rip),%rdi
lea    0x4(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
je     11aa <main+0x5a>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
lea    0xea7(%rip),%rdi
call   1040 <system@plt>
jmp    1213 <main+0xc3>
lea    0xe83(%rip),%r14
lea    0xe92(%rip),%r15
lea    0xe93(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <system@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
add    $0x1,%ebp
cmp    $0x65,%ebp
jne    11d0 <main+0x80>
lea    0xe5d(%rip),%rdi
mov    $0x64,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe86(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.ans = [4 x i8] c"yes\00"
@.str = [49 x i8] c"Do you want to download this package? (yes/no): \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [22 x i8] c"Downloading....%d%%.\0A\00"
@.str.3 = [8 x i8] c"sleep 2\00"
@.str.4 = [6 x i8] c"clear\00"
@.str.5 = [28 x i8] c"Download complete.....%d%%\0A\00"
@.str.6 = [42 x i8] c"Package now Available and Ready for Use.\0A\00"
@.str.7 = [33 x i8] c"Download Aborted, Exiting......\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca i32
%4 = alloca [4 x i8]
store i32 0, i32* %1
%5 = bitcast [4 x i8]* %2 to i8*
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%11 = call i64 @strcmp(i8* %9, i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %30
13: ; preds = %0
store i32 0, i32* %3
br label %14
14: ; preds = %22, %13
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 101
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %17
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %14
25: ; preds = %14
%26 = load i32, i32* %3
%27 = sub nsw i32 %26, 1
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 %27)
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.6, i64 0, i64 0))
br label %33
30: ; preds = %0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0))
%32 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %33
33: ; preds = %30, %25
ret i32 0
}

LLVM IR (-O2):
@.str = [49 x i8] c"Do you want to download this package? (yes/no): \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [22 x i8] c"Downloading....%d%%.\0A\00"
@.str.3 = [8 x i8] c"sleep 2\00"
@.str.4 = [6 x i8] c"clear\00"
@.str.5 = [28 x i8] c"Download complete.....%d%%\0A\00"
@str = [32 x i8] c"Download Aborted, Exiting......\00"
@str.8 = [41 x i8] c"Package now Available and Ready for Use.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = bitcast i32* %1 to i8*
store i32 7562617, i32* %1
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%7 = call i64 @strcmp(i8* %3, i8* %4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %0, %9
%10 = phi i32 [ %14, %9 ], [ 0, %0 ]
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%14 = add nuw nsw i32 %10, 1
%15 = icmp eq i32 %14, 101
br i1 %15, label %16, label %9
16: ; preds = %9
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i32 100)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.8, i64 0, i64 0))
br label %22
19: ; preds = %0
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%21 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
br label %22
22: ; preds = %19, %16
ret i32 0
}