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

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
char *basename(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ round_for_all(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  char *p = NULL;
  size_t len;
  ssize_t nbytes;
  FILE *fin, *fout;
  char *fin_name, *fout_name;
  if (argc < 3) {
    fprintf(stderr, "Usage: %s <input> <output>\n", basename(argv[0]));
    return EXIT_FAILURE;
  }
  fin_name = argv[1];
  fout_name = argv[2];
  fin = fopen(fin_name, "r");
  if (fin == NULL) {
    perror("Could not open input for reading");
    return EXIT_FAILURE;
  }
  fout = fopen(fout_name, "w");
  if (fout == NULL) {
    perror("Could not open output for writing");
    return EXIT_FAILURE;
  }
  fprintf(fout, "/* This file was generated by %s from %s.  */\n",
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/NicoleRobin/glibc/refs/heads/master/"
          "stdlib/gen-tst-strtod-round.c",
          fin_name);
  fputs("static const struct test tests[] = {\n", fout);
  while ((nbytes = getline(&p, &len, fin)) != -1) {
    if (p[nbytes - 1] == '\n')
      p[nbytes - 1] = 0;
    round_for_all(fout, p);
    free(p);
    p = NULL;
  }
  fputs("};\n", fout);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11e8 <main+0x68>
mov    0x2e31(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <basename@plt>
mov    -0x50(%rbp),%rdi
mov    %rax,%rdx
lea    0xe30(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dfa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    132c <main+0x1ac>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xe11(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    123c <main+0xbc>
lea    0xdf8(%rip),%rdi
call   1090 <perror@plt>
mov    0x2da6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    132c <main+0x1ac>
mov    -0x48(%rbp),%rdi
lea    0xdf8(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1278 <main+0xf8>
lea    0xddf(%rip),%rdi
call   1090 <perror@plt>
mov    0x2d6a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    132c <main+0x1ac>
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rcx
lea    0xddc(%rip),%rsi
lea    0xe04(%rip),%rdx
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    -0x38(%rbp),%rsi
lea    0xe8e(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x30(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   10a0 <getline@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     1310 <main+0x190>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    12ed <main+0x16d>
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <round_for_all@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
jmp    12a5 <main+0x125>
mov    -0x38(%rbp),%rsi
lea    0xe39(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2ca9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x8(%rsp)
cmp    $0x2,%edi
jg     11cb <main+0x4b>
mov    0x2e40(%rip),%rax
movslq (%rax),%rbx
mov    (%rsi),%rdi
call   1060 <basename@plt>
lea    0xe4e(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x2e12(%rip),%rax
jmp    12c8 <main+0x148>
mov    0x8(%rsi),%r15
mov    0x10(%rsi),%rbx
lea    0xe42(%rip),%rsi
mov    %r15,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     12d6 <main+0x156>
mov    %rax,%r14
lea    0xe4a(%rip),%rsi
mov    %rbx,%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     12df <main+0x15f>
mov    %rax,%rbx
lea    0xe53(%rip),%rsi
lea    0xe7b(%rip),%rdx
mov    %rax,%rdi
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xf03(%rip),%rdi
mov    $0x25,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %r14,%rdx
call   1090 <getline@plt>
cmp    $0xffffffff,%eax
je     12a8 <main+0x128>
lea    0x8(%rsp),%r15
lea    0x10(%rsp),%r12
jmp    128e <main+0x10e>
mov    %rbx,%rdi
call   1040 <round_for_all@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
movq   $0x0,0x8(%rsp)
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1090 <getline@plt>
cmp    $0xffffffff,%eax
je     12a8 <main+0x128>
mov    0x8(%rsp),%rsi
cltq
cmpb   $0xa,-0x1(%rax,%rsi,1)
jne    1260 <main+0xe0>
movb   $0x0,-0x1(%rsi,%rax,1)
mov    0x8(%rsp),%rsi
jmp    1260 <main+0xe0>
lea    0xea5(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10a0 <fwrite@plt>
mov    0x2d08(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xd41(%rip),%rdi
jmp    12e6 <main+0x166>
lea    0xd5b(%rip),%rdi
call   1080 <perror@plt>
mov    0x2ce6(%rip),%rax
jmp    12c8 <main+0x148>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: %s <input> <output>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [33 x i8] c"Could not open input for reading\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [34 x i8] c"Could not open output for writing\00"
@.str.5 = [47 x i8] c"/* This file was generated by %s from %s. */\0A\00"
@.str.6 = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NicoleRobin/glibc/refs/heads/master/stdlib/gen-tst-strtod-round.c\00"
@.str.7 = [38 x i8] c"static const struct test tests[] = {\0A\00"
@.str.8 = [4 x i8] c"};\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
%13 = load i32, i32* %4
%14 = icmp slt i32 %13, 3
br i1 %14, label %15, label %25
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i8* @basename(i8* %21)
%23 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %18, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %22)
%24 = load i32, i32* @EXIT_FAILURE
store i32 %24, i32* %3
br label %82
25: ; preds = %2
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
store i8* %28, i8** %11
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
store i8* %31, i8** %12
%32 = load i8*, i8** %11
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %33, i32** %9
%34 = load i32*, i32** %9
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %39
36: ; preds = %25
%37 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
store i32 %38, i32* %3
br label %82
39: ; preds = %25
%40 = load i8*, i8** %12
%41 = call i32* @fopen(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %41, i32** %10
%42 = load i32*, i32** %10
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
%46 = load i32, i32* @EXIT_FAILURE
store i32 %46, i32* %3
br label %82
47: ; preds = %39
%48 = load i32*, i32** %10
%49 = load i8*, i8** %11
%50 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.6, i64 0, i64 0), i8* %49)
%51 = load i32*, i32** %10
%52 = call i32 @fputs(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32* %51)
br label %53
53: ; preds = %72, %47
%54 = load i32*, i32** %9
%55 = call i32 @getline(i8** %6, i64* %7, i32* %54)
store i32 %55, i32* %8
%56 = icmp ne i32 %55, -1
br i1 %56, label %57, label %78
57: ; preds = %53
%58 = load i8*, i8** %6
%59 = load i32, i32* %8
%60 = sub nsw i32 %59, 1
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %58, i64 %61
%63 = load i8, i8* %62
%64 = sext i8 %63 to i32
%65 = icmp eq i32 %64, 10
br i1 %65, label %66, label %72
66: ; preds = %57
%67 = load i8*, i8** %6
%68 = load i32, i32* %8
%69 = sub nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %67, i64 %70
store i8 0, i8* %71
br label %72
72: ; preds = %66, %57
%73 = load i32*, i32** %10
%74 = load i8*, i8** %6
%75 = call i32 @round_for_all(i32* %73, i8* %74)
%76 = load i8*, i8** %6
%77 = call i32 @free(i8* %76)
store i8* null, i8** %6
br label %53
78: ; preds = %53
%79 = load i32*, i32** %10
%80 = call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i32* %79)
%81 = load i32, i32* @EXIT_SUCCESS
store i32 %81, i32* %3
br label %82
82: ; preds = %78, %44, %36, %15
%83 = load i32, i32* %3
ret i32 %83
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Usage: %s <input> <output>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [33 x i8] c"Could not open input for reading\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [34 x i8] c"Could not open output for writing\00"
@.str.5 = [47 x i8] c"/* This file was generated by %s from %s. */\0A\00"
@.str.6 = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NicoleRobin/glibc/refs/heads/master/stdlib/gen-tst-strtod-round.c\00"
@.str.7 = [38 x i8] c"static const struct test tests[] = {\0A\00"
@.str.8 = [4 x i8] c"};\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%6 = bitcast i64* %4 to i8*
%7 = icmp slt i32 %0, 3
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load i8*, i8** %1
%13 = tail call i8* @basename(i8* %12)
%14 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %53
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
%20 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %24
22: ; preds = %15
%23 = tail call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %53
24: ; preds = %15
%25 = tail call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i32* %25, null
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = tail call i32 @perror(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %53
29: ; preds = %24
%30 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str.6, i64 0, i64 0), i8* %17)
%31 = tail call i64 @fwrite(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i64 37, i64 1, i32* %25)
%32 = call i32 @getline(i8** %3, i64* %4, i32* %20)
%33 = icmp eq i32 %32, -1
br i1 %33, label %51, label %34
34: ; preds = %29, %44
%35 = phi i32 [ %49, %44 ], [ %32, %29 ]
%36 = load i8*, i8** %3
%37 = add nsw i32 %35, -1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 10
br i1 %41, label %42, label %44
42: ; preds = %34
store i8 0, i8* %39
%43 = load i8*, i8** %3
br label %44
44: ; preds = %42, %34
%45 = phi i8* [ %43, %42 ], [ %36, %34 ]
%46 = call i32 @round_for_all(i32* %25, i8* %45)
%47 = load i8*, i8** %3
%48 = call i32 @free(i8* %47)
store i8* null, i8** %3
%49 = call i32 @getline(i8** %3, i64* %4, i32* %20)
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %34
51: ; preds = %44, %29
%52 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i64 3, i64 1, i32* %25)
br label %53
53: ; preds = %51, %27, %22, %8
%54 = phi i32* [ @EXIT_FAILURE, %8 ], [ @EXIT_FAILURE, %22 ], [ @EXIT_FAILURE, %27 ], [ @EXIT_SUCCESS, %51 ]
%55 = load i32, i32* %54
ret i32 %55
}