#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*/ printf(char *, char *);
char toupper(char);
int main() {
  char tekst[] = "Dette er en tekst.";
  int i;
  for (i = 0; i < 17; i = i + 1) {
    tekst[i] = toupper(tekst[i]);
  }
  printf("%s", tekst);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%ax
mov    %ax,-0x10(%rbp)
mov    0xebc(%rip),%al
mov    %al,-0xe(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x11,-0x24(%rbp)
jge    1190 <main+0x70>
movslq -0x24(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%edi
call   1030 <toupper@plt>
mov    %al,%cl
movslq -0x24(%rbp),%rax
mov    %cl,-0x20(%rbp,%rax,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1160 <main+0x40>
lea    -0x20(%rbp),%rsi
lea    0xe78(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x2e7473,0xf(%rsp)
mov    $0x44,%edi
call   1030 <toupper@plt>
mov    %al,(%rsp)
mov    $0x65,%edi
call   1030 <toupper@plt>
mov    %al,0x1(%rsp)
mov    $0x74,%edi
call   1030 <toupper@plt>
mov    %al,0x2(%rsp)
mov    $0x74,%edi
call   1030 <toupper@plt>
mov    %al,0x3(%rsp)
mov    $0x65,%edi
call   1030 <toupper@plt>
mov    %al,0x4(%rsp)
mov    $0x20,%edi
call   1030 <toupper@plt>
mov    %al,0x5(%rsp)
mov    $0x65,%edi
call   1030 <toupper@plt>
mov    %al,0x6(%rsp)
mov    $0x72,%edi
call   1030 <toupper@plt>
mov    %al,0x7(%rsp)
mov    $0x20,%edi
call   1030 <toupper@plt>
mov    %al,0x8(%rsp)
mov    $0x65,%edi
call   1030 <toupper@plt>
mov    %al,0x9(%rsp)
mov    $0x6e,%edi
call   1030 <toupper@plt>
mov    %al,0xa(%rsp)
mov    $0x20,%edi
call   1030 <toupper@plt>
mov    %al,0xb(%rsp)
mov    $0x74,%edi
call   1030 <toupper@plt>
mov    %al,0xc(%rsp)
mov    $0x65,%edi
call   1030 <toupper@plt>
mov    %al,0xd(%rsp)
mov    $0x6b,%edi
call   1030 <toupper@plt>
mov    %al,0xe(%rsp)
mov    $0x73,%edi
call   1030 <toupper@plt>
mov    %al,0xf(%rsp)
mov    $0x74,%edi
call   1030 <toupper@plt>
mov    %al,0x10(%rsp)
lea    0xde8(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.tekst = [19 x i8] c"Dette er en tekst.\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [19 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [19 x i8]* %2 to i8*
store i32 0, i32* %3
br label %5
5: ; preds = %17, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 17
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 %10
%12 = load i8, i8* %11
%13 = call signext i8 @toupper(i8 signext %12)
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 %15
store i8 %13, i8* %16
br label %17
17: ; preds = %8
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %5
20: ; preds = %5
%21 = getelementptr inbounds [19 x i8], [19 x i8]* %2, i64 0, i64 0
%22 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %21)
ret i32 0
}

LLVM IR (-O2):
@__const.main.tekst = [19 x i8] c"Dette er en tekst.\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [19 x i8]
%2 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 0
%3 = tail call signext i8 @toupper(i8 signext 68)
store i8 %3, i8* %2
%4 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 1
%5 = tail call signext i8 @toupper(i8 signext 101)
store i8 %5, i8* %4
%6 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 2
%7 = tail call signext i8 @toupper(i8 signext 116)
store i8 %7, i8* %6
%8 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 3
%9 = tail call signext i8 @toupper(i8 signext 116)
store i8 %9, i8* %8
%10 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 4
%11 = tail call signext i8 @toupper(i8 signext 101)
store i8 %11, i8* %10
%12 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 5
%13 = tail call signext i8 @toupper(i8 signext 32)
store i8 %13, i8* %12
%14 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 6
%15 = tail call signext i8 @toupper(i8 signext 101)
store i8 %15, i8* %14
%16 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 7
%17 = tail call signext i8 @toupper(i8 signext 114)
store i8 %17, i8* %16
%18 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 8
%19 = tail call signext i8 @toupper(i8 signext 32)
store i8 %19, i8* %18
%20 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 9
%21 = tail call signext i8 @toupper(i8 signext 101)
store i8 %21, i8* %20
%22 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 10
%23 = tail call signext i8 @toupper(i8 signext 110)
store i8 %23, i8* %22
%24 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 11
%25 = tail call signext i8 @toupper(i8 signext 32)
store i8 %25, i8* %24
%26 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 12
%27 = tail call signext i8 @toupper(i8 signext 116)
store i8 %27, i8* %26
%28 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 13
%29 = tail call signext i8 @toupper(i8 signext 101)
store i8 %29, i8* %28
%30 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 14
%31 = tail call signext i8 @toupper(i8 signext 107)
store i8 %31, i8* %30
%32 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 15
%33 = tail call signext i8 @toupper(i8 signext 115)
store i8 %33, i8* %32
%34 = getelementptr inbounds [19 x i8], [19 x i8]* %1, i64 0, i64 16
%35 = tail call signext i8 @toupper(i8 signext 116)
store i8 %35, i8* %34
%36 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}