#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 BUFSIZ;
scalar_t__ gets(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
char *reform(char *);
dtest() {
  char buf[BUFSIZ];
  register char *cp;
  while (gets(buf)) {
    cp = reform(buf);
    printf("\"%s\"	\"%s\"\n", buf, cp);
  }
}


x86 assembly (clang, -O0):
<dtest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x28(%rbp),%rdi
call   1050 <gets@plt>
cmp    $0x0,%rax
je     119d <dtest+0x6d>
mov    -0x28(%rbp),%rdi
call   1030 <reform@plt>
mov    -0x28(%rbp),%rsi
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
jmp    1164 <dtest+0x34>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtest>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
call   1050 <gets@plt>
test   %rax,%rax
je     1193 <dtest+0x63>
lea    0xe9b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1030 <reform@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
test   %rax,%rax
jne    1170 <dtest+0x40>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [11 x i8] c"\22%s\22\09\22%s\22\0A\00"
define i32 @dtest() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
%5 = load i32, i32* @BUFSIZ
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %2
%8 = alloca i8, i64 %6
store i64 %6, i64* %3
br label %9
9: ; preds = %12, %0
%10 = call i64 @gets(i8* %8)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = call i8* @reform(i8* %8)
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %14)
br label %9
16: ; preds = %9
%17 = load i8*, i8** %2
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [11 x i8] c"\22%s\22\09\22%s\22\0A\00"
define i32 @dtest() {
%1 = load i32, i32* @BUFSIZ
%2 = zext i32 %1 to i64
%3 = alloca i8, i64 %2
%4 = call i64 @gets(i8* %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %0, %6
%7 = call i8* @reform(i8* %3)
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %7)
%9 = call i64 @gets(i8* %3)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %0
ret i32 undef
}