#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*/ AfficherImage(char *);
unsigned char *CreerImage(int, int);
int /*<<< orphan*/ Degrade(unsigned char *, int, int);
int EXIT_SUCCESS;
int /*<<< orphan*/ EcrireImagePGM(char *, unsigned char *, int, int);
int /*<<< orphan*/ Negatif(unsigned char *, int, int);
int /*<<< orphan*/ free(unsigned char *);
int main(int argc, char **argv) {
  int largeur = 1200;
  int hauteur = 600;
  unsigned char *y = CreerImage(largeur, hauteur);
  Degrade(y, largeur, hauteur);
  EcrireImagePGM("degrade.pgm", y, largeur, hauteur);
  AfficherImage("degrade.pgm");
  Negatif(y, largeur, hauteur);
  EcrireImagePGM("negatif.pgm", y, largeur, hauteur);
  AfficherImage("negatif.pgm");
  free(y);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x4b0,-0x14(%rbp)
movl   $0x258,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1080 <CreerImage@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <Degrade@plt>
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe4d(%rip),%rdi
call   1070 <EcrireImagePGM@plt>
lea    0xe41(%rip),%rdi
call   1060 <AfficherImage@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1050 <Negatif@plt>
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe28(%rip),%rdi
call   1070 <EcrireImagePGM@plt>
lea    0xe1c(%rip),%rdi
call   1060 <AfficherImage@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    0x2ddb(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x4b0,%edi
mov    $0x258,%esi
call   1080 <CreerImage@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x4b0,%esi
mov    $0x258,%edx
call   1040 <Degrade@plt>
lea    0xe71(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4b0,%edx
mov    $0x258,%ecx
call   1070 <EcrireImagePGM@plt>
mov    %r14,%rdi
call   1060 <AfficherImage@plt>
mov    %rbx,%rdi
mov    $0x4b0,%esi
mov    $0x258,%edx
call   1050 <Negatif@plt>
lea    0xe47(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x4b0,%edx
mov    $0x258,%ecx
call   1070 <EcrireImagePGM@plt>
mov    %r14,%rdi
call   1060 <AfficherImage@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [12 x i8] c"degrade.pgm\00"
@.str.1 = [12 x i8] c"negatif.pgm\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1200, i32* %6
store i32 600, i32* %7
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = call i8* @CreerImage(i32 %9, i32 %10)
store i8* %11, i8** %8
%12 = load i8*, i8** %8
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = call i32 @Degrade(i8* %12, i32 %13, i32 %14)
%16 = load i8*, i8** %8
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = call i32 @EcrireImagePGM(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %16, i32 %17, i32 %18)
%20 = call i32 @AfficherImage(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%21 = load i8*, i8** %8
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = call i32 @Negatif(i8* %21, i32 %22, i32 %23)
%25 = load i8*, i8** %8
%26 = load i32, i32* %6
%27 = load i32, i32* %7
%28 = call i32 @EcrireImagePGM(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %25, i32 %26, i32 %27)
%29 = call i32 @AfficherImage(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%30 = load i8*, i8** %8
%31 = call i32 @free(i8* %30)
%32 = load i32, i32* @EXIT_SUCCESS
ret i32 %32
}

LLVM IR (-O2):
@.str = [12 x i8] c"degrade.pgm\00"
@.str.1 = [12 x i8] c"negatif.pgm\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @CreerImage(i32 1200, i32 600)
%4 = tail call i32 @Degrade(i8* %3, i32 1200, i32 600)
%5 = tail call i32 @EcrireImagePGM(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %3, i32 1200, i32 600)
%6 = tail call i32 @AfficherImage(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @Negatif(i8* %3, i32 1200, i32 600)
%8 = tail call i32 @EcrireImagePGM(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %3, i32 1200, i32 600)
%9 = tail call i32 @AfficherImage(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @free(i8* %3)
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}