#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 */
struct timeval {
  int /*<<< orphan*/ tv_usec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  int i, j, l;
  struct timeval s, e;
  int d[200][200];
  int t = 200;
  if (argv[1])
    l = atoi(argv[1]);
  for (i = 0; i < 200; i++)
    for (j = 0; j < 200; j++)
      d[i][j] = i * j;
  if (l) {
    gettimeofday(&s, NULL);
    printf("sec %ld, usec %ld\n", s.tv_sec, s.tv_usec);
    for (i = 0; i < 200; i++)
      for (j = 0; j < 200; j++)
        t = t + d[i][j];
    gettimeofday(&e, NULL);
    printf("end sec %ld, usec %ld\n", e.tv_sec, e.tv_usec);
  } else {
    gettimeofday(&s, NULL);
    printf("sec %ld, usec %ld\n", s.tv_sec, s.tv_usec);
    for (j = 0; j < 200; j++)
      for (i = 0; i < 200; i++)
        t = t + d[i][j];
    gettimeofday(&e, NULL);
    printf("end sec %ld, usec %ld\n", e.tv_sec, e.tv_usec);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x27140,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xc8,-0x27134(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     1172 <main+0x42>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xc8,-0x14(%rbp)
jge    11de <main+0xae>
movl   $0x0,-0x18(%rbp)
cmpl   $0xc8,-0x18(%rbp)
jge    11cb <main+0x9b>
mov    -0x14(%rbp),%edx
imul   -0x18(%rbp),%edx
movslq -0x14(%rbp),%rcx
lea    -0x27130(%rbp),%rax
imul   $0x320,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118d <main+0x5d>
jmp    11d0 <main+0xa0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1179 <main+0x49>
cmpl   $0x0,-0x1c(%rbp)
je     129c <main+0x16c>
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xe02(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0xc8,-0x14(%rbp)
jge    1278 <main+0x148>
movl   $0x0,-0x18(%rbp)
cmpl   $0xc8,-0x18(%rbp)
jge    1265 <main+0x135>
mov    -0x27134(%rbp),%eax
movslq -0x14(%rbp),%rdx
lea    -0x27130(%rbp),%rcx
imul   $0x320,%rdx,%rdx
add    %rdx,%rcx
movslq -0x18(%rbp),%rdx
add    (%rcx,%rdx,4),%eax
mov    %eax,-0x27134(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1222 <main+0xf2>
jmp    126a <main+0x13a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    120e <main+0xde>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xd6e(%rip),%rdi
call   1030 <printf@plt>
jmp    134b <main+0x21b>
lea    -0x28(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
lea    0xd4e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0xc8,-0x18(%rbp)
jge    132c <main+0x1fc>
movl   $0x0,-0x14(%rbp)
cmpl   $0xc8,-0x14(%rbp)
jge    1319 <main+0x1e9>
mov    -0x27134(%rbp),%eax
movslq -0x14(%rbp),%rdx
lea    -0x27130(%rbp),%rcx
imul   $0x320,%rdx,%rdx
add    %rdx,%rcx
movslq -0x18(%rbp),%rdx
add    (%rcx,%rdx,4),%eax
mov    %eax,-0x27134(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12d6 <main+0x1a6>
jmp    131e <main+0x1ee>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12c2 <main+0x192>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0xcba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x27140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    0x10(%rsp),%edx
mov    0x14(%rsp),%esi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@.str = [19 x i8] c"sec %ld, usec %ld\0A\00"
@.str.1 = [23 x i8] c"end sec %ld, usec %ld\0A\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 %struct.timeval
%10 = alloca %struct.timeval
%11 = alloca [200 x [200 x i32]]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 200, i32* %12
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %22
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %8
br label %22
22: ; preds = %17, %2
store i32 0, i32* %6
br label %23
23: ; preds = %44, %22
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 200
br i1 %25, label %26, label %47
26: ; preds = %23
store i32 0, i32* %7
br label %27
27: ; preds = %40, %26
%28 = load i32, i32* %7
%29 = icmp slt i32 %28, 200
br i1 %29, label %30, label %43
30: ; preds = %27
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = mul nsw i32 %31, %32
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [200 x [200 x i32]], [200 x [200 x i32]]* %11, i64 0, i64 %35
%37 = load i32, i32* %7
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [200 x i32], [200 x i32]* %36, i64 0, i64 %38
store i32 %33, i32* %39
br label %40
40: ; preds = %30
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %27
43: ; preds = %27
br label %44
44: ; preds = %43
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %23
47: ; preds = %23
%48 = load i32, i32* %8
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %88
50: ; preds = %47
%51 = call i32 @gettimeofday(%struct.timeval* %9, i32* null)
%52 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 1
%53 = load i32, i32* %52
%54 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 0
%55 = load i32, i32* %54
%56 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %53, i32 %55)
store i32 0, i32* %6
br label %57
57: ; preds = %78, %50
%58 = load i32, i32* %6
%59 = icmp slt i32 %58, 200
br i1 %59, label %60, label %81
60: ; preds = %57
store i32 0, i32* %7
br label %61
61: ; preds = %74, %60
%62 = load i32, i32* %7
%63 = icmp slt i32 %62, 200
br i1 %63, label %64, label %77
64: ; preds = %61
%65 = load i32, i32* %12
%66 = load i32, i32* %6
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [200 x [200 x i32]], [200 x [200 x i32]]* %11, i64 0, i64 %67
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [200 x i32], [200 x i32]* %68, i64 0, i64 %70
%72 = load i32, i32* %71
%73 = add nsw i32 %65, %72
store i32 %73, i32* %12
br label %74
74: ; preds = %64
%75 = load i32, i32* %7
%76 = add nsw i32 %75, 1
store i32 %76, i32* %7
br label %61
77: ; preds = %61
br label %78
78: ; preds = %77
%79 = load i32, i32* %6
%80 = add nsw i32 %79, 1
store i32 %80, i32* %6
br label %57
81: ; preds = %57
%82 = call i32 @gettimeofday(%struct.timeval* %10, i32* null)
%83 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 1
%84 = load i32, i32* %83
%85 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 0
%86 = load i32, i32* %85
%87 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %84, i32 %86)
br label %126
88: ; preds = %47
%89 = call i32 @gettimeofday(%struct.timeval* %9, i32* null)
%90 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 1
%91 = load i32, i32* %90
%92 = getelementptr inbounds %struct.timeval, %struct.timeval* %9, i32 0, i32 0
%93 = load i32, i32* %92
%94 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %91, i32 %93)
store i32 0, i32* %7
br label %95
95: ; preds = %116, %88
%96 = load i32, i32* %7
%97 = icmp slt i32 %96, 200
br i1 %97, label %98, label %119
98: ; preds = %95
store i32 0, i32* %6
br label %99
99: ; preds = %112, %98
%100 = load i32, i32* %6
%101 = icmp slt i32 %100, 200
br i1 %101, label %102, label %115
102: ; preds = %99
%103 = load i32, i32* %12
%104 = load i32, i32* %6
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [200 x [200 x i32]], [200 x [200 x i32]]* %11, i64 0, i64 %105
%107 = load i32, i32* %7
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds [200 x i32], [200 x i32]* %106, i64 0, i64 %108
%110 = load i32, i32* %109
%111 = add nsw i32 %103, %110
store i32 %111, i32* %12
br label %112
112: ; preds = %102
%113 = load i32, i32* %6
%114 = add nsw i32 %113, 1
store i32 %114, i32* %6
br label %99
115: ; preds = %99
br label %116
116: ; preds = %115
%117 = load i32, i32* %7
%118 = add nsw i32 %117, 1
store i32 %118, i32* %7
br label %95
119: ; preds = %95
%120 = call i32 @gettimeofday(%struct.timeval* %10, i32* null)
%121 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 1
%122 = load i32, i32* %121
%123 = getelementptr inbounds %struct.timeval, %struct.timeval* %10, i32 0, i32 0
%124 = load i32, i32* %123
%125 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %122, i32 %124)
br label %126
126: ; preds = %119, %81
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@.str = [19 x i8] c"sec %ld, usec %ld\0A\00"
@.str.1 = [23 x i8] c"end sec %ld, usec %ld\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = bitcast %struct.timeval* %3 to i8*
%6 = bitcast %struct.timeval* %4 to i8*
%7 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%11 = load i32, i32* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11)
%13 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%17 = load i32, i32* %16
%18 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %17)
ret i32 0
}