#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(int);
int main(int argc, char *argv[]) {
  int c;
  if (argc != 2)
    return 1;
  printf("%s/", argv[1]);
  while ((c = getchar()) != EOF) {
    putchar(c);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     115c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    119d <main+0x6d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e67(%rip),%rcx
cmp    (%rcx),%eax
je     1196 <main+0x66>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    1170 <main+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
cmp    $0x2,%edi
jne    1183 <main+0x53>
mov    0x8(%rsi),%rsi
lea    0xeb7(%rip),%rdi
call   1040 <printf@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e8a(%rip),%r14
cmp    (%r14),%eax
je     1183 <main+0x53>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%r14),%eax
jne    1170 <main+0x40>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s/\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 1, i32* %3
br label %23
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %19, %10
%16 = call i32 (...) @getchar()
store i32 %16, i32* %6
%17 = load i32, i32* @EOF
%18 = icmp ne i32 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* %6
%21 = call i32 @putchar(i32 %20)
br label %15
22: ; preds = %15
store i32 0, i32* %3
br label %23
23: ; preds = %22, %9
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s/\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %17
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 (...) @getchar()
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %10, label %17, label %11
11: ; preds = %4, %11
%12 = phi i32 [ %14, %11 ], [ %8, %4 ]
%13 = tail call i32 @putchar(i32 %12)
%14 = tail call i32 (...) @getchar()
%15 = load i32, i32* @EOF
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %11
17: ; preds = %11, %4, %2
%18 = phi i32 [ 1, %2 ], [ 0, %4 ], [ 0, %11 ]
ret i32 %18
}