#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*/ system(char *);
int main(int argc, char *argv[]) {
  char buf[1024] = "chvt ";
  buf[5] = argv[1][0];
  system(buf);
  buf[5] = argv[2][0];
  buf[6] = argv[2][1];
  buf[7] = argv[2][2];
  system(buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
movb   $0x63,-0x410(%rbp)
movb   $0x68,-0x40f(%rbp)
movb   $0x76,-0x40e(%rbp)
movb   $0x74,-0x40d(%rbp)
movb   $0x20,-0x40c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x40b(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%al
mov    %al,-0x40b(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    0x1(%rax),%al
mov    %al,-0x40a(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    0x2(%rax),%al
mov    %al,-0x409(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rsi,%rbx
mov    %rsp,%r14
mov    $0x400,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
movl   $0x74766863,(%rsp)
movb   $0x20,0x4(%rsp)
mov    0x8(%rbx),%rax
mov    (%rax),%al
mov    %al,0x5(%rsp)
mov    %r14,%rdi
call   1030 <system@plt>
mov    0x10(%rbx),%rax
mov    (%rax),%cl
mov    %cl,0x5(%rsp)
mov    0x1(%rax),%cl
mov    %cl,0x6(%rsp)
mov    0x2(%rax),%al
mov    %al,0x7(%rsp)
mov    %r14,%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [1024 x i8]* %6 to i8*
%8 = bitcast i8* %7 to [1024 x i8]*
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i32 0, i32 0
store i8 99, i8* %9
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i32 0, i32 1
store i8 104, i8* %10
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i32 0, i32 2
store i8 118, i8* %11
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i32 0, i32 3
store i8 116, i8* %12
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i32 0, i32 4
store i8 32, i8* %13
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 5
store i8 %18, i8* %19
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%21 = call i32 @system(i8* %20)
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8, i8* %24, i64 0
%26 = load i8, i8* %25
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 5
store i8 %26, i8* %27
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 2
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load i8, i8* %31
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 6
store i8 %32, i8* %33
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = getelementptr inbounds i8, i8* %36, i64 2
%38 = load i8, i8* %37
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 7
store i8 %38, i8* %39
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%41 = call i32 @system(i8* %40)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
store i8 99, i8* %4
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1
store i8 104, i8* %5
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 2
store i8 118, i8* %6
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 3
store i8 116, i8* %7
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 4
store i8 32, i8* %8
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 5
store i8 %11, i8* %12
%13 = call i32 @system(i8* %4)
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
store i8 %16, i8* %12
%17 = getelementptr inbounds i8, i8* %15, i64 1
%18 = load i8, i8* %17
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 6
store i8 %18, i8* %19
%20 = getelementptr inbounds i8, i8* %15, i64 2
%21 = load i8, i8* %20
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 7
store i8 %21, i8* %22
%23 = call i32 @system(i8* %4)
ret i32 0
}