#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 *, ...);
int strcmp(char *, char *);
int /*<<< orphan*/ strcpy1(char *, char *);
int /*<<< orphan*/ strcpy2(char *, char *);
int /*<<< orphan*/ strupper(char *);
int main() {
  char tab[256];
  int comp;
  strcpy1(tab, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
  printf("tab = %s\n", tab);
  strcpy2(tab, "Hello!");
  printf("tab = %s\n", tab);
  comp = strcmp("ABCD", "ABCD");
  printf("'ABCD' et 'ABCD' => %d\n", comp);
  comp = strcmp("ABCD", "AB");
  printf("'ABCD' et 'AB' => %d\n", comp);
  comp = strcmp(tab, "AB");
  printf("'%s' et 'AB' => %d\n", tab, comp);
  strupper(tab);
  printf("upper = %s\n", tab);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1050 <strcpy1@plt>
lea    -0x110(%rbp),%rsi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
lea    0xe8d(%rip),%rsi
call   1070 <strcpy2@plt>
lea    -0x110(%rbp),%rsi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe73(%rip),%rsi
mov    %rsi,%rdi
call   1040 <strcmp@plt>
mov    %eax,-0x114(%rbp)
mov    -0x114(%rbp),%esi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4a(%rip),%rdi
lea    0xe60(%rip),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x114(%rbp)
mov    -0x114(%rbp),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
lea    0xe33(%rip),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x114(%rbp)
lea    -0x110(%rbp),%rsi
mov    -0x114(%rbp),%edx
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
call   1060 <strupper@plt>
lea    -0x110(%rbp),%rsi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
lea    0xe9f(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <strcpy1@plt>
lea    0xea8(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcpy2@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe7e(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
lea    0xe88(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1060 <strupper@plt>
lea    0xe81(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.1 = [10 x i8] c"tab = %s\0A\00"
@.str.2 = [7 x i8] c"Hello!\00"
@.str.3 = [5 x i8] c"ABCD\00"
@.str.4 = [24 x i8] c"'ABCD' et 'ABCD' => %d\0A\00"
@.str.5 = [3 x i8] c"AB\00"
@.str.6 = [22 x i8] c"'ABCD' et 'AB' => %d\0A\00"
@.str.7 = [20 x i8] c"'%s' et 'AB' => %d\0A\00"
@.str.8 = [12 x i8] c"upper = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy1(i8* %4, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%9 = call i32 @strcpy2(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i32 %12, i32* %3
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%15 = call i32 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%19 = call i32 @strcmp(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32 %19, i32* %3
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%21 = load i32, i32* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %20, i32 %21)
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%24 = call i32 @strupper(i8* %23)
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZ\00"
@.str.1 = [10 x i8] c"tab = %s\0A\00"
@.str.2 = [7 x i8] c"Hello!\00"
@.str.4 = [24 x i8] c"'ABCD' et 'ABCD' => %d\0A\00"
@.str.5 = [3 x i8] c"AB\00"
@.str.6 = [22 x i8] c"'ABCD' et 'AB' => %d\0A\00"
@.str.7 = [20 x i8] c"'%s' et 'AB' => %d\0A\00"
@.str.8 = [12 x i8] c"upper = %s\0A\00"
define i32 @main() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy1(i8* %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 @strcpy2(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 0)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 1)
%9 = call i32 @strcmp(i8* %2, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), i8* %2, i32 %9)
%11 = call i32 @strupper(i8* %2)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i8* %2)
ret i32 0
}