#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 *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char const *argv[]) {
  printf("This is slader opener. Write \"exit\" to quit\n");
  char page[10], question[10];
  printf("Page number: ");
  scanf("%s", page);
  printf("Your page number is: %s\n", page);
  printf("Question number: ");
  scanf("%s", question);
  printf("Your question number: %s\n", question);
  char link[500] =
      "http://www.slader.com/textbook/"
      "9780495011668-stewart-calculus-early-transcendentals-6th-edition/";
  strcat(link, page);
  strcat(link, "/exercises/");
  strcat(link, question);
  char command[] = "xdg-open ";
  strcat(command, link);
  system(command);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x1a(%rbp),%rsi
lea    0xeab(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x1a(%rbp),%rsi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x24(%rbp),%rsi
lea    0xe7b(%rip),%rdi
call   1060 <scanf@plt>
lea    -0x24(%rbp),%rsi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x220(%rbp),%rdi
lea    0xebb(%rip),%rsi
mov    $0x1f4,%edx
call   1050 <memcpy@plt>
lea    -0x220(%rbp),%rdi
lea    -0x1a(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x220(%rbp),%rdi
lea    0xe76(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x220(%rbp),%rdi
lea    -0x24(%rbp),%rsi
call   1070 <strcat@plt>
mov    0xe66(%rip),%rax
mov    %rax,-0x22a(%rbp)
mov    0xe60(%rip),%ax
mov    %ax,-0x222(%rbp)
lea    -0x22a(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x22a(%rbp),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x218,%rsp
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7f(%rip),%r15
lea    0x16(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <scanf@plt>
lea    0xe6b(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc(%rsp),%r12
mov    %r15,%rdi
mov    %r12,%rsi
call   1070 <scanf@plt>
lea    0xe67(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeba(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    $0x1f4,%edx
mov    %rbx,%rdi
call   1060 <memcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1080 <strcat@plt>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1080 <strcat@plt>
movabs $0x6e65706f2d676478,%rax
70 65 6e
mov    %rax,(%rsp)
movw   $0x20,0x8(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <strcat@plt>
mov    %r14,%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x218,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [45 x i8] c"This is slader opener. Write \22exit\22 to quit\0A\00"
@.str.1 = [14 x i8] c"Page number: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [25 x i8] c"Your page number is: %s\0A\00"
@.str.4 = [18 x i8] c"Question number: \00"
@.str.5 = [26 x i8] c"Your question number: %s\0A\00"
@__const.main.link = [500 x i8] c"http://www.slader.com/textbook/9780495011668-stewart-calculus-early-transcendentals-6th-edition/\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.6 = [12 x i8] c"/exercises/\00"
@__const.main.command = [10 x i8] c"xdg-open \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i8]
%7 = alloca [10 x i8]
%8 = alloca [500 x i8]
%9 = alloca [10 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%12 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %19)
%21 = bitcast [500 x i8]* %8 to i8*
%22 = getelementptr inbounds [500 x i8], [500 x i8]* %8, i64 0, i64 0
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%24 = call i32 @strcat(i8* %22, i8* %23)
%25 = getelementptr inbounds [500 x i8], [500 x i8]* %8, i64 0, i64 0
%26 = call i32 @strcat(i8* %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%27 = getelementptr inbounds [500 x i8], [500 x i8]* %8, i64 0, i64 0
%28 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%29 = call i32 @strcat(i8* %27, i8* %28)
%30 = bitcast [10 x i8]* %9 to i8*
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%32 = getelementptr inbounds [500 x i8], [500 x i8]* %8, i64 0, i64 0
%33 = call i32 @strcat(i8* %31, i8* %32)
%34 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%35 = call i32 @system(i8* %34)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [14 x i8] c"Page number: \00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [25 x i8] c"Your page number is: %s\0A\00"
@.str.4 = [18 x i8] c"Question number: \00"
@.str.5 = [26 x i8] c"Your question number: %s\0A\00"
@__const.main.link = [500 x i8] c"http://www.slader.com/textbook/9780495011668-stewart-calculus-early-transcendentals-6th-edition/\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str.6 = [12 x i8] c"/exercises/\00"
@__const.main.command = [10 x i8] c"xdg-open \00"
@str = [44 x i8] c"This is slader opener. Write \22exit\22 to quit\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i8]
%4 = alloca [10 x i8]
%5 = alloca [500 x i8]
%6 = alloca [10 x i8]
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%16 = getelementptr inbounds [500 x i8], [500 x i8]* %5, i64 0, i64 0
%17 = call i32 @strcat(i8* %16, i8* %8)
%18 = call i32 @strcat(i8* %16, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 @strcat(i8* %16, i8* %9)
%20 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%21 = call i32 @strcat(i8* %20, i8* %16)
%22 = call i32 @system(i8* %20)
ret i32 0
}