#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 */
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, ...);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  FILE *fp, *wp;
  char buf_orig[100];
  float times = 1;
  float xmove, ymove;
  if (argc == 5) {
    char output_file[100];
    fp = fopen(argv[1], "r");
    sprintf(output_file, "%s-re.obj", argv[1]);
    wp = fopen(output_file, "w");
    sscanf(argv[2], "%f", &times);
    sscanf(argv[3], "%f", &xmove);
    sscanf(argv[4], "%f", &ymove);
  } else {
    printf("usage: change_obj.exe filename times xmove ymove\n");
    return -1;
  }
  while (fgets(buf_orig, 99, fp)) {
    char *buf = buf_orig;
    int read_size = 0;
    char op[10];
    sscanf(buf, "%s%n", op, &read_size);
    buf += read_size;
    if (strcmp(op, "v") == 0) {
      float x, y, z;
      sscanf(buf, "%f %f %f", &x, &y, &z);
      x = x * times + xmove;
      y = y * times + ymove;
      z *= times;
      fprintf(wp, "v %f %f %f\n", x, y, z);
    } else {
      fprintf(wp, "%s", buf_orig);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  0xe6f(%rip),%xmm0
movss  %xmm0,-0x94(%rbp)
ff
cmpl   $0x5,-0x8(%rbp)
jne    1249 <main+0xd9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe52(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x100(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe35(%rip),%rsi
call   1090 <sprintf@plt>
lea    -0x100(%rbp),%rdi
lea    0xe2c(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe55(%rip),%rsi
lea    -0x94(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe38(%rip),%rsi
lea    -0x98(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
lea    0xe1b(%rip),%rsi
lea    -0x9c(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
jmp    1261 <main+0xf1>
lea    0xdc2(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    13e9 <main+0x279>
jmp    1266 <main+0xf6>
lea    -0x90(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x63,%esi
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     13e2 <main+0x272>
lea    -0x90(%rbp),%rax
mov    %rax,-0x108(%rbp)
movl   $0x0,-0x10c(%rbp)
mov    -0x108(%rbp),%rdi
lea    -0x116(%rbp),%rdx
lea    0xd92(%rip),%rsi
lea    -0x10c(%rbp),%rcx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x10c(%rbp),%ecx
mov    -0x108(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x108(%rbp)
lea    -0x116(%rbp),%rdi
lea    0xd61(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    13c4 <main+0x254>
mov    -0x108(%rbp),%rdi
lea    0xd46(%rip),%rsi
lea    -0x11c(%rbp),%rdx
lea    -0x120(%rbp),%rcx
lea    -0x124(%rbp),%r8
mov    $0x0,%al
call   1070 <sscanf@plt>
movss  -0x11c(%rbp),%xmm0
ff
movss  -0x94(%rbp),%xmm2
ff
movss  -0x98(%rbp),%xmm1
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x11c(%rbp)
ff
movss  -0x120(%rbp),%xmm0
ff
movss  -0x94(%rbp),%xmm2
ff
movss  -0x9c(%rbp),%xmm1
ff
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x120(%rbp)
ff
movss  -0x94(%rbp),%xmm0
ff
mulss  -0x124(%rbp),%xmm0
ff
movss  %xmm0,-0x124(%rbp)
ff
mov    -0x20(%rbp),%rdi
movss  -0x11c(%rbp),%xmm0
ff
cvtss2sd %xmm0,%xmm0
movss  -0x120(%rbp),%xmm1
ff
cvtss2sd %xmm1,%xmm1
movss  -0x124(%rbp),%xmm2
ff
cvtss2sd %xmm2,%xmm2
lea    0xc9c(%rip),%rsi
mov    $0x3,%al
call   1060 <fprintf@plt>
jmp    13dd <main+0x26d>
mov    -0x20(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xc8a(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
jmp    1266 <main+0xf6>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
movl   $0x3f800000,0x18(%rsp)
3f
cmp    $0x5,%edi
jne    133f <main+0x1bf>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xe50(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdx
lea    0xe3f(%rip),%rsi
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
call   10a0 <sprintf@plt>
lea    0xe35(%rip),%rsi
mov    %rbp,%rdi
call   1090 <fopen@plt>
mov    %rax,%r12
mov    0x10(%rbx),%rdi
lea    0xe2e(%rip),%r15
xor    %ebp,%ebp
lea    0x18(%rsp),%rdx
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    0x18(%rbx),%rdi
lea    0x20(%rsp),%rdx
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    0x20(%rbx),%rdi
lea    0x1c(%rsp),%rdx
mov    %r15,%rsi
xor    %eax,%eax
call   1080 <sscanf@plt>
lea    0x30(%rsp),%rdi
mov    $0x63,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1354 <main+0x1d4>
lea    0x30(%rsp),%rbx
lea    0x26(%rsp),%r13
lea    0xdc3(%rip),%r15
jmp    1284 <main+0x104>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
mov    $0x63,%esi
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     1352 <main+0x1d2>
movl   $0x0,0x14(%rsp)
mov    %rbx,%rdi
lea    0xd78(%rip),%rsi
mov    %r13,%rdx
lea    0x14(%rsp),%rcx
xor    %eax,%eax
call   1080 <sscanf@plt>
movslq 0x14(%rsp),%rbp
mov    %r13,%rdi
mov    %r15,%rsi
call   1060 <strcmp@plt>
test   %rax,%rax
jne    1260 <main+0xe0>
lea    (%rsp,%rbp,1),%rdi
add    $0x30,%rdi
lea    0xd4c(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
xor    %eax,%eax
call   1080 <sscanf@plt>
movss  0x18(%rsp),%xmm2
movss  0x10(%rsp),%xmm0
mulss  %xmm2,%xmm0
addss  0x20(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
mulss  %xmm2,%xmm1
addss  0x1c(%rsp),%xmm1
movss  %xmm0,0x10(%rsp)
movss  %xmm1,0xc(%rsp)
mulss  0x8(%rsp),%xmm2
movss  %xmm2,0x8(%rsp)
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm2,%xmm2
mov    %r12,%rdi
lea    0xceb(%rip),%rsi
mov    $0x3,%al
call   1070 <fprintf@plt>
jmp    126b <main+0xeb>
lea    0xce4(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%ebp
jmp    1354 <main+0x1d4>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [10 x i8] c"%s-re.obj\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.4 = [50 x i8] c"usage: change_obj.exe filename times xmove ymove\0A\00"
@.str.5 = [5 x i8] c"%s%n\00"
@.str.6 = [2 x i8] c"v\00"
@.str.7 = [9 x i8] c"%f %f %f\00"
@.str.8 = [12 x i8] c"v %f %f %f\0A\00"
@.str.9 = [3 x i8] c"%s\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 [100 x i8]
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca [100 x i8]
%13 = alloca i8*
%14 = alloca i32
%15 = alloca [10 x i8]
%16 = alloca float
%17 = alloca float
%18 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store float 1.000000e+00, float* %9
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 5
br i1 %20, label %21, label %45
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %25, i32** %6
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %32, i32** %7
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 2
%35 = load i8*, i8** %34
%36 = call i32 (i8*, i8*, ...) @sscanf(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %9)
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 3
%39 = load i8*, i8** %38
%40 = call i32 (i8*, i8*, ...) @sscanf(i8* %39, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %10)
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 4
%43 = load i8*, i8** %42
%44 = call i32 (i8*, i8*, ...) @sscanf(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %11)
br label %47
45: ; preds = %2
%46 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %3
br label %93
47: ; preds = %21
br label %48
48: ; preds = %91, %47
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%50 = load i32*, i32** %6
%51 = call i64 @fgets(i8* %49, i32 99, i32* %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %92
53: ; preds = %48
%54 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
store i8* %54, i8** %13
store i32 0, i32* %14
%55 = load i8*, i8** %13
%56 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%57 = call i32 (i8*, i8*, ...) @sscanf(i8* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %56, i32* %14)
%58 = load i32, i32* %14
%59 = load i8*, i8** %13
%60 = sext i32 %58 to i64
%61 = getelementptr inbounds i8, i8* %59, i64 %60
store i8* %61, i8** %13
%62 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%63 = call i64 @strcmp(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %87
65: ; preds = %53
%66 = load i8*, i8** %13
%67 = call i32 (i8*, i8*, ...) @sscanf(i8* %66, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), float* %16, float* %17, float* %18)
%68 = load float, float* %16
%69 = load float, float* %9
%70 = load float, float* %10
%71 = call float @llvm.fmuladd.f32(float %68, float %69, float %70)
store float %71, float* %16
%72 = load float, float* %17
%73 = load float, float* %9
%74 = load float, float* %11
%75 = call float @llvm.fmuladd.f32(float %72, float %73, float %74)
store float %75, float* %17
%76 = load float, float* %9
%77 = load float, float* %18
%78 = fmul float %77, %76
store float %78, float* %18
%79 = load i32*, i32** %7
%80 = load float, float* %16
%81 = fpext float %80 to double
%82 = load float, float* %17
%83 = fpext float %82 to double
%84 = load float, float* %18
%85 = fpext float %84 to double
%86 = call i32 (i32*, i8*, ...) @fprintf(i32* %79, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), double %81, double %83, double %85)
br label %91
87: ; preds = %53
%88 = load i32*, i32** %7
%89 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%90 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i8* %89)
br label %91
91: ; preds = %87, %65
br label %48
92: ; preds = %48
store i32 0, i32* %3
br label %93
93: ; preds = %92, %45
%94 = load i32, i32* %3
ret i32 %94
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [10 x i8] c"%s-re.obj\00"
@.str.2 = [2 x i8] c"w\00"
@.str.3 = [3 x i8] c"%f\00"
@.str.5 = [5 x i8] c"%s%n\00"
@.str.6 = [2 x i8] c"v\00"
@.str.7 = [9 x i8] c"%f %f %f\00"
@.str.8 = [12 x i8] c"v %f %f %f\0A\00"
@str = [49 x i8] c"usage: change_obj.exe filename times xmove ymove\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca [100 x i8]
%8 = alloca i32
%9 = alloca [10 x i8]
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%14 = bitcast float* %4 to i8*
store float 1.000000e+00, float* %4
%15 = bitcast float* %5 to i8*
%16 = bitcast float* %6 to i8*
%17 = icmp eq i32 %0, 5
br i1 %17, label %18, label %43
18: ; preds = %2
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%23 = load i8*, i8** %20
%24 = call i32 @sprintf(i8* %19, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%26 = getelementptr inbounds i8*, i8** %1, i64 2
%27 = load i8*, i8** %26
%28 = call i32 (i8*, i8*, ...) @sscanf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %4)
%29 = getelementptr inbounds i8*, i8** %1, i64 3
%30 = load i8*, i8** %29
%31 = call i32 (i8*, i8*, ...) @sscanf(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %5)
%32 = getelementptr inbounds i8*, i8** %1, i64 4
%33 = load i8*, i8** %32
%34 = call i32 (i8*, i8*, ...) @sscanf(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), float* %6)
%35 = call i64 @fgets(i8* %13, i32 99, i32* %22)
%36 = icmp eq i64 %35, 0
br i1 %36, label %72, label %37
37: ; preds = %18
%38 = bitcast i32* %8 to i8*
%39 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%40 = bitcast float* %10 to i8*
%41 = bitcast float* %11 to i8*
%42 = bitcast float* %12 to i8*
br label %45
43: ; preds = %2
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
br label %72
45: ; preds = %37, %69
store i32 0, i32* %8
%46 = call i32 (i8*, i8*, ...) @sscanf(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %39, i32* %8)
%47 = load i32, i32* %8
%48 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %67
50: ; preds = %45
%51 = sext i32 %47 to i64
%52 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %51
%53 = call i32 (i8*, i8*, ...) @sscanf(i8* %52, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), float* %10, float* %11, float* %12)
%54 = load float, float* %10
%55 = load float, float* %4
%56 = load float, float* %5
%57 = call float @llvm.fmuladd.f32(float %54, float %55, float %56)
store float %57, float* %10
%58 = load float, float* %11
%59 = load float, float* %6
%60 = call float @llvm.fmuladd.f32(float %58, float %55, float %59)
store float %60, float* %11
%61 = load float, float* %12
%62 = fmul float %55, %61
store float %62, float* %12
%63 = fpext float %57 to double
%64 = fpext float %60 to double
%65 = fpext float %62 to double
%66 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), double %63, double %64, double %65)
br label %69
67: ; preds = %45
%68 = call i32 @fputs(i8* %13, i32* %25)
br label %69
69: ; preds = %67, %50
%70 = call i64 @fgets(i8* %13, i32 99, i32* %22)
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %45
72: ; preds = %69, %18, %43
%73 = phi i32 [ -1, %43 ], [ 0, %18 ], [ 0, %69 ]
ret i32 %73
}