#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*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char buffer[4096];
  int current_line;
  int display_line;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s line_number (one based)\n", argv[0]);
    exit(1);
  }
  display_line = atoi(argv[1]);
  current_line = 0;
  while (get_line(buffer, stdin)) {
    if (++current_line == display_line) {
      printf("%s\n", buffer);
      return 0;
    }
  }
  exit(1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1199 <main+0x49>
mov    0x2e5e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe76(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1018(%rbp)
movl   $0x0,-0x1014(%rbp)
lea    -0x1010(%rbp),%rdi
mov    0x2e24(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     1213 <main+0xc3>
mov    -0x1014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1014(%rbp)
cmp    -0x1018(%rbp),%eax
jne    120e <main+0xbe>
lea    -0x1010(%rbp),%rsi
lea    0xe25(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1020,%rsp
pop    %rbp
ret
jmp    11b6 <main+0x66>
mov    $0x1,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1000,%rsp
cmp    $0x2,%edi
jne    11bd <main+0x6d>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    0x2e75(%rip),%r15
mov    %rsp,%r14
cs nopw 0x0(%rax,%rax,1)
mov    (%r15),%esi
mov    %r14,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     11b3 <main+0x63>
add    $0xffffffff,%ebx
jne    1180 <main+0x30>
lea    0xe87(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe30(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Usage: %s line_number (one based)\0A\00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %18
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %8
store i32 0, i32* %7
br label %23
23: ; preds = %36, %18
%24 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%25 = load i32, i32* @stdin
%26 = call i64 @get_line(i8* %24, i32 %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %37
28: ; preds = %23
%29 = load i32, i32* %7
%30 = add nsw i32 %29, 1
store i32 %30, i32* %7
%31 = load i32, i32* %8
%32 = icmp eq i32 %30, %31
br i1 %32, label %33, label %36
33: ; preds = %28
%34 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %34)
ret i32 0
36: ; preds = %28
br label %23
37: ; preds = %23
%38 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Usage: %s line_number (one based)\0A\00"
@stdin = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
br label %15
15: ; preds = %20, %11
%16 = phi i32 [ 0, %11 ], [ %21, %20 ]
%17 = load i32, i32* @stdin
%18 = call i64 @get_line(i8* %4, i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %15
%21 = add nuw nsw i32 %16, 1
%22 = icmp eq i32 %21, %14
br i1 %22, label %23, label %15
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 0
25: ; preds = %15
%26 = call i32 @exit(i32 1)
unreachable
}