#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  int i;
  char command[128];
  if (argc < 2) {
    printf("Dette programet kjører en komando igjen og igjen\n\n\teverrun "
           "kamando\n\n");
    exit(0);
  }
  command[0] = '\0';
  for (i = 1; i < argc; i++) {
    strcat(command, argv[i]);
    strcat(command, " ");
  }
  printf("do: %s\n", command);
  while (1) {
    system(command);
    sleep(5);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1188 <main+0x38>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
movb   $0x0,-0xa0(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11db <main+0x8b>
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1050 <strcat@plt>
lea    -0xa0(%rbp),%rdi
lea    0xe7e(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1196 <main+0x46>
lea    -0xa0(%rbp),%rsi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xa0(%rbp),%rdi
call   1030 <system@plt>
mov    $0x5,%edi
call   1070 <sleep@plt>
jmp    11f0 <main+0xa0>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
cmp    $0x1,%edi
jle    11e4 <main+0x84>
mov    %rsi,%r14
movb   $0x0,(%rsp)
mov    %edi,%r12d
mov    $0x1,%ebx
mov    %rsp,%r13
lea    0xe72(%rip),%r15
xchg   %ax,%ax
mov    (%r14,%rbx,8),%rsi
mov    %r13,%rdi
call   1060 <strcat@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1060 <strcat@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1190 <main+0x30>
lea    0xe4b(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1040 <system@plt>
mov    $0x5,%edi
call   1080 <sleep@plt>
jmp    11d0 <main+0x70>
lea    0xe1f(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"Dette programet kj\C3\B8rer en komando igjen og igjen\0A\0A\09everrun kamando\0A\0A\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [8 x i8] c"do: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 0)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
store i8 0, i8* %14
store i32 1, i32* %6
br label %15
15: ; preds = %29, %13
%16 = load i32, i32* %6
%17 = load i32, i32* %4
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %32
19: ; preds = %15
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i32 @strcat(i8* %20, i8* %25)
%27 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%28 = call i32 @strcat(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %29
29: ; preds = %19
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %15
32: ; preds = %15
%33 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %32, %35
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%37 = call i32 @system(i8* %36)
%38 = call i32 @sleep(i32 5)
br label %35
}

LLVM IR (-O2):
@.str.1 = [2 x i8] c" \00"
@.str.2 = [8 x i8] c"do: %s\0A\00"
@str = [69 x i8] c"Dette programet kj\C3\B8rer en komando igjen og igjen\0A\0A\09everrun kamando\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %2
store i8 0, i8* %4
%10 = zext i32 %0 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ 1, %9 ], [ %17, %11 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = call i32 @strcat(i8* %4, i8* %14)
%16 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = add nuw nsw i64 %12, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %19, label %11
19: ; preds = %11
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %4)
br label %21
21: ; preds = %21, %19
%22 = call i32 @system(i8* %4)
%23 = call i32 @sleep(i32 5)
br label %21
}