#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 elapsed_time();
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char const *, char *);
int /*<<< orphan*/ system(char *);
long do_test(char *prog, const char *file, char *suf) {
  char buf[50];
  snprintf(buf, 50, "%s %s_%s", prog, file, suf);
  elapsed_time();
  for (int i = 0; i < 1; i++) {
    system(buf);
  }
  return elapsed_time() / 1;
}


x86 assembly (clang, -O0):
<do_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
mov    -0x18(%rbp),%r9
mov    $0x32,%esi
lea    0xea0(%rip),%rdx
call   1050 <snprintf@plt>
mov    $0x0,%al
call   1030 <elapsed_time@plt>
movl   $0x0,-0x54(%rbp)
cmpl   $0x1,-0x54(%rbp)
jge    1194 <do_test+0x64>
lea    -0x50(%rbp),%rdi
call   1040 <system@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1173 <do_test+0x43>
mov    $0x0,%al
call   1030 <elapsed_time@plt>
mov    $0x1,%ecx
cltd
idiv   %ecx
cltq
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_test>:
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%r9
mov    %rsi,%r8
mov    %rdi,%rcx
lea    0xebb(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x32,%esi
call   1050 <snprintf@plt>
xor    %eax,%eax
call   1030 <elapsed_time@plt>
mov    %rbx,%rdi
call   1040 <system@plt>
xor    %eax,%eax
call   1030 <elapsed_time@plt>
cltq
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%s %s_%s\00"
define i64 @do_test(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [50 x i8]
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%10 = load i8*, i8** %4
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = call i32 @snprintf(i8* %9, i32 50, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11, i8* %12)
%14 = call i32 (...) @elapsed_time()
store i32 0, i32* %8
br label %15
15: ; preds = %21, %3
%16 = load i32, i32* %8
%17 = icmp slt i32 %16, 1
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%20 = call i32 @system(i8* %19)
br label %21
21: ; preds = %18
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
store i32 %23, i32* %8
br label %15
24: ; preds = %15
%25 = call i32 (...) @elapsed_time()
%26 = sdiv i32 %25, 1
%27 = sext i32 %26 to i64
ret i64 %27
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s %s_%s\00"
define i64 @do_test(i8* %0, i8* %1, i8* %2) {
%4 = alloca [50 x i8]
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 50, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
%7 = call i32 (...) @elapsed_time()
%8 = call i32 @system(i8* %5)
%9 = call i32 (...) @elapsed_time()
%10 = sext i32 %9 to i64
ret i64 %10
}