#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ conv_hstring(char *, unsigned int *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int getline(char **, size_t *, int /*<<< orphan*/ *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
int main(int argc, char **argv) {
  FILE *input_file;
  int i;
  int bytes_read;
  size_t nbytes = 100;
  char *line_buffer;
  char s_number[12];
  unsigned int number;
  input_file = stdin;
  if (input_file == NULL) {
    printf("Input file open failed\n");
    return 1;
  }
  line_buffer = (char *)malloc(nbytes + 1);
  while ((bytes_read = getline(&line_buffer, &nbytes, input_file)) > 0) {
    sscanf(line_buffer, "%s", s_number);
    if (!conv_hstring(s_number, &number)) {
      fprintf(stderr,
              "ERROR: conv_hstring error in jumps file, number, with i = %d\n",
              i);
      return 1;
    }
    printf("%c", number);
  }
  fclose(input_file);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x64,-0x28(%rbp)
mov    0x2e53(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c1 <main+0x51>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    125c <main+0xec>
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdx
lea    -0x30(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1090 <getline@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jle    1253 <main+0xe3>
mov    -0x30(%rbp),%rdi
lea    -0x3c(%rbp),%rdx
lea    0xe1a(%rip),%rsi
call   1080 <sscanf@plt>
lea    -0x3c(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1060 <conv_hstring@plt>
cmp    $0x0,%eax
jne    123d <main+0xcd>
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
mov    -0x1c(%rbp),%edx
lea    0xdef(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    125c <main+0xec>
mov    -0x40(%rbp),%esi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d2 <main+0x62>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x64,0x10(%rsp)
mov    0x2e4a(%rip),%rax
mov    (%rax),%r15
test   %r15,%r15
je     1235 <main+0xb5>
mov    $0x65,%edi
call   1080 <malloc@plt>
mov    %rax,(%rsp)
mov    %rsp,%rdi
lea    0x10(%rsp),%rsi
mov    %r15,%rdx
call   10a0 <getline@plt>
test   %eax,%eax
jle    1229 <main+0xa9>
lea    0xe2d(%rip),%r14
lea    0x1c(%rsp),%rbx
lea    0xc(%rsp),%r12
mov    %rsp,%r13
lea    0x10(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rsp),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1090 <sscanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <conv_hstring@plt>
test   %eax,%eax
je     1243 <main+0xc3>
mov    0xc(%rsp),%edi
call   1030 <putchar@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
call   10a0 <getline@plt>
test   %eax,%eax
jg     11f0 <main+0x70>
mov    %r15,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    125d <main+0xdd>
lea    0xe05(%rip),%rdi
call   1040 <puts@plt>
jmp    1258 <main+0xd8>
mov    0x2d8e(%rip),%rax
mov    (%rax),%edi
lea    0xdb0(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [24 x i8] c"Input file open failed\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@stderr = global i32 0
@.str.2 = [62 x i8] c"ERROR: conv_hstring error in jumps file, number, with i = %d\0A\00"
@.str.3 = [3 x i8] c"%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i8*
%11 = alloca [12 x i8]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 100, i64* %9
%13 = load i32*, i32** @stdin
store i32* %13, i32** %6
%14 = load i32*, i32** %6
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %44
18: ; preds = %2
%19 = load i64, i64* %9
%20 = add i64 %19, 1
%21 = call i64 @malloc(i64 %20)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %10
br label %23
23: ; preds = %38, %18
%24 = load i32*, i32** %6
%25 = call i32 @getline(i8** %10, i64* %9, i32* %24)
store i32 %25, i32* %8
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %41
27: ; preds = %23
%28 = load i8*, i8** %10
%29 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%30 = call i32 @sscanf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%32 = call i32 @conv_hstring(i8* %31, i32* %12)
%33 = icmp ne i32 %32, 0
br i1 %33, label %38, label %34
34: ; preds = %27
%35 = load i32, i32* @stderr
%36 = load i32, i32* %7
%37 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0), i32 %36)
store i32 1, i32* %3
br label %44
38: ; preds = %27
%39 = load i32, i32* %12
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %39)
br label %23
41: ; preds = %23
%42 = load i32*, i32** %6
%43 = call i32 @fclose(i32* %42)
br label %44
44: ; preds = %41, %34, %16
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@stdin = global i32* null
@.str.1 = [3 x i8] c"%s\00"
@stderr = global i32 0
@.str.2 = [62 x i8] c"ERROR: conv_hstring error in jumps file, number, with i = %d\0A\00"
@str = [23 x i8] c"Input file open failed\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca [12 x i8]
%6 = alloca i32
%7 = bitcast i64* %3 to i8*
store i64 100, i64* %3
%8 = bitcast i8** %4 to i8*
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%10 = bitcast i32* %6 to i8*
%11 = load i32*, i32** @stdin
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
br label %35
15: ; preds = %2
%16 = tail call i64 @malloc(i64 101)
%17 = inttoptr i64 %16 to i8*
store i8* %17, i8** %4
%18 = call i32 @getline(i8** %4, i64* %3, i32* %11)
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %33
20: ; preds = %15, %28
%21 = load i8*, i8** %4
%22 = call i32 @sscanf(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%23 = call i32 @conv_hstring(i8* %9, i32* %6)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = load i32, i32* @stderr
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.2, i64 0, i64 0), i32 undef)
br label %35
28: ; preds = %20
%29 = load i32, i32* %6
%30 = call i32 @putchar(i32 %29)
%31 = call i32 @getline(i8** %4, i64* %3, i32* %11)
%32 = icmp sgt i32 %31, 0
br i1 %32, label %20, label %33
33: ; preds = %28, %15
%34 = call i32 @fclose(i32* %11)
br label %35
35: ; preds = %33, %25, %13
%36 = phi i32 [ 1, %13 ], [ 1, %25 ], [ 0, %33 ]
ret i32 %36
}