#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ timeConv(int);
int main(int argc, char **argv) {
  struct competitor {
    char name[30];
    int swimSecs;
    int cyclSecs;
    int runSecs;
    int totalSecs;
  };
  struct competitor a;
  printf("Please enter a name:");
  scanf(" %s", a.name);
  printf("Please enter swimming time in seconds:");
  scanf("%d", &(a.swimSecs));
  printf("Please enter cycle time in seconds:");
  scanf("%d", &(a.cyclSecs));
  printf("Please enter running time in seconds:");
  scanf("%d", &(a.runSecs));
  a.totalSecs = a.swimSecs + a.cyclSecs + a.runSecs;
  printf("Competitor's name: %s\n", a.name);
  printf("Time for Swim: ");
  timeConv(a.swimSecs);
  printf("\nTime for Cycle race: ");
  timeConv(a.cyclSecs);
  printf("\nTime for running race: ");
  timeConv(a.runSecs);
  printf("\nCompetitor %s has a total time of: ", a.name);
  timeConv(a.totalSecs);
  return (EXIT_SUCCESS);
}


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)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1050 <scanf@plt>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
add    $0x20,%rsi
lea    0xebf(%rip),%rdi
call   1050 <scanf@plt>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
add    $0x24,%rsi
lea    0xe9d(%rip),%rdi
call   1050 <scanf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x40(%rbp),%rsi
add    $0x28,%rsi
lea    0xe7b(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%edi
call   1030 <timeConv@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
call   1030 <timeConv@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%edi
call   1030 <timeConv@plt>
lea    -0x40(%rbp),%rsi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <timeConv@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec9(%rip),%rdi
lea    0x8(%rsp),%r14
mov    %r14,%rsi
call   1050 <scanf@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x28(%rsp),%rsi
lea    0xecd(%rip),%rbx
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x2c(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x2c(%rsp),%eax
add    0x28(%rsp),%eax
add    0x30(%rsp),%eax
mov    %eax,0x34(%rsp)
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rsp),%edi
call   1030 <timeConv@plt>
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2c(%rsp),%edi
call   1030 <timeConv@plt>
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x30(%rsp),%edi
call   1030 <timeConv@plt>
lea    0xec6(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x34(%rsp),%edi
call   1030 <timeConv@plt>
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.competitor = type { [30 x i8], i32, i32, i32, i32 }
@.str = [21 x i8] c"Please enter a name:\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [39 x i8] c"Please enter swimming time in seconds:\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [36 x i8] c"Please enter cycle time in seconds:\00"
@.str.5 = [38 x i8] c"Please enter running time in seconds:\00"
@.str.6 = [23 x i8] c"Competitor's name: %s\0A\00"
@.str.7 = [16 x i8] c"Time for Swim: \00"
@.str.8 = [23 x i8] c"\0ATime for Cycle race: \00"
@.str.9 = [25 x i8] c"\0ATime for running race: \00"
@.str.10 = [37 x i8] c"\0ACompetitor %s has a total time of: \00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.competitor
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 0
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %8, i64 0, i64 0
%10 = bitcast i8* %9 to i32*
%11 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%13 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 1
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%16 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 2
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%19 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 3
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %19)
%21 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 1
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 2
%24 = load i32, i32* %23
%25 = add nsw i32 %22, %24
%26 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 3
%27 = load i32, i32* %26
%28 = add nsw i32 %25, %27
%29 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 4
store i32 %28, i32* %29
%30 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 0
%31 = getelementptr inbounds [30 x i8], [30 x i8]* %30, i64 0, i64 0
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%34 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 1
%35 = load i32, i32* %34
%36 = call i32 @timeConv(i32 %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%38 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 2
%39 = load i32, i32* %38
%40 = call i32 @timeConv(i32 %39)
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%42 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 3
%43 = load i32, i32* %42
%44 = call i32 @timeConv(i32 %43)
%45 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 0
%46 = getelementptr inbounds [30 x i8], [30 x i8]* %45, i64 0, i64 0
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0), i8* %46)
%48 = getelementptr inbounds %struct.competitor, %struct.competitor* %6, i32 0, i32 4
%49 = load i32, i32* %48
%50 = call i32 @timeConv(i32 %49)
%51 = load i32, i32* @EXIT_SUCCESS
ret i32 %51
}

LLVM IR (-O2):
%struct.competitor = type { [30 x i8], i32, i32, i32, i32 }
@.str = [21 x i8] c"Please enter a name:\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [39 x i8] c"Please enter swimming time in seconds:\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [36 x i8] c"Please enter cycle time in seconds:\00"
@.str.5 = [38 x i8] c"Please enter running time in seconds:\00"
@.str.6 = [23 x i8] c"Competitor's name: %s\0A\00"
@.str.7 = [16 x i8] c"Time for Swim: \00"
@.str.8 = [23 x i8] c"\0ATime for Cycle race: \00"
@.str.9 = [25 x i8] c"\0ATime for running race: \00"
@.str.10 = [37 x i8] c"\0ACompetitor %s has a total time of: \00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.competitor
%4 = getelementptr inbounds %struct.competitor, %struct.competitor* %3, i64 0, i32 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = bitcast %struct.competitor* %3 to i32*
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%9 = getelementptr inbounds %struct.competitor, %struct.competitor* %3, i64 0, i32 1
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %9)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0))
%12 = getelementptr inbounds %struct.competitor, %struct.competitor* %3, i64 0, i32 2
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%15 = getelementptr inbounds %struct.competitor, %struct.competitor* %3, i64 0, i32 3
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %15)
%17 = load i32, i32* %9
%18 = load i32, i32* %12
%19 = add nsw i32 %18, %17
%20 = load i32, i32* %15
%21 = add nsw i32 %19, %20
%22 = getelementptr inbounds %struct.competitor, %struct.competitor* %3, i64 0, i32 4
store i32 %21, i32* %22
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i8* %4)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%25 = load i32, i32* %9
%26 = call i32 @timeConv(i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%28 = load i32, i32* %12
%29 = call i32 @timeConv(i32 %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%31 = load i32, i32* %15
%32 = call i32 @timeConv(i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0), i8* %4)
%34 = load i32, i32* %22
%35 = call i32 @timeConv(i32 %34)
%36 = load i32, i32* @EXIT_SUCCESS
ret i32 %36
}