#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*/ *fgets(char *, int, int /*<<< orphan*/);
int find_one(int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ stdin;
int strlen(char *);
int main(int argc, char *argv[]) {
  char buf[128];
  while (fgets(buf, 128, stdin) != NULL) {
    buf[strlen(buf) - 1] = '\0';
    int a = atoi(buf);
    printf("%d %d\n", a, find_one(a));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    0x2e71(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11e8 <main+0x98>
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0x90(%rbp,%rax,1)
lea    -0x90(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x94(%rbp)
mov    -0x94(%rbp),%eax
mov    %eax,-0x98(%rbp)
mov    -0x94(%rbp),%edi
call   1060 <find_one@plt>
mov    -0x98(%rbp),%esi
mov    %eax,%edx
lea    0xe22(%rip),%rdi
call   1040 <printf@plt>
jmp    1169 <main+0x19>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    0x2e84(%rip),%r15
mov    (%r15),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     11d1 <main+0x81>
lea    0xe7d(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <find_one@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1040 <printf@plt>
mov    (%r15),%edx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1050 <fgets@plt>
test   %rax,%rax
jne    1190 <main+0x40>
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [128 x i8]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %8
8: ; preds = %13, %2
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32* @fgets(i8* %9, i32 128, i32 %10)
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %25
13: ; preds = %8
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = sub nsw i32 %15, 1
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 %17
store i8 0, i8* %18
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %7
%21 = load i32, i32* %7
%22 = load i32, i32* %7
%23 = call i32 @find_one(i32 %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %23)
br label %8
25: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32* @fgets(i8* %4, i32 128, i32 %5)
%7 = icmp eq i32* %6, null
br i1 %7, label %19, label %8
8: ; preds = %2, %8
%9 = call i32 @strlen(i8* %4)
%10 = add nsw i32 %9, -1
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 %11
store i8 0, i8* %12
%13 = call i32 @atoi(i8* %4)
%14 = call i32 @find_one(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14)
%16 = load i32, i32* @stdin
%17 = call i32* @fgets(i8* %4, i32 128, i32 %16)
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %8
19: ; preds = %8, %2
ret i32 0
}