#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*/ read_varid();
int /*<<< orphan*/ write_src(char *, ...);
void input_handler(void) {
  write_src("{\n");
  write_src("vartype val;\n");
  write_src("scanf(\"%s\", &val);\n", "%d");
  write_src("setvar(%d, val);\n", read_varid());
  write_src("}\n");
}


x86 assembly (clang, -O0):
<input_handler>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <write_src@plt>
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <write_src@plt>
lea    0xeca(%rip),%rdi
lea    0xed7(%rip),%rsi
mov    $0x0,%al
call   1030 <write_src@plt>
mov    $0x0,%al
call   1040 <read_varid@plt>
mov    %eax,%esi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <write_src@plt>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <write_src@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<input_handler>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <write_src@plt>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <write_src@plt>
lea    0xecd(%rip),%rdi
lea    0xeda(%rip),%rsi
xor    %eax,%eax
call   1030 <write_src@plt>
xor    %eax,%eax
call   1040 <read_varid@plt>
lea    0xec8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <write_src@plt>
lea    0xeca(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <write_src@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"{\0A\00"
@.str.1 = [14 x i8] c"vartype val;\0A\00"
@.str.2 = [20 x i8] c"scanf(\22%s\22, &val);\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [18 x i8] c"setvar(%d, val);\0A\00"
@.str.5 = [3 x i8] c"}\0A\00"
define void @input_handler() {
%1 = call i32 (i8*, ...) @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (i8*, ...) @write_src(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (i8*, ...) @write_src(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%4 = call i32 (...) @read_varid()
%5 = call i32 (i8*, ...) @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %4)
%6 = call i32 (i8*, ...) @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"{\0A\00"
@.str.1 = [14 x i8] c"vartype val;\0A\00"
@.str.2 = [20 x i8] c"scanf(\22%s\22, &val);\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [18 x i8] c"setvar(%d, val);\0A\00"
@.str.5 = [3 x i8] c"}\0A\00"
define void @input_handler() {
%1 = tail call i32 (i8*, ...) @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @write_src(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @write_src(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 (...) @read_varid()
%5 = tail call i32 (i8*, ...) @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i32 %4)
%6 = tail call i32 (i8*, ...) @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
ret void
}