#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int readArgs(int argc, char *argv[]) {
  int n;
  if (argc >= 2 && atoi(argv[1]) >= 1 && atoi(argv[1]) <= 100000) {
    n = atoi(argv[1]);
  } else {
    if (1 == 0)
      printf("n: ");
    scanf("%d", &n);
  }
  return n;
}


x86 assembly (clang, -O0):
<readArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jl     117c <readArgs+0x5c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
cmp    $0x1,%eax
jl     117c <readArgs+0x5c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
cmp    $0x186a0,%eax
jg     117c <readArgs+0x5c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    118c <readArgs+0x6c>
lea    0xe7d(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readArgs>:
push   %rax
cmp    $0x2,%edi
jl     113c <readArgs+0x1c>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
add    $0xffffffff,%ecx
cmp    $0x186a0,%ecx
jb     1151 <readArgs+0x31>
lea    0xebd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @readArgs(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 2
br i1 %7, label %8, label %25
8: ; preds = %2
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @atoi(i8* %11)
%13 = icmp sge i32 %12, 1
br i1 %13, label %14, label %25
14: ; preds = %8
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
%19 = icmp sle i32 %18, 100000
br i1 %19, label %20, label %25
20: ; preds = %14
%21 = load i8**, i8*** %4
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %5
br label %27
25: ; preds = %14, %8, %2
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
br label %27
27: ; preds = %25, %20
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @readArgs(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %12
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = add i32 %9, -1
%11 = icmp ult i32 %10, 100000
br i1 %11, label %15, label %12
12: ; preds = %6, %2
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %3
br label %15
15: ; preds = %6, %12
%16 = phi i32 [ %14, %12 ], [ %9, %6 ]
ret i32 %16
}